| ... | ... | @@ -122,19 +122,17 @@ pub fn classifyWindows(init_ty: Type, zcu: *Zcu, target: *const std.Target, ctx: |
| 122 | 122 | 1, 2, 4, 8 => .integer, |
| 123 | 123 | else => switch (ty.zigTypeTag(zcu)) { |
| 124 | 124 | .int => .win_i128, |
| 125 | | .@"struct", .@"union" => if (ty.containerLayout(zcu) == .@"packed") |
| 126 | | .win_i128 |
| 127 | | else |
| 128 | | .memory, |
| 125 | .@"struct", .@"union" => if (ty.containerLayout(zcu) != .@"packed" or |
| 126 | target.cpu.has(.x86, .soft_float)) .memory else .win_i128, |
| 129 | 127 | else => .memory, |
| 130 | 128 | }, |
| 131 | 129 | }, |
| 132 | 130 | .noreturn => unreachable, |
| 133 | 131 | .float => switch (ty.floatBits(target)) { |
| 134 | | 16, 32, 64 => .sse, |
| 135 | | 80 => .memory, |
| 136 | | 128 => .win_i128, |
| 137 | 132 | else => unreachable, |
| 133 | 16, 32, 64 => if (target.cpu.has(.x86, .soft_float)) .integer else .sse, |
| 134 | 80 => .memory, |
| 135 | 128 => if (target.cpu.has(.x86, .soft_float)) .memory else .win_i128, |
| 138 | 136 | }, |
| 139 | 137 | .vector => { |
| 140 | 138 | const len = ty.vectorLen(zcu); |
| ... | ... | @@ -183,6 +181,7 @@ pub fn classifyWindows(init_ty: Type, zcu: *Zcu, target: *const std.Target, ctx: |
| 183 | 181 | /// the beginning of the array; unused slots are filled with .none. |
| 184 | 182 | pub fn classifySystemV(ty: Type, zcu: *Zcu, target: *const std.Target, ctx: Context) [8]Class { |
| 185 | 183 | switch (ty.zigTypeTag(zcu)) { |
| 184 | else => unreachable, |
| 186 | 185 | .void => return Class.zero_bit, |
| 187 | 186 | .bool => return Class.one_integer, |
| 188 | 187 | .noreturn => unreachable, |
| ... | ... | @@ -195,7 +194,12 @@ pub fn classifySystemV(ty: Type, zcu: *Zcu, target: *const std.Target, ctx: Cont |
| 195 | 194 | if (bits <= 64 * 4) return Class.four_integers; |
| 196 | 195 | return Class.stack; |
| 197 | 196 | }, |
| 198 | | .float => switch (ty.floatBits(target)) { |
| 197 | .float => if (target.cpu.has(.x86, .soft_float)) switch (ty.floatBits(target)) { |
| 198 | else => unreachable, |
| 199 | 16, 32, 64 => return Class.one_integer, |
| 200 | 80, 128 => return Class.two_integers, |
| 201 | } else switch (ty.floatBits(target)) { |
| 202 | else => unreachable, |
| 199 | 203 | 16 => { |
| 200 | 204 | if (ctx == .other) return Class.stack; |
| 201 | 205 | // TODO clang doesn't allow __fp16 as .ret or .arg |
| ... | ... | @@ -203,15 +207,14 @@ pub fn classifySystemV(ty: Type, zcu: *Zcu, target: *const std.Target, ctx: Cont |
| 203 | 207 | }, |
| 204 | 208 | 32 => return Class.f32, |
| 205 | 209 | 64 => return Class.f64, |
| 206 | | // "Arguments of types __float128, _Decimal128 and __m128 are |
| 207 | | // split into two halves. The least significant ones belong |
| 208 | | // to class SSE, the most significant one to class SSEUP." |
| 209 | | 128 => return Class.f128, |
| 210 | 210 | // "The 64-bit mantissa of arguments of type long double |
| 211 | 211 | // belongs to class X87, the 16-bit exponent plus 6 bytes |
| 212 | 212 | // of padding belongs to class X87UP." |
| 213 | 213 | 80 => return Class.f80, |
| 214 | | else => unreachable, |
| 214 | // "Arguments of types __float128, _Decimal128 and __m128 are |
| 215 | // split into two halves. The least significant ones belong |
| 216 | // to class SSE, the most significant one to class SSEUP." |
| 217 | 128 => return Class.f128, |
| 215 | 218 | }, |
| 216 | 219 | .pointer => switch (ty.ptrSize(zcu)) { |
| 217 | 220 | .slice => return Class.two_integers, |
| ... | ... | @@ -341,7 +344,6 @@ pub fn classifySystemV(ty: Type, zcu: *Zcu, target: *const std.Target, ctx: Cont |
| 341 | 344 | if (ty_size <= 16) return Class.two_integers; |
| 342 | 345 | return Class.stack; |
| 343 | 346 | }, |
| 344 | | else => unreachable, |
| 345 | 347 | } |
| 346 | 348 | } |
| 347 | 349 | |