================
@@ -1145,6 +1165,77 @@ CIRGenFunction::emitX86BuiltinExpr(unsigned builtinID, 
const CallExpr *expr) {
     // Return timestamp (element 0 of the returned struct)
     return cir::ExtractMemberOp::create(builder, loc, i64Ty, result, 0);
   }
+  case X86::BI__builtin_ia32_roundps:
+  case X86::BI__builtin_ia32_roundpd:
+  case X86::BI__builtin_ia32_roundps256:
+  case X86::BI__builtin_ia32_roundpd256: {
+    unsigned m =
+        ops[1].getDefiningOp<cir::ConstantOp>().getIntValue().getZExtValue();
+    constexpr unsigned mxcsrMask = 0b100;
+    constexpr unsigned fRoundNoExcMask = 0b1000;
+    unsigned useMXCSR = mxcsrMask & m;
+    unsigned fRoundNoExc = fRoundNoExcMask & m;
+
+    mlir::Location loc = getLoc(expr->getExprLoc());
+
+    if (useMXCSR || !fRoundNoExc) {
----------------
borysperski wrote:

@andykaylor thanks for the detailed analysis, and thanks @phoebewang for the 
additional context. Could you let me know which approach I should take? Happy 
to do the work - just want to make sure I'm heading in the right direction.

https://github.com/llvm/llvm-project/pull/215787
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to