From 68cef491ebdcaffa0585cb2b22e2be88bd6e36ef Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 18 Apr 2025 20:33:40 -0700 Subject: [PATCH] [RISCV,test] Remove CHECK lines for MCAsmStreamer's fixup output The fixup output is a debug aid and should not be used to test target-specific relocation generation implementation. The llvm-mc -filetype=obj output is what truly matters. --- llvm/test/MC/RISCV/compressed-relocations.s | 9 +++------ llvm/test/MC/RISCV/fixups-compressed.s | 6 ------ llvm/test/MC/RISCV/fixups.s | 16 ---------------- llvm/test/MC/RISCV/xqcibi-relocations.s | 7 +------ 4 files changed, 4 insertions(+), 34 deletions(-) diff --git a/llvm/test/MC/RISCV/compressed-relocations.s b/llvm/test/MC/RISCV/compressed-relocations.s index 196d9873f40e..82cb1a12c389 100644 --- a/llvm/test/MC/RISCV/compressed-relocations.s +++ b/llvm/test/MC/RISCV/compressed-relocations.s @@ -1,5 +1,5 @@ -# RUN: llvm-mc -triple riscv32 -mattr=+c -M no-aliases < %s -show-encoding \ -# RUN: | FileCheck -check-prefix=INSTR -check-prefix=FIXUP %s +# RUN: llvm-mc -triple riscv32 -mattr=+c -M no-aliases %s -show-encoding \ +# RUN: | FileCheck -check-prefix=INSTR %s # RUN: llvm-mc -filetype=obj -triple riscv32 -mattr=+c < %s \ # RUN: | llvm-readobj -r - | FileCheck -check-prefix=RELOC %s # RUN: llvm-mc -filetype=obj -triple riscv32 -mattr=+c,+relax < %s \ @@ -7,17 +7,14 @@ # Check prefixes: # RELOC - Check the relocation in the object. -# FIXUP - Check the fixup on the instruction. # INSTR - Check the instruction is handled properly by the ASMPrinter c.jal foo # A compressed jump (c.j) to an unresolved symbol will be relaxed to a (jal). # RELOC: R_RISCV_JAL # INSTR: c.jal foo -# FIXUP: fixup A - offset: 0, value: foo, kind: fixup_riscv_rvc_jump c.bnez a0, foo # A compressed branch (c.bnez) to an unresolved symbol will be relaxed to a (bnez). # The (bnez) to an unresolved symbol will in turn be relaxed to (beqz; jal) -# RELOC: R_RISCV_JAL +# RELOC-NEXT: R_RISCV_JAL # INSTR: c.bnez a0, foo -# FIXUP: fixup A - offset: 0, value: foo, kind: fixup_riscv_rvc_branch diff --git a/llvm/test/MC/RISCV/fixups-compressed.s b/llvm/test/MC/RISCV/fixups-compressed.s index e856fd8a1794..6e21e664e705 100644 --- a/llvm/test/MC/RISCV/fixups-compressed.s +++ b/llvm/test/MC/RISCV/fixups-compressed.s @@ -1,21 +1,15 @@ -# RUN: llvm-mc %s -triple riscv32 -mattr=+c -show-encoding \ -# RUN: | FileCheck -check-prefix=CHECK-FIXUP %s # RUN: llvm-mc -triple riscv32 -filetype=obj -mattr=+c < %s \ # RUN: | llvm-objdump -d -M no-aliases - | FileCheck --check-prefix=CHECK-INSTR %s # RUN: llvm-mc -filetype=obj -mattr=+c -triple=riscv32 %s \ # RUN: | llvm-readobj -r - | FileCheck %s -check-prefix=CHECK-REL .LBB0_2: -# CHECK-FIXUP: fixup A - offset: 0, value: .LBB0_2, kind: fixup_riscv_rvc_jump # CHECK-INSTR: c.j 0 c.j .LBB0_2 -# CHECK: fixup A - offset: 0, value: func1, kind: fixup_riscv_rvc_jump # CHECK-INSTR: c.jal 0x8 c.jal func1 -# CHECK-FIXUP: fixup A - offset: 0, value: .LBB0_2, kind: fixup_riscv_rvc_branch # CHECK-INSTR: c.beqz a3, 0x0 c.beqz a3, .LBB0_2 -# CHECK-FIXUP: fixup A - offset: 0, value: .LBB0_2, kind: fixup_riscv_rvc_branch # CHECK-INSTR: c.bnez a5, 0x0 c.bnez a5, .LBB0_2 diff --git a/llvm/test/MC/RISCV/fixups.s b/llvm/test/MC/RISCV/fixups.s index 5145dbe8db88..9ebf51260912 100644 --- a/llvm/test/MC/RISCV/fixups.s +++ b/llvm/test/MC/RISCV/fixups.s @@ -1,5 +1,3 @@ -# RUN: llvm-mc -triple riscv32 -M no-aliases < %s -show-encoding \ -# RUN: | FileCheck -check-prefix=CHECK-FIXUP %s # RUN: llvm-mc -filetype=obj -triple riscv32 < %s \ # RUN: | llvm-objdump --no-print-imm-hex -M no-aliases -d - \ # RUN: | FileCheck -check-prefix=CHECK-INSTR %s @@ -11,41 +9,30 @@ .LBB0: lui t1, %hi(val) -# CHECK-FIXUP: fixup A - offset: 0, value: %hi(val), kind: fixup_riscv_hi20 # CHECK-INSTR: lui t1, 74565 lw a0, %lo(val)(t1) -# CHECK-FIXUP: fixup A - offset: 0, value: %lo(val), kind: fixup_riscv_lo12_i # CHECK-INSTR: lw a0, 1656(t1) addi a1, t1, %lo(val) -# CHECK-FIXUP: fixup A - offset: 0, value: %lo(val), kind: fixup_riscv_lo12_i # CHECK-INSTR: addi a1, t1, 1656 sw a0, %lo(val)(t1) -# CHECK-FIXUP: fixup A - offset: 0, value: %lo(val), kind: fixup_riscv_lo12_s # CHECK-INSTR: sw a0, 1656(t1) 1: auipc t1, %pcrel_hi(.LBB0) -# CHECK-FIXUP: fixup A - offset: 0, value: %pcrel_hi(.LBB0), kind: fixup_riscv_pcrel_hi20 # CHECK-INSTR: auipc t1, 0 addi t1, t1, %pcrel_lo(1b) -# CHECK-FIXUP: fixup A - offset: 0, value: %pcrel_lo(.Ltmp0), kind: fixup_riscv_pcrel_lo12_i # CHECK-INSTR: addi t1, t1, -16 sw t1, %pcrel_lo(1b)(t1) -# CHECK-FIXUP: fixup A - offset: 0, value: %pcrel_lo(.Ltmp0), kind: fixup_riscv_pcrel_lo12_s # CHECK-INSTR: sw t1, -16(t1) jal zero, .LBB0 -# CHECK-FIXUP: fixup A - offset: 0, value: .LBB0, kind: fixup_riscv_jal # CHECK-INSTR: jal zero, 0x0 jal zero, .LBB2 -# CHECK-FIXUP: fixup A - offset: 0, value: .LBB2, kind: fixup_riscv_jal # CHECK-INSTR: jal zero, 0x50d14 beq a0, a1, .LBB0 -# CHECK-FIXUP: fixup A - offset: 0, value: .LBB0, kind: fixup_riscv_branch # CHECK-INSTR: beq a0, a1, 0x0 blt a0, a1, .LBB1 -# CHECK-FIXUP: fixup A - offset: 0, value: .LBB1, kind: fixup_riscv_branch # CHECK-INSTR: blt a0, a1, 0x47c .fill 1104 @@ -66,18 +53,15 @@ addi zero, zero, 0 func: .fill 100 call func -# CHECK-FIXUP: fixup A - offset: 0, value: func, kind: fixup_riscv_call # CHECK-INSTR: auipc ra, 0 # CHECK-INSTR: jalr ra, -100(ra) .fill 10000 call func -# CHECK-FIXUP: fixup A - offset: 0, value: func, kind: fixup_riscv_call # CHECK-INSTR: auipc ra, 1048574 # CHECK-INSTR: jalr ra, -1916(ra) .fill 20888 call func -# CHECK-FIXUP: fixup A - offset: 0, value: func, kind: fixup_riscv_call # CHECK-INSTR: auipc ra, 1048568 # CHECK-INSTR: jalr ra, 1764(ra) diff --git a/llvm/test/MC/RISCV/xqcibi-relocations.s b/llvm/test/MC/RISCV/xqcibi-relocations.s index 7028e8a737c8..054a890a4b5e 100644 --- a/llvm/test/MC/RISCV/xqcibi-relocations.s +++ b/llvm/test/MC/RISCV/xqcibi-relocations.s @@ -1,11 +1,10 @@ # RUN: llvm-mc -triple riscv32 -mattr=+experimental-xqcibi %s -show-encoding \ -# RUN: | FileCheck -check-prefix=INSTR -check-prefix=FIXUP %s +# RUN: | FileCheck -check-prefix=INSTR %s # RUN: llvm-mc -filetype=obj -triple riscv32 -mattr=+experimental-xqcibi %s -o %t.o # RUN: llvm-readobj -r %t.o | FileCheck -check-prefix=RELOC %s # Check prefixes: # RELOC - Check the relocation in the object. -# FIXUP - Check the fixup on the instruction. # INSTR - Check the instruction is handled properly by the ASMPrinter. .text @@ -14,25 +13,21 @@ qc.bnei x6, 10, foo # RELOC: R_RISCV_JAL foo 0x0 # INSTR: qc.bnei t1, 10, foo -# FIXUP: fixup A - offset: 0, value: foo, kind: fixup_riscv_branch # Since foo is undefined, this will be relaxed to (qc.e.bltui + jal) qc.e.bgeui x8, 12, foo # RELOC: R_RISCV_JAL foo 0x0 # INSTR: qc.e.bgeui s0, 12, foo -# FIXUP: fixup A - offset: 0, value: foo, kind: fixup_riscv_qc_e_branch # Check that a label in a different section is handled similar to an undefined # symbol and gets relaxed to (qc.e.bgeui + jal) qc.e.bltui x4, 9, .bar # RELOC: R_RISCV_JAL .bar 0x0 # INSTR: qc.e.bltui tp, 9, .bar -# FIXUP: fixup A - offset: 0, value: .bar, kind: fixup_riscv_qc_e_branch # Check that branches to a defined symbol are handled correctly qc.e.beqi x7, 8, .L1 # INSTR: qc.e.beqi t2, 8, .L1 -# FIXUP: fixup A - offset: 0, value: .L1, kind: fixup_riscv_qc_e_branch .L1: ret