1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 12:43:36 +01:00
llvm-mirror/test/MC/AArch64/label-arithmetic-elf.s
Fangrui Song 25a0241f66 [llvm-objdump] -d: print 00000000 <foo>: instead of 00000000 foo:
The new behavior matches GNU objdump. A pair of angle brackets makes tests slightly easier.

`.foo:` is not unique and thus cannot be used in a `CHECK-LABEL:` directive.
Without `-LABEL`, the CHECK line can match the `Disassembly of section`
line and causes the next `CHECK-NEXT:` to fail.

```
Disassembly of section .foo:

0000000000001634 .foo:
```

Bdragon: <> has metalinguistic connotation. it just "feels right"

Reviewed By: rupprecht

Differential Revision: https://reviews.llvm.org/D75713
2020-03-05 18:05:28 -08:00

99 lines
2.1 KiB
ArmAsm

// RUN: llvm-mc -triple aarch64-elf -filetype=obj %s -o - | llvm-objdump -d - | FileCheck %s
start:
.space 8
end:
// CHECK-LABEL: <end>:
adds w0, w1, #(end - start)
adds x0, x1, #(end - start)
add w0, w1, #(end - start)
add x0, x1, #(end - start)
cmp w0, #(end - start)
cmp x0, #(end - start)
sub w0, w1, #(end - start)
sub x0, x1, #(end - start)
// FIXME: adr x1, #(end - start) // This could be supported, but currently doesn't work
// CHECK: adds w0, w1, #8
// CHECK: adds x0, x1, #8
// CHECK: add w0, w1, #8
// CHECK: add x0, x1, #8
// CHECK: cmp w0, #8
// CHECK: cmp x0, #8
// CHECK: sub w0, w1, #8
// CHECK: sub x0, x1, #8
// FIXME: adr x1, #8
add w0, w1, #(end - start), lsl #12
cmp w0, #(end - start), lsl #12
// CHECK: add w0, w1, #8, lsl #12
// CHECK: cmp w0, #8, lsl #12
add w0, w1, #((end - start) >> 2)
cmp w0, #((end - start) >> 2)
// CHECK: add w0, w1, #2
// CHECK: cmp w0, #2
add w0, w1, #(end - start + 12)
cmp w0, #(end - start + 12)
// CHECK: add w0, w1, #20
// CHECK: cmp w0, #20
add w0, w1, #(forward - end)
cmp w0, #(forward - end)
// CHECK: add w0, w1, #320
// CHECK: cmp w0, #320
// Add some filler so we don't have to modify #(forward - end) if we add more
// instructions above
.Lfiller:
.space 320 - (.Lfiller - end)
forward:
.space 8
.Lstart:
.space 8
.Lend:
add w0, w1, #(.Lend - .Lstart)
cmp w0, #(.Lend - .Lstart)
// CHECK: add w0, w1, #8
// CHECK: cmp w0, #8
.Lprivate1:
.space 8
notprivate:
.space 8
.Lprivate2:
add w0, w1, #(.Lprivate2 - .Lprivate1)
cmp w0, #(.Lprivate2 - .Lprivate1)
// CHECK: add w0, w1, #16
// CHECK: cmp w0, #16
.type foo, @function
foo:
// CHECK-LABEL: <foo>:
add w0, w1, #(foo - .Lprivate2)
cmp w0, #(foo - .Lprivate2)
// CHECK: add w0, w1, #8
// CHECK: cmp w0, #8
ret
.type goo, @function
goo:
// CHECK-LABEL: <goo>:
add w0, w1, #(goo - foo)
cmp w0, #(goo - foo)
// CHECK: add w0, w1, #12
// CHECK: cmp w0, #12
add w0, w1, #(. - goo)
cmp w0, #(. - goo)
// CHECK: add w0, w1, #8
// CHECK: cmp w0, #12
ret