Skip to content

Commit d749beb

Browse files
authored andcommitted
[RISCV] Add hasPostISelHook to sf.vfnrclip pseudo instructions. (#114274)
Add Uses = [FRM] to the underlying MC instructions. Tweak a couple test cases so the MachineVerifier would have caught this. (cherry picked from commit 408c84f)
1 parent a0dfd3d commit d749beb

File tree

Image for: File tree

3 files changed

Image for: 3 files changed
+5
-8
lines changed

3 files changed

Image for: 3 files changed
+5
-8
lines changed

‎llvm/lib/Target/RISCV/RISCVInstrInfoXSf.td

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ let Predicates = [HasVendorXSfvfwmaccqqq], DecoderNamespace = "XSfvfwmaccqqq" in
217217
def VFWMACC_4x4x4 : CustomSiFiveVMACC<0b111100, OPFVV, "sf.vfwmacc.4x4x4">;
218218
}
219219

220-
let Predicates = [HasVendorXSfvfnrclipxfqf], DecoderNamespace = "XSfvfnrclipxfqf" in {
220+
let Predicates = [HasVendorXSfvfnrclipxfqf], DecoderNamespace = "XSfvfnrclipxfqf",
221+
Uses = [FRM] in {
221222
def VFNRCLIP_XU_F_QF : CustomSiFiveVFNRCLIP<0b100010, OPFVF, "sf.vfnrclip.xu.f.qf">;
222223
def VFNRCLIP_X_F_QF : CustomSiFiveVFNRCLIP<0b100011, OPFVF, "sf.vfnrclip.x.f.qf">;
223224
}
@@ -399,7 +400,7 @@ multiclass VPseudoSiFiveVFWMACC<string Constraint = ""> {
399400

400401
multiclass VPseudoSiFiveVFNRCLIP<string Constraint = "@earlyclobber $rd"> {
401402
foreach i = 0-4 in
402-
let hasSideEffects = 0 in
403+
let hasSideEffects = 0, hasPostISelHook = 1 in
403404
defm "Pseudo" # NAME : VPseudoBinaryRoundingMode<MxListW[i].vrclass,
404405
MxListVF4[i].vrclass,
405406
FPR32, MxListW[i],

‎llvm/test/CodeGen/RISCV/rvv/sf_vfnrclip_x_f_qf.ll

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,16 @@ declare <vscale x 1 x i8> @llvm.riscv.sf.vfnrclip.x.f.qf.nxv1i8.nxv1f32.iXLen(
1313
define <vscale x 1 x i8> @intrinsic_sf_vfnrclip_x_f_qf_nxv1i8_nxv1f32(<vscale x 1 x float> %0, float %1, iXLen %2) nounwind {
1414
; CHECK-LABEL: intrinsic_sf_vfnrclip_x_f_qf_nxv1i8_nxv1f32:
1515
; CHECK: # %bb.0: # %entry
16-
; CHECK-NEXT: fsrmi a1, 0
1716
; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
1817
; CHECK-NEXT: sf.vfnrclip.x.f.qf v9, v8, fa0
19-
; CHECK-NEXT: fsrm a1
2018
; CHECK-NEXT: vmv1r.v v8, v9
2119
; CHECK-NEXT: ret
2220
entry:
2321
%a = call <vscale x 1 x i8> @llvm.riscv.sf.vfnrclip.x.f.qf.nxv1i8.nxv1f32.iXLen(
2422
<vscale x 1 x i8> undef,
2523
<vscale x 1 x float> %0,
2624
float %1,
27-
iXLen 0, iXLen %2)
25+
iXLen 7, iXLen %2)
2826

2927
ret <vscale x 1 x i8> %a
3028
}

‎llvm/test/CodeGen/RISCV/rvv/sf_vfnrclip_xu_f_qf.ll

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,16 @@ declare <vscale x 1 x i8> @llvm.riscv.sf.vfnrclip.xu.f.qf.nxv1i8.nxv1f32.iXLen(
1313
define <vscale x 1 x i8> @intrinsic_sf_vfnrclip_xu_f_qf_nxv1i8_nxv1f32(<vscale x 1 x float> %0, float %1, iXLen %2) nounwind {
1414
; CHECK-LABEL: intrinsic_sf_vfnrclip_xu_f_qf_nxv1i8_nxv1f32:
1515
; CHECK: # %bb.0: # %entry
16-
; CHECK-NEXT: fsrmi a1, 0
1716
; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
1817
; CHECK-NEXT: sf.vfnrclip.xu.f.qf v9, v8, fa0
19-
; CHECK-NEXT: fsrm a1
2018
; CHECK-NEXT: vmv1r.v v8, v9
2119
; CHECK-NEXT: ret
2220
entry:
2321
%a = call <vscale x 1 x i8> @llvm.riscv.sf.vfnrclip.xu.f.qf.nxv1i8.nxv1f32.iXLen(
2422
<vscale x 1 x i8> undef,
2523
<vscale x 1 x float> %0,
2624
float %1,
27-
iXLen 0, iXLen %2)
25+
iXLen 7, iXLen %2)
2826

2927
ret <vscale x 1 x i8> %a
3028
}

0 commit comments

Image for: 0 commit comments
Comments
 (0)