[clang] [llvm] [ARM64EC] Implement `-mlong-double-{64,80,128}` options (PR #237057)
Matt Arsenault via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 5 22:22:30 PST 2026
================
@@ -0,0 +1,129 @@
+; RUN: llc < %s -mtriple=arm64ec-pc-windows-msvc -o - | FileCheck %s
+;
+;; The 80-bit x87 `long double` occupies a 16-byte slot, but the ARM64EC side
+;; passes and returns it as a pair of integer registers holding the 80-bit
+;; image, while the x64 side passes it in memory (by reference) and returns it
+;; through a hidden pointer. The thunks convert between the two, moving only
+;; the ten bytes that make up the value and leaving the padding alone.
+;;
+;; entry thunk: x64 memory slot -> ARM64EC register pair
+;; exit thunk: ARM64EC register pair -> x64 memory slot
+
+target triple = "arm64ec-pc-windows-msvc"
+
+declare x86_fp80 @ext_ret()
+declare void @ext_take(x86_fp80)
+
+; The value is an i128 in an even-aligned register pair, so having a 32-bit
+; argument in x0 puts it in x2:x3, and it is returned in x1:x0.
+define dso_local x86_fp80 @use_f80(i32 %x, x86_fp80 %v) {
+ ret x86_fp80 %v
+}
+
+define dso_local x86_fp80 @pass_f80(x86_fp80 %v) {
+ ret x86_fp80 %v
+}
+
+define dso_local void @take_f80(i32 %x, x86_fp80 %v) {
+ ret void
+}
+
+; With seven integer arguments the pair no longer fits in the argument
+; registers and is passed on the stack, by value on the ARM64EC side and by
+; reference on the x64 side.
+define dso_local void @stack_f80(i64 %a, i64 %b, i64 %c, i64 %d, i64 %e,
----------------
arsenm wrote:
Don't need any of the dso_local
https://github.com/llvm/llvm-project/pull/237057
More information about the cfe-commits
mailing list