[llvm] [GlobalISel] Remove `fp_to_[s/u]int_sat_gi` node (PR #202908)

David Green via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 10 05:02:08 PDT 2026


================
@@ -954,6 +954,25 @@ Expected<InstructionMatcher &> GlobalISelEmitter::createAndImportSelDAGMatcher(
       }
     }
 
+    // The SDAG fp_to_[su]int_sat nodes carry a trailing ValueType operand
+    // encoding the saturation width. G_FPTOSI_SAT/G_FPTOUI_SAT instead saturate
+    // to their result type and have no such operand, so drop the trailing child
+    // before matching the operands.
----------------
davemgreen wrote:

That isn't a problem for global isel (It is worth remembering that it does already work). You can add clamps as the node is widened if needed, all controlled from legalization. If the node result type is illegal it will need separate clamps anyway, and if the saturation width is legal that type would be legal.

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


More information about the llvm-commits mailing list