[llvm] [aarch64] Fix Arm64EC libcall lowering after recent refactoring. (PR #143977)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 12 18:04:21 PDT 2025


================
@@ -0,0 +1,31 @@
+; RUN: llc -mtriple=arm64ec-pc-windows-msvc < %s | FileCheck %s
+
+define void @f1(ptr %p, i64 %n) {
+; CHECK-LABEL: "#f1":
+; CHECK: bl "#memset"
+  call void @llvm.memset.p0.i64(ptr %p, i8 0, i64 %n, i1 false)
+  ret void
+}
+
+define void @f2(ptr %p1, ptr %p2, i64 %n) {
+; CHECK-LABEL: "#f2":
+; CHECK: bl "#memcpy"
+  call void @llvm.memcpy.p0.i64(ptr %p1, ptr %p2, i64 %n, i1 false)
+  ret void
+}
+
+define double @f3(double %x, double %y) {
+; CHECK-LABEL: "#f3":
+; CHECK: b "#fmod"
+  %r = frem double %x, %y
+  ret double %r
+}
+
+
+define i128 @f4(i128 %x, i128 %y) {
+; CHECK-LABEL: "#f4":
+; CHECK: bl "#__divti3"
+  %r = sdiv i128 %x, %y
+  ret i128 %r
+}
+
----------------
efriedma-quic wrote:

It looks like outlined atomics are broken; I'll add a testcase with the broken behavior.  Not going to try to fix it right now (I'm not sure how to fix it given the way the code is currently structured, and it's not really a useful feature on Windows anyway.)

_alldiv etc. are, as far as I know, only a thing on 32-bit x86.  32-bit Arm has different libcalls, and 64-bit doesn't need libcalls for 64-bit operations.  So I'm not sure sure there's anything to regression test.  But I modified the code because it triggers the assertion otherwise.

llvm.ldexp.f32 correctly calls `#ldexp` (the 64-bit variant); I'll add a test.  llvm.ldexp.f128 crashes for unrelated reasons (#144006).

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


More information about the llvm-commits mailing list