Skip to content

Commit 7ba649a

Browse files
JaydeepChauhan14mahesh-attarde
authored andcommitted
[X86] Set default rounding mode round to nearest for llvm.set.rounding (llvm#160823)
- Fix llvm#156591 (comment) - As per https://cdrdv2.intel.com/v1/dl/getContent/671200 default rounding mode is **round to nearest**.
1 parent 60ec109 commit 7ba649a

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
@@ -910,6 +910,7 @@ bool X86LegalizerInfo::legalizeSETROUNDING(MachineInstr &MI,
910910
int FieldVal = X86::getRoundingModeX86(RM);
911911

912912
if (FieldVal == X86::rmInvalid) {
913+
FieldVal = X86::rmToNearest;
913914
LLVMContext &C = MF.getFunction().getContext();
914915
C.diagnose(DiagnosticInfoUnsupported(
915916
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)