1 # RUN: llvm-mc --triple=loongarch64 --mattr=-relax %s \
2 # RUN: | FileCheck --check-prefix=CHECK-ASM %s
3 # RUN: llvm-mc --triple=loongarch64 --mattr=-relax --filetype=obj %s \
4 # RUN: | llvm-readobj -r - | FileCheck --check-prefix=CHECK-RELOC %s
6 ## Test the operation of the push and pop assembler directives when
7 ## using .option relax. Checks that using .option pop correctly restores
8 ## all target features to their state at the point where .option pop was
11 # CHECK-ASM: .option push
12 .option push # relax = false
14 # CHECK-ASM: .option relax
15 .option relax # relax = true
17 # CHECK-ASM: pcalau12i $a0, %pc_hi20(sym1)
18 # CHECK-ASM-NEXT: addi.d $a0, $a0, %pc_lo12(sym1)
19 # CHECK-RELOC: R_LARCH_PCALA_HI20 sym1 0x0
20 # CHECK-RELOC-NEXT: R_LARCH_RELAX - 0x0
21 # CHECK-RELOC-NEXT: R_LARCH_PCALA_LO12 sym1 0x0
22 # CHECK-RELOC-NEXT: R_LARCH_RELAX - 0x0
25 # CHECK-ASM: .option push
26 .option push # relax = true
28 # CHECK-ASM: .option norelax
29 .option norelax # relax = false
31 # CHECK-ASM: pcalau12i $a0, %pc_hi20(sym2)
32 # CHECK-ASM-NEXT: addi.d $a0, $a0, %pc_lo12(sym2)
33 # CHECK-RELOC-NEXT: R_LARCH_PCALA_HI20 sym2 0x0
34 # CHECK-RELOC-NOT: R_LARCH_RELAX - 0x0
35 # CHECK-RELOC-NEXT: R_LARCH_PCALA_LO12 sym2 0x0
36 # CHECK-RELOC-NOT: R_LARCH_RELAX - 0x0
39 # CHECK-ASM: .option pop
40 .option pop # relax = true
42 # CHECK-ASM: pcalau12i $a0, %pc_hi20(sym3)
43 # CHECK-ASM-NEXT: addi.d $a0, $a0, %pc_lo12(sym3)
44 # CHECK-RELOC: R_LARCH_PCALA_HI20 sym3 0x0
45 # CHECK-RELOC-NEXT: R_LARCH_RELAX - 0x0
46 # CHECK-RELOC-NEXT: R_LARCH_PCALA_LO12 sym3 0x0
47 # CHECK-RELOC-NEXT: R_LARCH_RELAX - 0x0
50 # CHECK-ASM: .option pop
51 .option pop # relax = false
54 # CHECK-ASM: pcalau12i $a0, %pc_hi20(sym4)
55 # CHECK-ASM-NEXT: addi.d $a0, $a0, %pc_lo12(sym4)
56 # CHECK-RELOC-NEXT: R_LARCH_PCALA_HI20 sym4 0x0
57 # CHECK-RELOC-NOT: R_LARCH_RELAX - 0x0
58 # CHECK-RELOC-NEXT: R_LARCH_PCALA_LO12 sym4 0x0
59 # CHECK-RELOC-NOT: R_LARCH_RELAX - 0x0