[llvm] [X86][SelectionDAG] - Add support for llvm.canonicalize intrinsic (PR #106370)

Pawan Nirpal via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 29 01:47:56 PDT 2024


================
@@ -1275,6 +1275,56 @@ void SelectionDAGLegalize::LegalizeOp(SDNode *Node) {
       }
     }
     break;
+    case ISD::FCANONICALIZE: {
+      const Triple &TT = DAG.getTarget().getTargetTriple();
+      if (TT.getArch() == Triple::x86 || TT.getArch() == Triple::x86_64) {
----------------
pawan-nirpal-031 wrote:

@arsenm You mean to say, doing subnormal canonicalization in DAG combine would be a better design. I agree, anywhere pre selection sounds fine, The reason I chose legalization phase is due to availability of ```ExpandConstantFP``` API, I haven't looked at combiner code, but If it's not available there, I might have to duplicate the API's functionality, unless there is no way to access this api from combine, should be doable, I reckon.  

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


More information about the llvm-commits mailing list