68 lines · plain
1# RUN: llvm-mc --triple=loongarch64 %s --show-encoding \2# RUN: | FileCheck --check-prefix=CHECK-FIXUP %s3# RUN: llvm-mc --filetype=obj --triple=loongarch64 %s \4# RUN: | llvm-objdump -d - | FileCheck --check-prefix=CHECK-INSTR %s5# RUN: llvm-mc --filetype=obj --triple=loongarch64 %s \6# RUN: | llvm-readobj -r - | FileCheck --check-prefix=CHECK-REL %s7 8## Checks that fixups that can be resolved within the same object file are9## applied correctly.10 11.LBB0:12lu12i.w $t1, %abs_hi20(val)13# CHECK-FIXUP: fixup A - offset: 0, value: %abs_hi20(val), kind: fixup_loongarch_abs_hi2014# CHECK-INSTR: lu12i.w $t1, 7456515 16ori $t1, $t1, %abs_lo12(val)17# CHECK-FIXUP: fixup A - offset: 0, value: %abs_lo12(val), kind: fixup_loongarch_abs_lo1218# CHECK-INSTR: ori $t1, $t1, 165619 20b .LBB021# CHECK-FIXUP: fixup A - offset: 0, value: .LBB0, kind: fixup_loongarch_b2622# CHECK-INSTR: b -823b .LBB224# CHECK-FIXUP: fixup A - offset: 0, value: .LBB2, kind: fixup_loongarch_b2625# CHECK-INSTR: b 33100426beq $a0, $a1, .LBB027# CHECK-FIXUP: fixup A - offset: 0, value: .LBB0, kind: fixup_loongarch_b1628# CHECK-INSTR: beq $a0, $a1, -1629blt $a0, $a1, .LBB130# CHECK-FIXUP: fixup A - offset: 0, value: .LBB1, kind: fixup_loongarch_b1631# CHECK-INSTR: blt $a0, $a1, 111632beqz $a0, .LBB033# CHECK-FIXUP: fixup A - offset: 0, value: .LBB0, kind: fixup_loongarch_b2134# CHECK-INSTR: beqz $a0, -2435bnez $a0, .LBB136# CHECK-FIXUP: fixup A - offset: 0, value: .LBB1, kind: fixup_loongarch_b2137# CHECK-INSTR: bnez $a0, 110838 39.fill 110440 41.LBB1:42 43.fill 32987644nop45.LBB2:46 47.set val, 0x1234567848 49# CHECK-REL-NOT: R_LARCH50 51## Testing the function call offset could resolved by assembler52## when the function and the callsite within the same compile unit.53func:54.fill 10055bl func56# CHECK-FIXUP: fixup A - offset: 0, value: func, kind: fixup_loongarch_b2657# CHECK-INSTR: bl -10058 59.fill 1000060bl func61# CHECK-FIXUP: fixup A - offset: 0, value: func, kind: fixup_loongarch_b2662# CHECK-INSTR: bl -1010463 64.fill 2088865bl func66# CHECK-FIXUP: fixup A - offset: 0, value: func, kind: fixup_loongarch_b2667# CHECK-INSTR: bl -3099668