diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoF.td b/llvm/lib/Target/RISCV/RISCVInstrInfoF.td index 24a72f480f7885..7e5f96edcdbda0 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoF.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoF.td @@ -799,8 +799,8 @@ def : Pat<(i64 (any_lrint FPR32INX:$rs1)), (FCVT_L_S_INX $rs1, FRM_DYN)>; def : Pat<(i64 (any_llrint FPR32INX:$rs1)), (FCVT_L_S_INX $rs1, FRM_DYN)>; // float->int64 rounded to neartest with ties rounded away from zero. -def : Pat<(i64 (any_lround FPR32INX:$rs1)), (FCVT_L_S_INX $rs1, FRM_DYN)>; -def : Pat<(i64 (any_llround FPR32INX:$rs1)), (FCVT_L_S_INX $rs1, FRM_DYN)>; +def : Pat<(i64 (any_lround FPR32INX:$rs1)), (FCVT_L_S_INX $rs1, FRM_RMM)>; +def : Pat<(i64 (any_llround FPR32INX:$rs1)), (FCVT_L_S_INX $rs1, FRM_RMM)>; // [u]int->fp. Match GCC and default to using dynamic rounding mode. def : Pat<(any_sint_to_fp (i64 (sexti32 (i64 GPR:$rs1)))), (FCVT_S_W_INX $rs1, FRM_DYN)>; diff --git a/llvm/test/CodeGen/RISCV/float-intrinsics-strict.ll b/llvm/test/CodeGen/RISCV/float-intrinsics-strict.ll index e4be5074cb800a..cbd84634de11c0 100644 --- a/llvm/test/CodeGen/RISCV/float-intrinsics-strict.ll +++ b/llvm/test/CodeGen/RISCV/float-intrinsics-strict.ll @@ -1473,7 +1473,7 @@ define iXLen @lround_f32(float %a) nounwind strictfp { ; ; RV64IZFINX-LABEL: lround_f32: ; RV64IZFINX: # %bb.0: -; RV64IZFINX-NEXT: fcvt.l.s a0, a0 +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rmm ; RV64IZFINX-NEXT: ret ; ; RV32I-LABEL: lround_f32: @@ -1577,7 +1577,7 @@ define i64 @llround_f32(float %a) nounwind strictfp { ; ; RV64IZFINX-LABEL: llround_f32: ; RV64IZFINX: # %bb.0: -; RV64IZFINX-NEXT: fcvt.l.s a0, a0 +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rmm ; RV64IZFINX-NEXT: ret ; ; RV32I-LABEL: llround_f32: diff --git a/llvm/test/CodeGen/RISCV/float-intrinsics.ll b/llvm/test/CodeGen/RISCV/float-intrinsics.ll index 918791423a3aab..9f1578ce158f95 100644 --- a/llvm/test/CodeGen/RISCV/float-intrinsics.ll +++ b/llvm/test/CodeGen/RISCV/float-intrinsics.ll @@ -1445,7 +1445,7 @@ define iXLen @lround_f32(float %a) nounwind { ; ; RV64IZFINX-LABEL: lround_f32: ; RV64IZFINX: # %bb.0: -; RV64IZFINX-NEXT: fcvt.l.s a0, a0 +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rmm ; RV64IZFINX-NEXT: ret ; ; RV32I-LABEL: lround_f32: @@ -1593,7 +1593,7 @@ define i64 @llround_f32(float %a) nounwind { ; ; RV64IZFINX-LABEL: llround_f32: ; RV64IZFINX: # %bb.0: -; RV64IZFINX-NEXT: fcvt.l.s a0, a0 +; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rmm ; RV64IZFINX-NEXT: ret ; ; RV32I-LABEL: llround_f32: