[llvm] [X86][GlobalISel] Enable G_LROUND/G_LLROUND with libcall mapping (PR #125096)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 30 21:00:39 PST 2025


================
@@ -99,6 +99,18 @@ X86LegalizerInfo::X86LegalizerInfo(const X86Subtarget &STI,
       .widenScalarToNextPow2(0, /*Min=*/8)
       .clampScalar(0, s8, sMaxScalar);
 
+  getActionDefinitionsBuilder(G_LROUND)
+      .libcallIf([=](const LegalityQuery &Query) -> bool {
+        return (typeInSet(0, {s32, s64})(Query) &&
+                typeInSet(1, {s32, s64, s80})(Query));
+      });
+
+  getActionDefinitionsBuilder(G_LLROUND)
+      .libcallIf([=](const LegalityQuery &Query) -> bool {
+        return (typeIs(0, s64)(Query) &&
+                typeInSet(1, {s32, s64, s80})(Query));
+      });
----------------
arsenm wrote:

You're only doing basic type checks here. Use libcallFor? 

But also, you're not specifying any actions that don't use a libcall. You could just make this an unconditional libcall() 

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


More information about the llvm-commits mailing list