[llvm] 9b270fc - [X86] Set default rounding mode round to nearest for llvm.set.rounding (#160823)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 26 01:46:36 PDT 2025
Author: JaydeepChauhan14
Date: 2025-09-26T17:46:32+09:00
New Revision: 9b270fcb376ccdef333ae717f37d04d90defd115
URL: https://github.com/llvm/llvm-project/commit/9b270fcb376ccdef333ae717f37d04d90defd115
DIFF: https://github.com/llvm/llvm-project/commit/9b270fcb376ccdef333ae717f37d04d90defd115.diff
LOG: [X86] Set default rounding mode round to nearest for llvm.set.rounding (#160823)
- Fix
https://github.com/llvm/llvm-project/pull/156591#issuecomment-3335218842
- As per https://cdrdv2.intel.com/v1/dl/getContent/671200 default
rounding mode is **round to nearest**.
Added:
Modified:
llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp
llvm/lib/Target/X86/X86ISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp b/llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp
index ee9760f881ae9..143c4c43e611a 100644
--- a/llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp
+++ b/llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp
@@ -905,6 +905,7 @@ bool X86LegalizerInfo::legalizeSETROUNDING(MachineInstr &MI,
int FieldVal = X86::getRoundingModeX86(RM);
if (FieldVal == X86::rmInvalid) {
+ FieldVal = X86::rmToNearest;
LLVMContext &C = MF.getFunction().getContext();
C.diagnose(DiagnosticInfoUnsupported(
MF.getFunction(), "rounding mode is not supported by X86 hardware",
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 80fbcaa562032..57cf66e5275e3 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -28714,11 +28714,11 @@ SDValue X86TargetLowering::LowerSET_ROUNDING(SDValue Op,
int FieldVal = X86::getRoundingModeX86(RM);
if (FieldVal == X86::rmInvalid) {
+ FieldVal = X86::rmToNearest;
LLVMContext &C = MF.getFunction().getContext();
C.diagnose(DiagnosticInfoUnsupported(
MF.getFunction(), "rounding mode is not supported by X86 hardware",
DiagnosticLocation(DL.getDebugLoc()), DS_Error));
- return {};
}
RMBits = DAG.getConstant(FieldVal, DL, MVT::i16);
} else {
More information about the llvm-commits
mailing list