[PATCH] D147685: [compiler-rt] [builtins] Don't use assembly floatundi*f on x86_64 mingw

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 6 01:12:14 PDT 2023


mstorsjo created this revision.
mstorsjo added reviewers: phosek, alvinhochun, vitalybuka.
Herald added subscribers: Enna1, pengfei, dberris.
Herald added a project: All.
mstorsjo requested review of this revision.
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.

The x86 assembly is entirely skipped for MSVC build configurations,
since the assembly uses GAS syntax (which MSVC proper can't
assemble, but clang-cl can). But for mingw configurations, the
assembly is used.

On x86_64 Windows, the general calling convention is entirely different
than on other platforms (passing arguments in different registers),
so we can't use this assembly for mingw targets (unless adapted to
handle that calling convention). Thus skip these few assembly routines
for Windows targets. (For i386, we can keep using the assembly
functions.)

This fixes the builtins tests that test these routines. They aren't
used in practice though, as LLVM expands code inline for doing such
conversions anyway.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147685

Files:
  compiler-rt/lib/builtins/CMakeLists.txt


Index: compiler-rt/lib/builtins/CMakeLists.txt
===================================================================
--- compiler-rt/lib/builtins/CMakeLists.txt
+++ compiler-rt/lib/builtins/CMakeLists.txt
@@ -310,17 +310,27 @@
     ${x86_ARCH_SOURCES}
     x86_64/floatdidf.c
     x86_64/floatdisf.c
-    x86_64/floatundidf.S
-    x86_64/floatundisf.S
   )
+  if (NOT WIN32)
+    set(x86_64_SOURCES
+      ${x86_64_SOURCES}
+      x86_64/floatundidf.S
+      x86_64/floatundisf.S
+    )
+  endif()
 
   if (NOT ANDROID)
     set(x86_64_SOURCES
       ${x86_64_SOURCES}
       ${x86_80_BIT_SOURCES}
       x86_64/floatdixf.c
-      x86_64/floatundixf.S
     )
+    if (NOT WIN32)
+      set(x86_64_SOURCES
+        ${x86_64_SOURCES}
+        x86_64/floatundixf.S
+      )
+    endif()
   endif()
 
   # Darwin x86_64 Haswell


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147685.511317.patch
Type: text/x-patch
Size: 822 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230406/694329ad/attachment.bin>


More information about the llvm-commits mailing list