[PATCH] D74730: [FPEnv][X86] Implement lowering of llvm.set.rounding

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 1 04:34:29 PST 2021


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:26971-26972
+    case RoundingMode::TowardZero:        FieldVal = X86::rmTowardZero; break;
+    default:
+      llvm_unreachable("rounding mode is not supported by X86 hardware");
+    }
----------------
Is this enforced elsewhere? (verifier, etc)
This doesn't seem like the right way do to error handling to me, we shouldn't crash.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.h:855-856
+    /// Current rounding mode is represented in bits 11:10 of FPSR. These
+    /// values are same as corresponding constants for rounding mode used
+    /// in glibc.
+    enum RoundingMode {
----------------
I suspect this is backwards, and should say that glibc choose to use values compatible with the ones stored in FPSR.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74730/new/

https://reviews.llvm.org/D74730



More information about the llvm-commits mailing list