Skip to content

Commit a0b9356

Browse files
author
Yeting Kuo
committed
[RISCV] Remove x7 from fastcc list.
Like #93321, this patch also tries to solve the conflict usage of x7 for fastcc and Zicfilp. But this patch removes x7 from fastcc directly. Its purpose is to reduce the code complexity of #93321, and we also found that it at most increase 0.02% instruction count for most benchmarks and it might be benefit to overall benchmarks.
1 parent 34033dc commit a0b9356

File tree

5 files changed

+679
-651
lines changed

5 files changed

+679
-651
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18696,13 +18696,12 @@ static ArrayRef<MCPhysReg> getFastCCArgGPRs(const RISCVABI::ABI ABI) {
1869618696
// for save-restore libcall, so we don't use them.
1869718697
static const MCPhysReg FastCCIGPRs[] = {
1869818698
RISCV::X10, RISCV::X11, RISCV::X12, RISCV::X13, RISCV::X14,
18699-
RISCV::X15, RISCV::X16, RISCV::X17, RISCV::X7, RISCV::X28,
18700-
RISCV::X29, RISCV::X30, RISCV::X31};
18699+
RISCV::X15, RISCV::X16, RISCV::X17, RISCV::X28, RISCV::X29,
18700+
RISCV::X30, RISCV::X31};
1870118701

1870218702
// The GPRs used for passing arguments in the FastCC when using ILP32E/ILP64E.
1870318703
static const MCPhysReg FastCCEGPRs[] = {RISCV::X10, RISCV::X11, RISCV::X12,
18704-
RISCV::X13, RISCV::X14, RISCV::X15,
18705-
RISCV::X7};
18704+
RISCV::X13, RISCV::X14, RISCV::X15};
1870618705

1870718706
if (ABI == RISCVABI::ABI_ILP32E || ABI == RISCVABI::ABI_LP64E)
1870818707
return ArrayRef(FastCCEGPRs);

llvm/test/CodeGen/RISCV/fastcc-int.ll

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,17 @@ define i32 @caller(<16 x i32> %A) nounwind {
3232
; RV32-NEXT: lw a5, 20(a0)
3333
; RV32-NEXT: lw a6, 24(a0)
3434
; RV32-NEXT: lw a7, 28(a0)
35-
; RV32-NEXT: lw t2, 32(a0)
36-
; RV32-NEXT: lw t3, 36(a0)
37-
; RV32-NEXT: lw t4, 40(a0)
38-
; RV32-NEXT: lw t5, 44(a0)
39-
; RV32-NEXT: lw t6, 48(a0)
40-
; RV32-NEXT: lw t1, 52(a0)
35+
; RV32-NEXT: lw t3, 32(a0)
36+
; RV32-NEXT: lw t4, 36(a0)
37+
; RV32-NEXT: lw t5, 40(a0)
38+
; RV32-NEXT: lw t6, 44(a0)
39+
; RV32-NEXT: lw t1, 48(a0)
40+
; RV32-NEXT: lw t2, 52(a0)
4141
; RV32-NEXT: lw s0, 56(a0)
4242
; RV32-NEXT: lw a0, 60(a0)
43-
; RV32-NEXT: sw a0, 8(sp)
44-
; RV32-NEXT: sw s0, 4(sp)
43+
; RV32-NEXT: sw a0, 12(sp)
44+
; RV32-NEXT: sw s0, 8(sp)
45+
; RV32-NEXT: sw t2, 4(sp)
4546
; RV32-NEXT: sw t1, 0(sp)
4647
; RV32-NEXT: mv a0, t0
4748
; RV32-NEXT: call callee
@@ -63,16 +64,17 @@ define i32 @caller(<16 x i32> %A) nounwind {
6364
; RV64-NEXT: ld a5, 40(a0)
6465
; RV64-NEXT: ld a6, 48(a0)
6566
; RV64-NEXT: ld a7, 56(a0)
66-
; RV64-NEXT: ld t2, 64(a0)
67-
; RV64-NEXT: ld t3, 72(a0)
68-
; RV64-NEXT: ld t4, 80(a0)
69-
; RV64-NEXT: ld t5, 88(a0)
70-
; RV64-NEXT: ld t6, 96(a0)
71-
; RV64-NEXT: ld t1, 104(a0)
67+
; RV64-NEXT: ld t3, 64(a0)
68+
; RV64-NEXT: ld t4, 72(a0)
69+
; RV64-NEXT: ld t5, 80(a0)
70+
; RV64-NEXT: ld t6, 88(a0)
71+
; RV64-NEXT: ld t1, 96(a0)
72+
; RV64-NEXT: ld t2, 104(a0)
7273
; RV64-NEXT: ld s0, 112(a0)
7374
; RV64-NEXT: ld a0, 120(a0)
74-
; RV64-NEXT: sd a0, 16(sp)
75-
; RV64-NEXT: sd s0, 8(sp)
75+
; RV64-NEXT: sd a0, 24(sp)
76+
; RV64-NEXT: sd s0, 16(sp)
77+
; RV64-NEXT: sd t2, 8(sp)
7678
; RV64-NEXT: sd t1, 0(sp)
7779
; RV64-NEXT: mv a0, t0
7880
; RV64-NEXT: call callee

0 commit comments

Comments
 (0)