Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / loongarch-abs64.s
blob4bfe7df9135a9358d752ef976f00d23cfd3f5713
1 # REQUIRES: loongarch
3 # RUN: llvm-mc --filetype=obj --triple=loongarch64-unknown-elf %s -o %t.la64.o
5 # RUN: ld.lld %t.la64.o --defsym foo=0 --defsym bar=42 -o %t.la64.1
6 # RUN: llvm-objdump --no-show-raw-insn -d %t.la64.1 | FileCheck --check-prefix=CASE1 %s
7 # CASE1: lu12i.w $a0, 0
8 # CASE1-NEXT: ori $a0, $a0, 0
9 # CASE1-NEXT: lu32i.d $a0, 0
10 # CASE1-NEXT: lu52i.d $a0, $a0, 0
11 # CASE1-NEXT: lu12i.w $a1, 0
12 # CASE1-NEXT: ori $a1, $a1, 42
13 # CASE1-NEXT: lu32i.d $a1, 0
14 # CASE1-NEXT: lu52i.d $a1, $a1, 0
16 # RUN: ld.lld %t.la64.o --defsym foo=0x12345678 --defsym bar=0x87654321 -o %t.la64.2
17 # RUN: llvm-objdump --no-show-raw-insn -d %t.la64.2 | FileCheck --check-prefix=CASE2 %s
18 # CASE2: lu12i.w $a0, 74565
19 # CASE2-NEXT: ori $a0, $a0, 1656
20 # CASE2-NEXT: lu32i.d $a0, 0
21 # CASE2-NEXT: lu52i.d $a0, $a0, 0
22 # CASE2-NEXT: lu12i.w $a1, -493996
23 # CASE2-NEXT: ori $a1, $a1, 801
24 # CASE2-NEXT: lu32i.d $a1, 0
25 # CASE2-NEXT: lu52i.d $a1, $a1, 0
27 # RUN: ld.lld %t.la64.o --defsym foo=0x12345fedcb678 --defsym bar=0xfedcb12345000 -o %t.la64.3
28 # RUN: llvm-objdump --no-show-raw-insn -d %t.la64.3 | FileCheck --check-prefix=CASE3 %s
29 # CASE3: lu12i.w $a0, -4661
30 # CASE3-NEXT: ori $a0, $a0, 1656
31 # CASE3-NEXT: lu32i.d $a0, 74565
32 # CASE3-NEXT: lu52i.d $a0, $a0, 0
33 # CASE3-NEXT: lu12i.w $a1, 74565
34 # CASE3-NEXT: ori $a1, $a1, 0
35 # CASE3-NEXT: lu32i.d $a1, -4661
36 # CASE3-NEXT: lu52i.d $a1, $a1, 0
38 # RUN: ld.lld %t.la64.o --defsym foo=0xfffffeeeeeddd --defsym bar=0xfff00000f1111222 -o %t.la64.4
39 # RUN: llvm-objdump --no-show-raw-insn -d %t.la64.4 | FileCheck --check-prefix=CASE4 %s
40 # CASE4: lu12i.w $a0, -69906
41 # CASE4-NEXT: ori $a0, $a0, 3549
42 # CASE4-NEXT: lu32i.d $a0, -1
43 # CASE4-NEXT: lu52i.d $a0, $a0, 0
44 # CASE4-NEXT: lu12i.w $a1, -61167
45 # CASE4-NEXT: ori $a1, $a1, 546
46 # CASE4-NEXT: lu32i.d $a1, 0
47 # CASE4-NEXT: lu52i.d $a1, $a1, -1
49 .global _start
51 _start:
53 lu12i.w $a0, %abs_hi20(foo)
54 .reloc 1b, R_LARCH_MARK_LA, foo
55 ori $a0, $a0, %abs_lo12(foo)
56 lu32i.d $a0, %abs64_lo20(foo)
57 lu52i.d $a0, $a0, %abs64_hi12(foo)
60 lu12i.w $a1, %abs_hi20(bar)
61 .reloc 1b, R_LARCH_MARK_LA, bar
62 ori $a1, $a1, %abs_lo12(bar)
63 lu32i.d $a1, %abs64_lo20(bar)
64 lu52i.d $a1, $a1, %abs64_hi12(bar)