Skip to content

Commit 5f821a2

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 21f4687 commit 5f821a2

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", "vcix_state"
4848
};
4949
// clang-format on
5050
return llvm::ArrayRef(GCCRegNames);

llvm/lib/Target/RISCV/RISCVRegisterInfo.td

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,5 +664,9 @@ def FRM : RISCVReg<0, "frm">;
664664
// Shadow Stack register
665665
def SSP : RISCVReg<0, "ssp">;
666666

667-
// Dummy VCIX state register
667+
// Dummy VCIX state register and its register class
668668
def VCIX_STATE : RISCVReg<0, "vcix_state">;
669+
def : RISCVRegisterClass<[XLenVT], 32, (add VCIX_STATE)> {
670+
let RegInfos = XLenRI;
671+
let isAllocatable = 0;
672+
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
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)

0 commit comments

Comments
 (0)