aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYawning Angel <yawning@schwanenlied.me>2023-12-30 04:49:28 +0900
committerYawning Angel <yawning@schwanenlied.me>2024-01-07 20:04:40 +0900
commit8d7c37e38430fa5d8a40939dec5657e6837c69c6 (patch)
tree56e63efbf901406b1f9d2065e19ba69463665983
parentcd65a15d81b32636c5097200446cc6d6afc7199b (diff)
core/simd/x86: Use the `none` calling convention for intrinsics
The LLVM intrinsics that live under `llvm.x86` are not actual functions, so trying to invoke them as such using the platform's native C calling convention causes incorrect types to be emitted in the IR. Thanks to laytanl for assistance in testing.
-rw-r--r--core/simd/x86/adx.odin2
-rw-r--r--core/simd/x86/fxsr.odin2
-rw-r--r--core/simd/x86/pclmulqdq.odin2
-rw-r--r--core/simd/x86/rdtsc.odin2
-rw-r--r--core/simd/x86/sha.odin2
-rw-r--r--core/simd/x86/sse.odin2
-rw-r--r--core/simd/x86/sse2.odin2
-rw-r--r--core/simd/x86/sse3.odin2
-rw-r--r--core/simd/x86/sse41.odin2
-rw-r--r--core/simd/x86/sse42.odin2
-rw-r--r--core/simd/x86/ssse3.odin2
11 files changed, 11 insertions, 11 deletions
diff --git a/core/simd/x86/adx.odin b/core/simd/x86/adx.odin
index d03cffcff..5750ae627 100644
--- a/core/simd/x86/adx.odin
+++ b/core/simd/x86/adx.odin
@@ -37,7 +37,7 @@ when ODIN_ARCH == .amd64 {
}
}
-@(private, default_calling_convention="c")
+@(private, default_calling_convention="none")
foreign _ {
@(link_name="llvm.x86.addcarry.32")
llvm_addcarry_u32 :: proc(a: u8, b: u32, c: u32) -> (u8, u32) ---
diff --git a/core/simd/x86/fxsr.odin b/core/simd/x86/fxsr.odin
index cd78de7d4..a9213fed2 100644
--- a/core/simd/x86/fxsr.odin
+++ b/core/simd/x86/fxsr.odin
@@ -21,7 +21,7 @@ when ODIN_ARCH == .amd64 {
}
}
-@(private, default_calling_convention="c")
+@(private, default_calling_convention="none")
foreign _ {
@(link_name="llvm.x86.fxsave")
fxsave :: proc(p: rawptr) ---
diff --git a/core/simd/x86/pclmulqdq.odin b/core/simd/x86/pclmulqdq.odin
index 31ba58fe6..e827bf6b9 100644
--- a/core/simd/x86/pclmulqdq.odin
+++ b/core/simd/x86/pclmulqdq.odin
@@ -6,7 +6,7 @@ _mm_clmulepi64_si128 :: #force_inline proc "c" (a, b: __m128i, $IMM8: u8) -> __m
return pclmulqdq(a, b, u8(IMM8))
}
-@(private, default_calling_convention="c")
+@(private, default_calling_convention="none")
foreign _ {
@(link_name="llvm.x86.pclmulqdq")
pclmulqdq :: proc(a, round_key: __m128i, #const imm8: u8) -> __m128i ---
diff --git a/core/simd/x86/rdtsc.odin b/core/simd/x86/rdtsc.odin
index 54024c3f2..8a8b13c4b 100644
--- a/core/simd/x86/rdtsc.odin
+++ b/core/simd/x86/rdtsc.odin
@@ -11,7 +11,7 @@ __rdtscp :: #force_inline proc "c" (aux: ^u32) -> u64 {
return rdtscp(aux)
}
-@(private, default_calling_convention="c")
+@(private, default_calling_convention="none")
foreign _ {
@(link_name="llvm.x86.rdtsc")
rdtsc :: proc() -> u64 ---
diff --git a/core/simd/x86/sha.odin b/core/simd/x86/sha.odin
index f015f4b8a..bc58e8504 100644
--- a/core/simd/x86/sha.odin
+++ b/core/simd/x86/sha.odin
@@ -30,7 +30,7 @@ _mm_sha256rnds2_epu32 :: #force_inline proc "c" (a, b, k: __m128i) -> __m128i {
return transmute(__m128i)sha256rnds2(transmute(i32x4)a, transmute(i32x4)b, transmute(i32x4)k)
}
-@(private, default_calling_convention="c")
+@(private, default_calling_convention="none")
foreign _ {
@(link_name="llvm.x86.sha1msg1")
sha1msg1 :: proc(a, b: i32x4) -> i32x4 ---
diff --git a/core/simd/x86/sse.odin b/core/simd/x86/sse.odin
index 2b70e954f..903a43dfd 100644
--- a/core/simd/x86/sse.odin
+++ b/core/simd/x86/sse.odin
@@ -532,7 +532,7 @@ when ODIN_ARCH == .amd64 {
}
-@(private, default_calling_convention="c")
+@(private, default_calling_convention="none")
foreign _ {
@(link_name="llvm.x86.sse.add.ss")
addss :: proc(a, b: __m128) -> __m128 ---
diff --git a/core/simd/x86/sse2.odin b/core/simd/x86/sse2.odin
index dd292712f..a597122f1 100644
--- a/core/simd/x86/sse2.odin
+++ b/core/simd/x86/sse2.odin
@@ -1040,7 +1040,7 @@ when ODIN_ARCH == .amd64 {
}
-@(private, default_calling_convention="c")
+@(private, default_calling_convention="none")
foreign _ {
@(link_name="llvm.x86.sse2.pause")
pause :: proc() ---
diff --git a/core/simd/x86/sse3.odin b/core/simd/x86/sse3.odin
index 7a3073c18..cf5f3b2fa 100644
--- a/core/simd/x86/sse3.odin
+++ b/core/simd/x86/sse3.odin
@@ -49,7 +49,7 @@ _mm_moveldup_ps :: #force_inline proc "c" (a: __m128) -> __m128 {
return simd.shuffle(a, a, 0, 0, 2, 2)
}
-@(private, default_calling_convention="c")
+@(private, default_calling_convention="none")
foreign _ {
@(link_name = "llvm.x86.sse3.addsub.ps")
addsubps :: proc(a, b: __m128) -> __m128 ---
diff --git a/core/simd/x86/sse41.odin b/core/simd/x86/sse41.odin
index b35be33f2..8c306ba4c 100644
--- a/core/simd/x86/sse41.odin
+++ b/core/simd/x86/sse41.odin
@@ -291,7 +291,7 @@ when ODIN_ARCH == .amd64 {
}
-@(private, default_calling_convention="c")
+@(private, default_calling_convention="none")
foreign _ {
@(link_name = "llvm.x86.sse41.pblendvb")
pblendvb :: proc(a, b: i8x16, mask: i8x16) -> i8x16 ---
diff --git a/core/simd/x86/sse42.odin b/core/simd/x86/sse42.odin
index 62b4f0478..621346342 100644
--- a/core/simd/x86/sse42.odin
+++ b/core/simd/x86/sse42.odin
@@ -104,7 +104,7 @@ when ODIN_ARCH == .amd64 {
}
}
-@(private, default_calling_convention="c")
+@(private, default_calling_convention="none")
foreign _ {
// SSE 4.2 string and text comparison ops
@(link_name="llvm.x86.sse42.pcmpestrm128")
diff --git a/core/simd/x86/ssse3.odin b/core/simd/x86/ssse3.odin
index f11ef6774..0264a1c93 100644
--- a/core/simd/x86/ssse3.odin
+++ b/core/simd/x86/ssse3.odin
@@ -105,7 +105,7 @@ _mm_sign_epi32 :: #force_inline proc "c" (a, b: __m128i) -> __m128i {
-@(private, default_calling_convention="c")
+@(private, default_calling_convention="none")
foreign _ {
@(link_name = "llvm.x86.ssse3.pabs.b.128")
pabsb128 :: proc(a: i8x16) -> u8x16 ---