1// RUN: llvm-mc -triple aarch64-elf -filetype=obj %s -o - | llvm-objdump -d - | FileCheck %s 2 3start: 4 .space 8 5end: 6 // CHECK-LABEL: end: 7 8 adds w0, w1, #(end - start) 9 adds x0, x1, #(end - start) 10 add w0, w1, #(end - start) 11 add x0, x1, #(end - start) 12 cmp w0, #(end - start) 13 cmp x0, #(end - start) 14 sub w0, w1, #(end - start) 15 sub x0, x1, #(end - start) 16 // CHECK: adds w0, w1, #8 17 // CHECK: adds x0, x1, #8 18 // CHECK: add w0, w1, #8 19 // CHECK: add x0, x1, #8 20 // CHECK: cmp w0, #8 21 // CHECK: cmp x0, #8 22 // CHECK: sub w0, w1, #8 23 // CHECK: sub x0, x1, #8 24 25 add w0, w1, #(end - start), lsl #12 26 cmp w0, #(end - start), lsl #12 27 // CHECK: add w0, w1, #8, lsl #12 28 // CHECK: cmp w0, #8, lsl #12 29 30 add w0, w1, #((end - start) >> 2) 31 cmp w0, #((end - start) >> 2) 32 // CHECK: add w0, w1, #2 33 // CHECK: cmp w0, #2 34 35 add w0, w1, #(end - start + 12) 36 cmp w0, #(end - start + 12) 37 // CHECK: add w0, w1, #20 38 // CHECK: cmp w0, #20 39 40 add w0, w1, #(forward - end) 41 cmp w0, #(forward - end) 42 // CHECK: add w0, w1, #320 43 // CHECK: cmp w0, #320 44 45// Add some filler so we don't have to modify #(forward - end) if we add more 46// instructions above 47.Lfiller: 48 .space 320 - (.Lfiller - end) 49 50forward: 51 .space 8 52 53.Lstart: 54 .space 8 55.Lend: 56 add w0, w1, #(.Lend - .Lstart) 57 cmp w0, #(.Lend - .Lstart) 58 // CHECK: add w0, w1, #8 59 // CHECK: cmp w0, #8 60 61.Lprivate1: 62 .space 8 63notprivate: 64 .space 8 65.Lprivate2: 66 add w0, w1, #(.Lprivate2 - .Lprivate1) 67 cmp w0, #(.Lprivate2 - .Lprivate1) 68 // CHECK: add w0, w1, #16 69 // CHECK: cmp w0, #16 70 71 .type foo, @function 72foo: 73 // CHECK-LABEL: foo: 74 75 add w0, w1, #(foo - .Lprivate2) 76 cmp w0, #(foo - .Lprivate2) 77 // CHECK: add w0, w1, #8 78 // CHECK: cmp w0, #8 79 80 ret 81 82 .type goo, @function 83goo: 84 // CHECK-LABEL: goo: 85 86 add w0, w1, #(goo - foo) 87 cmp w0, #(goo - foo) 88 // CHECK: add w0, w1, #12 89 // CHECK: cmp w0, #12 90 91 add w0, w1, #(. - goo) 92 cmp w0, #(. - goo) 93 // CHECK: add w0, w1, #8 94 // CHECK: cmp w0, #12 95 96 ret 97