aboutsummaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2023-01-11 22:39:25 +0200
committerVeikka Tuominen <git@vexu.eu>2023-01-14 16:26:50 +0200
commit5572c67e73222716372762d30453cc44ca4339c0 (patch)
treeb3da065281add01a271a7142297e0423ae1c4610 /src/arch
parent474848ac0b6cd026502d85f0f77f0474516e887b (diff)
downloadzig-5572c67e73222716372762d30453cc44ca4339c0.tar.gz
zig-5572c67e73222716372762d30453cc44ca4339c0.zip
add C ABI tests for exotic float types
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/x86_64/abi.zig18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/arch/x86_64/abi.zig b/src/arch/x86_64/abi.zig
index 54c08e4aa9..9fb0f795e3 100644
--- a/src/arch/x86_64/abi.zig
+++ b/src/arch/x86_64/abi.zig
@@ -112,7 +112,16 @@ pub fn classifySystemV(ty: Type, target: Target, ctx: Context) [8]Class {
return result;
},
.Float => switch (ty.floatBits(target)) {
- 16, 32, 64 => {
+ 16 => {
+ if (ctx == .other) {
+ result[0] = .memory;
+ } else {
+ // TODO clang doesn't allow __fp16 as .ret or .arg
+ result[0] = .sse;
+ }
+ return result;
+ },
+ 32, 64 => {
result[0] = .sse;
return result;
},
@@ -120,11 +129,15 @@ pub fn classifySystemV(ty: Type, target: Target, ctx: Context) [8]Class {
// "Arguments of types__float128, _Decimal128 and__m128 are
// split into two halves. The least significant ones belong
// to class SSE, the most significant one to class SSEUP."
+ if (ctx == .other) {
+ result[0] = .memory;
+ return result;
+ }
result[0] = .sse;
result[1] = .sseup;
return result;
},
- else => {
+ 80 => {
// "The 64-bit mantissa of arguments of type long double
// belongs to classX87, the 16-bit exponent plus 6 bytes
// of padding belongs to class X87UP."
@@ -132,6 +145,7 @@ pub fn classifySystemV(ty: Type, target: Target, ctx: Context) [8]Class {
result[1] = .x87up;
return result;
},
+ else => unreachable,
},
.Vector => {
const elem_ty = ty.childType();