[llvm-branch-commits] [llvm] [WebAssembly][GlobalISel] Implement saturating floating-point to int (PR #197259)

Matt Arsenault via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu May 14 03:49:17 PDT 2026


================
@@ -15,3 +15,16 @@
 
 include "WebAssembly.td"
 include "WebAssemblyCombine.td"
+
+//===----------------------------------------------------------------------===//
+// Miscallenous patterns
+//===----------------------------------------------------------------------===//
+
+def : Pat<(i32 (fp_to_sint_sat_gi F32:$src)), (I32_TRUNC_S_SAT_F32 F32:$src)>;
----------------
arsenm wrote:

SDTFPToIntOp and SDTFPToIntSatOp are different, SDTFPToIntSatOp carries an additional operand. It looks like the globalisel support was added incorrectly, and just doesn't include the necessary operand. It will require a little bit of a special case in tablegen to encode the type but we have similar cases already for sext_inreg and compares 

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


More information about the llvm-branch-commits mailing list