authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-08-06 19:48:01+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-08-06 20:17:03+02:00
log23b5a6c71eb3229e0456a6900f3672c77b91d1f6
treeb9bb5fe16896ce16d15ed6f834f926a37882bc46
parent231f322a65acd353e4a88907cea7621b6adc2c4b
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.Target: Treat spirv as identical to spirv64 for ABI size/alignment purposes.

This is arbitrary since spirv (as opposed to spirv32/spirv64) refers to the version with logical memory layout, i.e. no 'real' pointers. This change at least matches what clang does.

1 files changed, 3 insertions(+), 6 deletions(-)

lib/std/Target.zig+3-6
...@@ -1875,11 +1875,10 @@ pub fn ptrBitWidth_cpu_abi(cpu: Cpu, abi: Abi) u16 {...@@ -1875,11 +1875,10 @@ pub fn ptrBitWidth_cpu_abi(cpu: Cpu, abi: Abi) u16 {
1875 .sparc64,1875 .sparc64,
1876 .s390x,1876 .s390x,
1877 .ve,1877 .ve,
1878 .spirv,
1878 .spirv64,1879 .spirv64,
1879 .loongarch64,1880 .loongarch64,
1880 => 64,1881 => 64,
1881
1882 .spirv => @panic("TODO what should this value be?"),
1883 };1882 };
1884}1883}
18851884
...@@ -2359,6 +2358,7 @@ pub fn c_type_alignment(target: Target, c_type: CType) u16 {...@@ -2359,6 +2358,7 @@ pub fn c_type_alignment(target: Target, c_type: CType) u16 {
2359 .nvptx,2358 .nvptx,
2360 .nvptx64,2359 .nvptx64,
2361 .s390x,2360 .s390x,
2361 .spirv,
2362 .spirv32,2362 .spirv32,
2363 .spirv64,2363 .spirv64,
2364 => 8,2364 => 8,
...@@ -2380,8 +2380,6 @@ pub fn c_type_alignment(target: Target, c_type: CType) u16 {...@@ -2380,8 +2380,6 @@ pub fn c_type_alignment(target: Target, c_type: CType) u16 {
2380 .wasm32,2380 .wasm32,
2381 .wasm64,2381 .wasm64,
2382 => 16,2382 => 16,
2383
2384 .spirv => @panic("TODO what should this value be?"),
2385 }),2383 }),
2386 );2384 );
2387}2385}
...@@ -2471,6 +2469,7 @@ pub fn c_type_preferred_alignment(target: Target, c_type: CType) u16 {...@@ -2471,6 +2469,7 @@ pub fn c_type_preferred_alignment(target: Target, c_type: CType) u16 {
2471 .nvptx,2469 .nvptx,
2472 .nvptx64,2470 .nvptx64,
2473 .s390x,2471 .s390x,
2472 .spirv,
2474 .spirv32,2473 .spirv32,
2475 .spirv64,2474 .spirv64,
2476 => 8,2475 => 8,
...@@ -2492,8 +2491,6 @@ pub fn c_type_preferred_alignment(target: Target, c_type: CType) u16 {...@@ -2492,8 +2491,6 @@ pub fn c_type_preferred_alignment(target: Target, c_type: CType) u16 {
2492 .wasm32,2491 .wasm32,
2493 .wasm64,2492 .wasm64,
2494 => 16,2493 => 16,
2495
2496 .spirv => @panic("TODO what should this value be?"),
2497 }),2494 }),
2498 );2495 );
2499}2496}