From d0a1734fb6cbb44caf928ca05b40ee19f880f9de Mon Sep 17 00:00:00 2001 From: Jesse Huang Date: Sun, 22 Sep 2024 13:05:25 +0800 Subject: [PATCH] !fixup update test --- llvm/test/CodeGen/RISCV/calls.ll | 353 ++++++++++--------------------- 1 file changed, 115 insertions(+), 238 deletions(-) diff --git a/llvm/test/CodeGen/RISCV/calls.ll b/llvm/test/CodeGen/RISCV/calls.ll index 48dfe453664a90..f18bbb4ed84ee3 100644 --- a/llvm/test/CodeGen/RISCV/calls.ll +++ b/llvm/test/CodeGen/RISCV/calls.ll @@ -17,23 +17,14 @@ declare i32 @external_function(i32) define i32 @test_call_external(i32 %a) nounwind { -; RV32I-LABEL: test_call_external: -; RV32I: # %bb.0: -; RV32I-NEXT: addi sp, sp, -16 -; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-NEXT: call external_function -; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-NEXT: addi sp, sp, 16 -; RV32I-NEXT: ret -; -; RV32I-PIC-LABEL: test_call_external: -; RV32I-PIC: # %bb.0: -; RV32I-PIC-NEXT: addi sp, sp, -16 -; RV32I-PIC-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-PIC-NEXT: call external_function -; RV32I-PIC-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-PIC-NEXT: addi sp, sp, 16 -; RV32I-PIC-NEXT: ret +; CHECK-LABEL: test_call_external: +; CHECK: # %bb.0: +; CHECK-NEXT: addi sp, sp, -16 +; CHECK-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; CHECK-NEXT: call external_function +; CHECK-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; CHECK-NEXT: addi sp, sp, 16 +; CHECK-NEXT: ret ; ; RV64I-LABEL: test_call_external: ; RV64I: # %bb.0: @@ -93,23 +84,14 @@ define i32 @test_call_external(i32 %a) nounwind { declare dso_local i32 @dso_local_function(i32) define i32 @test_call_dso_local(i32 %a) nounwind { -; RV32I-LABEL: test_call_dso_local: -; RV32I: # %bb.0: -; RV32I-NEXT: addi sp, sp, -16 -; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-NEXT: call dso_local_function -; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-NEXT: addi sp, sp, 16 -; RV32I-NEXT: ret -; -; RV32I-PIC-LABEL: test_call_dso_local: -; RV32I-PIC: # %bb.0: -; RV32I-PIC-NEXT: addi sp, sp, -16 -; RV32I-PIC-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-PIC-NEXT: call dso_local_function -; RV32I-PIC-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-PIC-NEXT: addi sp, sp, 16 -; RV32I-PIC-NEXT: ret +; CHECK-LABEL: test_call_dso_local: +; CHECK: # %bb.0: +; CHECK-NEXT: addi sp, sp, -16 +; CHECK-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; CHECK-NEXT: call dso_local_function +; CHECK-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; CHECK-NEXT: addi sp, sp, 16 +; CHECK-NEXT: ret ; ; RV64I-LABEL: test_call_dso_local: ; RV64I: # %bb.0: @@ -167,15 +149,10 @@ define i32 @test_call_dso_local(i32 %a) nounwind { } define i32 @defined_function(i32 %a) nounwind { -; RV32I-LABEL: defined_function: -; RV32I: # %bb.0: -; RV32I-NEXT: addi a0, a0, 1 -; RV32I-NEXT: ret -; -; RV32I-PIC-LABEL: defined_function: -; RV32I-PIC: # %bb.0: -; RV32I-PIC-NEXT: addi a0, a0, 1 -; RV32I-PIC-NEXT: ret +; CHECK-LABEL: defined_function: +; CHECK: # %bb.0: +; CHECK-NEXT: addi a0, a0, 1 +; CHECK-NEXT: ret ; ; RV64I-LABEL: defined_function: ; RV64I: # %bb.0: @@ -207,23 +184,14 @@ define i32 @defined_function(i32 %a) nounwind { } define i32 @test_call_defined(i32 %a) nounwind { -; RV32I-LABEL: test_call_defined: -; RV32I: # %bb.0: -; RV32I-NEXT: addi sp, sp, -16 -; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-NEXT: call defined_function -; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-NEXT: addi sp, sp, 16 -; RV32I-NEXT: ret -; -; RV32I-PIC-LABEL: test_call_defined: -; RV32I-PIC: # %bb.0: -; RV32I-PIC-NEXT: addi sp, sp, -16 -; RV32I-PIC-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-PIC-NEXT: call defined_function -; RV32I-PIC-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-PIC-NEXT: addi sp, sp, 16 -; RV32I-PIC-NEXT: ret +; CHECK-LABEL: test_call_defined: +; CHECK: # %bb.0: +; CHECK-NEXT: addi sp, sp, -16 +; CHECK-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; CHECK-NEXT: call defined_function +; CHECK-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; CHECK-NEXT: addi sp, sp, 16 +; CHECK-NEXT: ret ; ; RV64I-LABEL: test_call_defined: ; RV64I: # %bb.0: @@ -281,27 +249,16 @@ define i32 @test_call_defined(i32 %a) nounwind { } define i32 @test_call_indirect(ptr %a, i32 %b) nounwind { -; RV32I-LABEL: test_call_indirect: -; RV32I: # %bb.0: -; RV32I-NEXT: addi sp, sp, -16 -; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-NEXT: mv a2, a0 -; RV32I-NEXT: mv a0, a1 -; RV32I-NEXT: jalr a2 -; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-NEXT: addi sp, sp, 16 -; RV32I-NEXT: ret -; -; RV32I-PIC-LABEL: test_call_indirect: -; RV32I-PIC: # %bb.0: -; RV32I-PIC-NEXT: addi sp, sp, -16 -; RV32I-PIC-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-PIC-NEXT: mv a2, a0 -; RV32I-PIC-NEXT: mv a0, a1 -; RV32I-PIC-NEXT: jalr a2 -; RV32I-PIC-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-PIC-NEXT: addi sp, sp, 16 -; RV32I-PIC-NEXT: ret +; CHECK-LABEL: test_call_indirect: +; CHECK: # %bb.0: +; CHECK-NEXT: addi sp, sp, -16 +; CHECK-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; CHECK-NEXT: mv a2, a0 +; CHECK-NEXT: mv a0, a1 +; CHECK-NEXT: jalr a2 +; CHECK-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; CHECK-NEXT: addi sp, sp, 16 +; CHECK-NEXT: ret ; ; RV64I-LABEL: test_call_indirect: ; RV64I: # %bb.0: @@ -365,39 +322,22 @@ define i32 @test_call_indirect(ptr %a, i32 %b) nounwind { ; Make sure we don't use t0 as the source for jalr as that is a hint to pop the ; return address stack on some microarchitectures. define i32 @test_call_indirect_no_t0(ptr %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f, i32 %g, i32 %h) nounwind { -; RV32I-LABEL: test_call_indirect_no_t0: -; RV32I: # %bb.0: -; RV32I-NEXT: addi sp, sp, -16 -; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-NEXT: mv t1, a0 -; RV32I-NEXT: mv a0, a1 -; RV32I-NEXT: mv a1, a2 -; RV32I-NEXT: mv a2, a3 -; RV32I-NEXT: mv a3, a4 -; RV32I-NEXT: mv a4, a5 -; RV32I-NEXT: mv a5, a6 -; RV32I-NEXT: mv a6, a7 -; RV32I-NEXT: jalr t1 -; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-NEXT: addi sp, sp, 16 -; RV32I-NEXT: ret -; -; RV32I-PIC-LABEL: test_call_indirect_no_t0: -; RV32I-PIC: # %bb.0: -; RV32I-PIC-NEXT: addi sp, sp, -16 -; RV32I-PIC-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-PIC-NEXT: mv t1, a0 -; RV32I-PIC-NEXT: mv a0, a1 -; RV32I-PIC-NEXT: mv a1, a2 -; RV32I-PIC-NEXT: mv a2, a3 -; RV32I-PIC-NEXT: mv a3, a4 -; RV32I-PIC-NEXT: mv a4, a5 -; RV32I-PIC-NEXT: mv a5, a6 -; RV32I-PIC-NEXT: mv a6, a7 -; RV32I-PIC-NEXT: jalr t1 -; RV32I-PIC-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-PIC-NEXT: addi sp, sp, 16 -; RV32I-PIC-NEXT: ret +; CHECK-LABEL: test_call_indirect_no_t0: +; CHECK: # %bb.0: +; CHECK-NEXT: addi sp, sp, -16 +; CHECK-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; CHECK-NEXT: mv t1, a0 +; CHECK-NEXT: mv a0, a1 +; CHECK-NEXT: mv a1, a2 +; CHECK-NEXT: mv a2, a3 +; CHECK-NEXT: mv a3, a4 +; CHECK-NEXT: mv a4, a5 +; CHECK-NEXT: mv a5, a6 +; CHECK-NEXT: mv a6, a7 +; CHECK-NEXT: jalr t1 +; CHECK-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; CHECK-NEXT: addi sp, sp, 16 +; CHECK-NEXT: ret ; ; RV64I-LABEL: test_call_indirect_no_t0: ; RV64I: # %bb.0: @@ -492,15 +432,10 @@ define i32 @test_call_indirect_no_t0(ptr %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 ; introduced when compiling with optimisation. define fastcc i32 @fastcc_function(i32 %a, i32 %b) nounwind { -; RV32I-LABEL: fastcc_function: -; RV32I: # %bb.0: -; RV32I-NEXT: add a0, a0, a1 -; RV32I-NEXT: ret -; -; RV32I-PIC-LABEL: fastcc_function: -; RV32I-PIC: # %bb.0: -; RV32I-PIC-NEXT: add a0, a0, a1 -; RV32I-PIC-NEXT: ret +; CHECK-LABEL: fastcc_function: +; CHECK: # %bb.0: +; CHECK-NEXT: add a0, a0, a1 +; CHECK-NEXT: ret ; ; RV64I-LABEL: fastcc_function: ; RV64I: # %bb.0: @@ -532,31 +467,18 @@ define fastcc i32 @fastcc_function(i32 %a, i32 %b) nounwind { } define i32 @test_call_fastcc(i32 %a, i32 %b) nounwind { -; RV32I-LABEL: test_call_fastcc: -; RV32I: # %bb.0: -; RV32I-NEXT: addi sp, sp, -16 -; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-NEXT: sw s0, 8(sp) # 4-byte Folded Spill -; RV32I-NEXT: mv s0, a0 -; RV32I-NEXT: call fastcc_function -; RV32I-NEXT: mv a0, s0 -; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-NEXT: lw s0, 8(sp) # 4-byte Folded Reload -; RV32I-NEXT: addi sp, sp, 16 -; RV32I-NEXT: ret -; -; RV32I-PIC-LABEL: test_call_fastcc: -; RV32I-PIC: # %bb.0: -; RV32I-PIC-NEXT: addi sp, sp, -16 -; RV32I-PIC-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-PIC-NEXT: sw s0, 8(sp) # 4-byte Folded Spill -; RV32I-PIC-NEXT: mv s0, a0 -; RV32I-PIC-NEXT: call fastcc_function -; RV32I-PIC-NEXT: mv a0, s0 -; RV32I-PIC-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-PIC-NEXT: lw s0, 8(sp) # 4-byte Folded Reload -; RV32I-PIC-NEXT: addi sp, sp, 16 -; RV32I-PIC-NEXT: ret +; CHECK-LABEL: test_call_fastcc: +; CHECK: # %bb.0: +; CHECK-NEXT: addi sp, sp, -16 +; CHECK-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; CHECK-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; CHECK-NEXT: mv s0, a0 +; CHECK-NEXT: call fastcc_function +; CHECK-NEXT: mv a0, s0 +; CHECK-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; CHECK-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; CHECK-NEXT: addi sp, sp, 16 +; CHECK-NEXT: ret ; ; RV64I-LABEL: test_call_fastcc: ; RV64I: # %bb.0: @@ -638,49 +560,27 @@ define i32 @test_call_fastcc(i32 %a, i32 %b) nounwind { declare i32 @external_many_args(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) nounwind define i32 @test_call_external_many_args(i32 %a) nounwind { -; RV32I-LABEL: test_call_external_many_args: -; RV32I: # %bb.0: -; RV32I-NEXT: addi sp, sp, -16 -; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-NEXT: sw s0, 8(sp) # 4-byte Folded Spill -; RV32I-NEXT: mv s0, a0 -; RV32I-NEXT: sw a0, 4(sp) -; RV32I-NEXT: sw a0, 0(sp) -; RV32I-NEXT: mv a1, a0 -; RV32I-NEXT: mv a2, a0 -; RV32I-NEXT: mv a3, a0 -; RV32I-NEXT: mv a4, a0 -; RV32I-NEXT: mv a5, a0 -; RV32I-NEXT: mv a6, a0 -; RV32I-NEXT: mv a7, a0 -; RV32I-NEXT: call external_many_args -; RV32I-NEXT: mv a0, s0 -; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-NEXT: lw s0, 8(sp) # 4-byte Folded Reload -; RV32I-NEXT: addi sp, sp, 16 -; RV32I-NEXT: ret -; -; RV32I-PIC-LABEL: test_call_external_many_args: -; RV32I-PIC: # %bb.0: -; RV32I-PIC-NEXT: addi sp, sp, -16 -; RV32I-PIC-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-PIC-NEXT: sw s0, 8(sp) # 4-byte Folded Spill -; RV32I-PIC-NEXT: mv s0, a0 -; RV32I-PIC-NEXT: sw a0, 4(sp) -; RV32I-PIC-NEXT: sw a0, 0(sp) -; RV32I-PIC-NEXT: mv a1, a0 -; RV32I-PIC-NEXT: mv a2, a0 -; RV32I-PIC-NEXT: mv a3, a0 -; RV32I-PIC-NEXT: mv a4, a0 -; RV32I-PIC-NEXT: mv a5, a0 -; RV32I-PIC-NEXT: mv a6, a0 -; RV32I-PIC-NEXT: mv a7, a0 -; RV32I-PIC-NEXT: call external_many_args -; RV32I-PIC-NEXT: mv a0, s0 -; RV32I-PIC-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-PIC-NEXT: lw s0, 8(sp) # 4-byte Folded Reload -; RV32I-PIC-NEXT: addi sp, sp, 16 -; RV32I-PIC-NEXT: ret +; CHECK-LABEL: test_call_external_many_args: +; CHECK: # %bb.0: +; CHECK-NEXT: addi sp, sp, -16 +; CHECK-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; CHECK-NEXT: sw s0, 8(sp) # 4-byte Folded Spill +; CHECK-NEXT: mv s0, a0 +; CHECK-NEXT: sw a0, 4(sp) +; CHECK-NEXT: sw a0, 0(sp) +; CHECK-NEXT: mv a1, a0 +; CHECK-NEXT: mv a2, a0 +; CHECK-NEXT: mv a3, a0 +; CHECK-NEXT: mv a4, a0 +; CHECK-NEXT: mv a5, a0 +; CHECK-NEXT: mv a6, a0 +; CHECK-NEXT: mv a7, a0 +; CHECK-NEXT: call external_many_args +; CHECK-NEXT: mv a0, s0 +; CHECK-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; CHECK-NEXT: lw s0, 8(sp) # 4-byte Folded Reload +; CHECK-NEXT: addi sp, sp, 16 +; CHECK-NEXT: ret ; ; RV64I-LABEL: test_call_external_many_args: ; RV64I: # %bb.0: @@ -806,17 +706,11 @@ define i32 @test_call_external_many_args(i32 %a) nounwind { } define i32 @defined_many_args(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 %j) nounwind { -; RV32I-LABEL: defined_many_args: -; RV32I: # %bb.0: -; RV32I-NEXT: lw a0, 4(sp) -; RV32I-NEXT: addi a0, a0, 1 -; RV32I-NEXT: ret -; -; RV32I-PIC-LABEL: defined_many_args: -; RV32I-PIC: # %bb.0: -; RV32I-PIC-NEXT: lw a0, 4(sp) -; RV32I-PIC-NEXT: addi a0, a0, 1 -; RV32I-PIC-NEXT: ret +; CHECK-LABEL: defined_many_args: +; CHECK: # %bb.0: +; CHECK-NEXT: lw a0, 4(sp) +; CHECK-NEXT: addi a0, a0, 1 +; CHECK-NEXT: ret ; ; RV64I-LABEL: defined_many_args: ; RV64I: # %bb.0: @@ -853,41 +747,23 @@ define i32 @defined_many_args(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 % } define i32 @test_call_defined_many_args(i32 %a) nounwind { -; RV32I-LABEL: test_call_defined_many_args: -; RV32I: # %bb.0: -; RV32I-NEXT: addi sp, sp, -16 -; RV32I-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-NEXT: sw a0, 4(sp) -; RV32I-NEXT: sw a0, 0(sp) -; RV32I-NEXT: mv a1, a0 -; RV32I-NEXT: mv a2, a0 -; RV32I-NEXT: mv a3, a0 -; RV32I-NEXT: mv a4, a0 -; RV32I-NEXT: mv a5, a0 -; RV32I-NEXT: mv a6, a0 -; RV32I-NEXT: mv a7, a0 -; RV32I-NEXT: call defined_many_args -; RV32I-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-NEXT: addi sp, sp, 16 -; RV32I-NEXT: ret -; -; RV32I-PIC-LABEL: test_call_defined_many_args: -; RV32I-PIC: # %bb.0: -; RV32I-PIC-NEXT: addi sp, sp, -16 -; RV32I-PIC-NEXT: sw ra, 12(sp) # 4-byte Folded Spill -; RV32I-PIC-NEXT: sw a0, 4(sp) -; RV32I-PIC-NEXT: sw a0, 0(sp) -; RV32I-PIC-NEXT: mv a1, a0 -; RV32I-PIC-NEXT: mv a2, a0 -; RV32I-PIC-NEXT: mv a3, a0 -; RV32I-PIC-NEXT: mv a4, a0 -; RV32I-PIC-NEXT: mv a5, a0 -; RV32I-PIC-NEXT: mv a6, a0 -; RV32I-PIC-NEXT: mv a7, a0 -; RV32I-PIC-NEXT: call defined_many_args -; RV32I-PIC-NEXT: lw ra, 12(sp) # 4-byte Folded Reload -; RV32I-PIC-NEXT: addi sp, sp, 16 -; RV32I-PIC-NEXT: ret +; CHECK-LABEL: test_call_defined_many_args: +; CHECK: # %bb.0: +; CHECK-NEXT: addi sp, sp, -16 +; CHECK-NEXT: sw ra, 12(sp) # 4-byte Folded Spill +; CHECK-NEXT: sw a0, 4(sp) +; CHECK-NEXT: sw a0, 0(sp) +; CHECK-NEXT: mv a1, a0 +; CHECK-NEXT: mv a2, a0 +; CHECK-NEXT: mv a3, a0 +; CHECK-NEXT: mv a4, a0 +; CHECK-NEXT: mv a5, a0 +; CHECK-NEXT: mv a6, a0 +; CHECK-NEXT: mv a7, a0 +; CHECK-NEXT: call defined_many_args +; CHECK-NEXT: lw ra, 12(sp) # 4-byte Folded Reload +; CHECK-NEXT: addi sp, sp, 16 +; CHECK-NEXT: ret ; ; RV64I-LABEL: test_call_defined_many_args: ; RV64I: # %bb.0: @@ -990,4 +866,5 @@ define i32 @test_call_defined_many_args(i32 %a) nounwind { ret i32 %1 } ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: -; CHECK: {{.*}} +; RV32I: {{.*}} +; RV32I-PIC: {{.*}}