[llvm] [LLVM][CodeGen][SVE] Use unpredicated instructions when there's no strictfp requirement. (PR #88166)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 9 11:07:11 PDT 2024


================
@@ -213,14 +213,31 @@ def AArch64fadd_p_contract : PatFrag<(ops node:$op1, node:$op2, node:$op3),
                                      (AArch64fadd_p node:$op1, node:$op2, node:$op3), [{
   return N->getFlags().hasAllowContract();
 }]>;
+def AArch64fadd_p_nostrictfp : PatFrag<(ops node:$op1, node:$op2, node:$op3),
+                                       (AArch64fadd_p node:$op1, node:$op2, node:$op3), [{
+    // We're allowed to introduce new trapping behaviour.
+    return !MF->getFunction().getAttributes().hasFnAttr(llvm::Attribute::StrictFP);
+}]>;
 def AArch64fadd_p_nsz : PatFrag<(ops node:$op1, node:$op2, node:$op3),
                                 (AArch64fadd_p node:$op1, node:$op2, node:$op3), [{
   return N->getFlags().hasNoSignedZeros();
 }]>;
+
+def AArch64fmul_p_nostrictfp : PatFrag<(ops node:$op1, node:$op2, node:$op3),
+                                       (AArch64fmul_p node:$op1, node:$op2, node:$op3), [{
+    // We're allowed to introduce new trapping behaviour.
+    return !MF->getFunction().getAttributes().hasFnAttr(llvm::Attribute::StrictFP);
----------------
efriedma-quic wrote:

Instead of checking the function attributes like this, you probably want to add new nodes AArch64ISD::STRICT_FADD_PRED etc. for lowering ISD::STRICT_FADD etc.  You need a different node to handle the chain correctly anyway, I think.

(At the IR level, the intrinsics don't really interact correctly with strictfp because they're all marked IntrNoMem, but that's sort of separate.)

https://github.com/llvm/llvm-project/pull/88166


More information about the llvm-commits mailing list