Skip to content

Commit c8ae503

Browse files
committed
[RISCV][VCIX] Add vcix_state to GNU inline assembly register set
Resolved #106700. This enables inline asm to have vcix_state to be a clobbered register thus disable reordering between VCIX intrinsics and inline asm.
1 parent 3212687 commit c8ae503

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

clang/lib/Basic/Targets/RISCV.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ ArrayRef<const char *> RISCVTargetInfo::getGCCRegNames() const {
4444
"v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31",
4545

4646
// CSRs
47-
"fflags", "frm", "vtype", "vl", "vxsat", "vxrm"
47+
"fflags", "frm", "vtype", "vl", "vxsat", "vxrm", "sf_vcix_state"
4848
};
4949
// clang-format on
5050
return llvm::ArrayRef(GCCRegNames);

llvm/lib/Target/RISCV/RISCVRegisterInfo.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,3 +666,7 @@ def SSP : RISCVReg<0, "ssp">;
666666

667667
// Dummy SiFive VCIX state register
668668
def SF_VCIX_STATE : RISCVReg<0, "sf_vcix_state">;
669+
def : RISCVRegisterClass<[XLenVT], 32, (add SF_VCIX_STATE)> {
670+
let RegInfos = XLenRI;
671+
let isAllocatable = 0;
672+
}

llvm/test/CodeGen/RISCV/inline-asm-xsfvcp.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
define void @test_reorder(<vscale x 1 x i64> %vreg) {
99
; CHECK-LABEL: test_reorder:
1010
; CHECK: # %bb.0: # %entry
11+
; CHECK-NEXT: vsetivli zero, 0, e64, m1, ta, ma
12+
; CHECK-NEXT: sf.vc.iv 0, 0, v8, 0
1113
; CHECK-NEXT: #APP
1214
; CHECK-NEXT: sf.vc.vv 3, 0, v8, v8
1315
; CHECK-EMPTY:
1416
; CHECK-NEXT: #NO_APP
15-
; CHECK-NEXT: vsetivli zero, 0, e64, m1, ta, ma
16-
; CHECK-NEXT: sf.vc.iv 0, 0, v8, 0
1717
; CHECK-NEXT: ret
1818
entry:
1919
call void @llvm.riscv.sf.vc.iv.se.iXLen.nxv1i64.iXLen.iXLen(iXLen 0, iXLen 0, <vscale x 1 x i64> %vreg, iXLen 0, iXLen 0)
20-
call iXLen asm sideeffect "sf.vc.vv 0x3, 0x0, $1, $1;", "=r,^vr,~{memory},~{vl},~{vcix_state}"(<vscale x 1 x i64> %vreg)
20+
call iXLen asm sideeffect "sf.vc.vv 0x3, 0x0, $1, $1;", "=r,^vr,~{memory},~{vl},~{sf_vcix_state}"(<vscale x 1 x i64> %vreg)
2121
ret void
2222
}

0 commit comments

Comments
 (0)