Zig Version
0.15.2, 0.16.0-dev.2193+fc517bd01
Steps to Reproduce and Observed Behavior
getting errors related to abi change when compiling with avx512 vector types and anv512 disabled when compiling skcmx.cc.
Here is an example
./src/Transform_inl.h:842:21: error: AVX vector return of type 'float __attribute__((ext_vector_type(16)))' (vector of 16 'float' values) without 'evex512' enabled changes the ABI
842 | b = cast<F>((rgba >> 16) & 0xff) * (1/255.0f);
| ^
Expected Behavior
No compilation error. Clang just gives warnings not errors.
FIx
clang++ -c skcms.cc gives no errors but adding -Xclang -target-feature -Xclang -evex512 gives the same errors as zig does.
I think -evex512 is interpreted by clang as Do't allow usage of vector types in any case. The following patch fixrs the issue.
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -7162,6 +7162,9 @@ pub fn addCCArgs(
std.mem.startsWith(u8, llvm_name, "hard-float"))
continue;
+ // Allow using _m512 types in abi. https://github.com/ziglang/zig/issues/20414
+ if (target.cpu.arch == .x86_64 and !is_enabled and index == @intFromEnum(std.Target.x86.Feature.evex512)) continue;
+
// Ignore these until we figure out how to handle the concept of omitting features.
// See https://github.com/ziglang/zig/issues/23539
if (target_util.isDynamicAMDGCNFeature(target, feature)) continue;
### Zig Version
0.15.2, 0.16.0-dev.2193+fc517bd01
### Steps to Reproduce and Observed Behavior
getting errors related to abi change when compiling with avx512 vector types and anv512 disabled when compiling `skcmx.cc`.
Here is an example
```
./src/Transform_inl.h:842:21: error: AVX vector return of type 'float __attribute__((ext_vector_type(16)))' (vector of 16 'float' values) without 'evex512' enabled changes the ABI
842 | b = cast<F>((rgba >> 16) & 0xff) * (1/255.0f);
| ^
```
Related Issues: [#20414](https://github.com/ziglang/zig/issues/20414), [22046](https://github.com/ziglang/zig/issues/22046)
### Expected Behavior
No compilation error. Clang just gives warnings not errors.
### FIx
`clang++ -c skcms.cc` gives no errors but adding `-Xclang -target-feature -Xclang -evex512` gives the same errors as zig does.
I think `-evex512` is interpreted by clang as **Do't allow usage of vector types in any case**. The following patch fixrs the issue.
```diff
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -7162,6 +7162,9 @@ pub fn addCCArgs(
std.mem.startsWith(u8, llvm_name, "hard-float"))
continue;
+ // Allow using _m512 types in abi. https://github.com/ziglang/zig/issues/20414
+ if (target.cpu.arch == .x86_64 and !is_enabled and index == @intFromEnum(std.Target.x86.Feature.evex512)) continue;
+
// Ignore these until we figure out how to handle the concept of omitting features.
// See https://github.com/ziglang/zig/issues/23539
if (target_util.isDynamicAMDGCNFeature(target, feature)) continue;
```