[Git][ghc/ghc][wip/ncg-simd] X86_64: xmm registers start at 0

sheaf (@sheaf) gitlab at gitlab.haskell.org
Mon Aug 12 17:33:18 UTC 2024



sheaf pushed to branch wip/ncg-simd at Glasgow Haskell Compiler / GHC


Commits:
eeced2b3 by sheaf at 2024-08-12T19:29:51+02:00
X86_64: xmm registers start at 0

The Cmm XmmReg/YmmReg/ZmmReg registers start at 1, but on X86 the vector
machine registers start at 0.
This was accounted for X86_32 in the MachRegs/x86.h file, but not for
X86_64 where REG_XMM1 was incorrectly defiend as xmm1 instead of xmm0.

Fixing this means that one can correctly use "foreign import prim"
with code that expects vector arguments in xmm0, xmm1, etc.

- - - - -


1 changed file:

- rts/include/stg/MachRegs/x86.h


Changes:

=====================================
rts/include/stg/MachRegs/x86.h
=====================================
@@ -112,40 +112,40 @@ combination of up to six Float# or Double# arguments without touching
 the stack. See Note [Overlapping global registers] for implications.
 */
 
-#define REG_F1    xmm1
-#define REG_F2    xmm2
-#define REG_F3    xmm3
-#define REG_F4    xmm4
-#define REG_F5    xmm5
-#define REG_F6    xmm6
-
-#define REG_D1    xmm1
-#define REG_D2    xmm2
-#define REG_D3    xmm3
-#define REG_D4    xmm4
-#define REG_D5    xmm5
-#define REG_D6    xmm6
-
-#define REG_XMM1    xmm1
-#define REG_XMM2    xmm2
-#define REG_XMM3    xmm3
-#define REG_XMM4    xmm4
-#define REG_XMM5    xmm5
-#define REG_XMM6    xmm6
-
-#define REG_YMM1    ymm1
-#define REG_YMM2    ymm2
-#define REG_YMM3    ymm3
-#define REG_YMM4    ymm4
-#define REG_YMM5    ymm5
-#define REG_YMM6    ymm6
-
-#define REG_ZMM1    zmm1
-#define REG_ZMM2    zmm2
-#define REG_ZMM3    zmm3
-#define REG_ZMM4    zmm4
-#define REG_ZMM5    zmm5
-#define REG_ZMM6    zmm6
+#define REG_F1    xmm0
+#define REG_F2    xmm1
+#define REG_F3    xmm2
+#define REG_F4    xmm3
+#define REG_F5    xmm4
+#define REG_F6    xmm5
+
+#define REG_D1    xmm0
+#define REG_D2    xmm1
+#define REG_D3    xmm2
+#define REG_D4    xmm3
+#define REG_D5    xmm4
+#define REG_D6    xmm5
+
+#define REG_XMM1    xmm0
+#define REG_XMM2    xmm1
+#define REG_XMM3    xmm2
+#define REG_XMM4    xmm3
+#define REG_XMM5    xmm4
+#define REG_XMM6    xmm5
+
+#define REG_YMM1    ymm0
+#define REG_YMM2    ymm1
+#define REG_YMM3    ymm2
+#define REG_YMM4    ymm3
+#define REG_YMM5    ymm4
+#define REG_YMM6    ymm5
+
+#define REG_ZMM1    zmm0
+#define REG_ZMM2    zmm1
+#define REG_ZMM3    zmm2
+#define REG_ZMM4    zmm3
+#define REG_ZMM5    zmm4
+#define REG_ZMM6    zmm5
 
 #if !defined(mingw32_HOST_OS)
 #define CALLER_SAVES_R3



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/eeced2b3034530ab3ba293dcacb7f5ad0c8406e2

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/eeced2b3034530ab3ba293dcacb7f5ad0c8406e2
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240812/35878648/attachment-0001.html>


More information about the ghc-commits mailing list