[InstCombine] Signed saturation patterns
[llvm-core.git] / test / MC / AArch64 / label-arithmetic-elf.s
blob08c4343bf18b7024c81999f74814fddc7620ce3e
1 // RUN: llvm-mc -triple aarch64-elf -filetype=obj %s -o - | llvm-objdump -d - | FileCheck %s
3 start:
4 .space 8
5 end:
6 // CHECK-LABEL: end:
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 // FIXME: adr x1, #(end - start) // This could be supported, but currently doesn't work
17 // CHECK: adds w0, w1, #8
18 // CHECK: adds x0, x1, #8
19 // CHECK: add w0, w1, #8
20 // CHECK: add x0, x1, #8
21 // CHECK: cmp w0, #8
22 // CHECK: cmp x0, #8
23 // CHECK: sub w0, w1, #8
24 // CHECK: sub x0, x1, #8
25 // FIXME: adr x1, #8
27 add w0, w1, #(end - start), lsl #12
28 cmp w0, #(end - start), lsl #12
29 // CHECK: add w0, w1, #8, lsl #12
30 // CHECK: cmp w0, #8, lsl #12
32 add w0, w1, #((end - start) >> 2)
33 cmp w0, #((end - start) >> 2)
34 // CHECK: add w0, w1, #2
35 // CHECK: cmp w0, #2
37 add w0, w1, #(end - start + 12)
38 cmp w0, #(end - start + 12)
39 // CHECK: add w0, w1, #20
40 // CHECK: cmp w0, #20
42 add w0, w1, #(forward - end)
43 cmp w0, #(forward - end)
44 // CHECK: add w0, w1, #320
45 // CHECK: cmp w0, #320
47 // Add some filler so we don't have to modify #(forward - end) if we add more
48 // instructions above
49 .Lfiller:
50 .space 320 - (.Lfiller - end)
52 forward:
53 .space 8
55 .Lstart:
56 .space 8
57 .Lend:
58 add w0, w1, #(.Lend - .Lstart)
59 cmp w0, #(.Lend - .Lstart)
60 // CHECK: add w0, w1, #8
61 // CHECK: cmp w0, #8
63 .Lprivate1:
64 .space 8
65 notprivate:
66 .space 8
67 .Lprivate2:
68 add w0, w1, #(.Lprivate2 - .Lprivate1)
69 cmp w0, #(.Lprivate2 - .Lprivate1)
70 // CHECK: add w0, w1, #16
71 // CHECK: cmp w0, #16
73 .type foo, @function
74 foo:
75 // CHECK-LABEL: foo:
77 add w0, w1, #(foo - .Lprivate2)
78 cmp w0, #(foo - .Lprivate2)
79 // CHECK: add w0, w1, #8
80 // CHECK: cmp w0, #8
82 ret
84 .type goo, @function
85 goo:
86 // CHECK-LABEL: goo:
88 add w0, w1, #(goo - foo)
89 cmp w0, #(goo - foo)
90 // CHECK: add w0, w1, #12
91 // CHECK: cmp w0, #12
93 add w0, w1, #(. - goo)
94 cmp w0, #(. - goo)
95 // CHECK: add w0, w1, #8
96 // CHECK: cmp w0, #12
98 ret