Skip to content

Commit 9b270fc

Browse files
[X86] Set default rounding mode round to nearest for llvm.set.rounding (#160823)
- Fix #156591 (comment) - As per https://cdrdv2.intel.com/v1/dl/getContent/671200 default rounding mode is **round to nearest**.
1 parent 8c122e5 commit 9b270fc

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,7 @@ bool X86LegalizerInfo::legalizeSETROUNDING(MachineInstr &MI,
905905
int FieldVal = X86::getRoundingModeX86(RM);
906906

907907
if (FieldVal == X86::rmInvalid) {
908+
FieldVal = X86::rmToNearest;
908909
LLVMContext &C = MF.getFunction().getContext();
909910
C.diagnose(DiagnosticInfoUnsupported(
910911
MF.getFunction(), "rounding mode is not supported by X86 hardware",

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28714,11 +28714,11 @@ SDValue X86TargetLowering::LowerSET_ROUNDING(SDValue Op,
2871428714
int FieldVal = X86::getRoundingModeX86(RM);
2871528715

2871628716
if (FieldVal == X86::rmInvalid) {
28717+
FieldVal = X86::rmToNearest;
2871728718
LLVMContext &C = MF.getFunction().getContext();
2871828719
C.diagnose(DiagnosticInfoUnsupported(
2871928720
MF.getFunction(), "rounding mode is not supported by X86 hardware",
2872028721
DiagnosticLocation(DL.getDebugLoc()), DS_Error));
28721-
return {};
2872228722
}
2872328723
RMBits = DAG.getConstant(FieldVal, DL, MVT::i16);
2872428724
} else {

0 commit comments

Comments
 (0)