mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
x86_64: rewrite bitwise @reduce
This commit is contained in:
parent
4f3b59f708
commit
d69f4c48fc
@ -192,8 +192,6 @@ test eql {
|
||||
}
|
||||
|
||||
test "eql (vectors)" {
|
||||
if (@import("builtin").zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
|
||||
const random = std.crypto.random;
|
||||
const expect = std.testing.expect;
|
||||
var a: [100]u8 = undefined;
|
||||
|
||||
@ -2142,7 +2142,7 @@ pub const Inst = struct {
|
||||
ref_start_index = static_len,
|
||||
_,
|
||||
|
||||
pub const static_len = 101;
|
||||
pub const static_len = 105;
|
||||
|
||||
pub fn toRef(i: Index) Inst.Ref {
|
||||
return @enumFromInt(@intFromEnum(Index.ref_start_index) + @intFromEnum(i));
|
||||
@ -2190,6 +2190,7 @@ pub const Inst = struct {
|
||||
u80_type,
|
||||
u128_type,
|
||||
i128_type,
|
||||
u256_type,
|
||||
usize_type,
|
||||
isize_type,
|
||||
c_char_type,
|
||||
@ -2234,6 +2235,7 @@ pub const Inst = struct {
|
||||
vector_8_u8_type,
|
||||
vector_16_u8_type,
|
||||
vector_32_u8_type,
|
||||
vector_64_u8_type,
|
||||
vector_4_i16_type,
|
||||
vector_8_i16_type,
|
||||
vector_16_i16_type,
|
||||
@ -2248,7 +2250,9 @@ pub const Inst = struct {
|
||||
vector_4_i64_type,
|
||||
vector_2_u64_type,
|
||||
vector_4_u64_type,
|
||||
vector_1_u128_type,
|
||||
vector_2_u128_type,
|
||||
vector_1_u256_type,
|
||||
vector_4_f16_type,
|
||||
vector_8_f16_type,
|
||||
vector_2_f32_type,
|
||||
|
||||
@ -973,6 +973,7 @@ pub const Inst = struct {
|
||||
u80_type = @intFromEnum(InternPool.Index.u80_type),
|
||||
u128_type = @intFromEnum(InternPool.Index.u128_type),
|
||||
i128_type = @intFromEnum(InternPool.Index.i128_type),
|
||||
u256_type = @intFromEnum(InternPool.Index.u256_type),
|
||||
usize_type = @intFromEnum(InternPool.Index.usize_type),
|
||||
isize_type = @intFromEnum(InternPool.Index.isize_type),
|
||||
c_char_type = @intFromEnum(InternPool.Index.c_char_type),
|
||||
@ -1017,6 +1018,7 @@ pub const Inst = struct {
|
||||
vector_8_u8_type = @intFromEnum(InternPool.Index.vector_8_u8_type),
|
||||
vector_16_u8_type = @intFromEnum(InternPool.Index.vector_16_u8_type),
|
||||
vector_32_u8_type = @intFromEnum(InternPool.Index.vector_32_u8_type),
|
||||
vector_64_u8_type = @intFromEnum(InternPool.Index.vector_64_u8_type),
|
||||
vector_4_i16_type = @intFromEnum(InternPool.Index.vector_4_i16_type),
|
||||
vector_8_i16_type = @intFromEnum(InternPool.Index.vector_8_i16_type),
|
||||
vector_16_i16_type = @intFromEnum(InternPool.Index.vector_16_i16_type),
|
||||
@ -1031,7 +1033,9 @@ pub const Inst = struct {
|
||||
vector_4_i64_type = @intFromEnum(InternPool.Index.vector_4_i64_type),
|
||||
vector_2_u64_type = @intFromEnum(InternPool.Index.vector_2_u64_type),
|
||||
vector_4_u64_type = @intFromEnum(InternPool.Index.vector_4_u64_type),
|
||||
vector_1_u128_type = @intFromEnum(InternPool.Index.vector_1_u128_type),
|
||||
vector_2_u128_type = @intFromEnum(InternPool.Index.vector_2_u128_type),
|
||||
vector_1_u256_type = @intFromEnum(InternPool.Index.vector_1_u256_type),
|
||||
vector_4_f16_type = @intFromEnum(InternPool.Index.vector_4_f16_type),
|
||||
vector_8_f16_type = @intFromEnum(InternPool.Index.vector_8_f16_type),
|
||||
vector_2_f32_type = @intFromEnum(InternPool.Index.vector_2_f32_type),
|
||||
|
||||
@ -4548,6 +4548,7 @@ pub const Index = enum(u32) {
|
||||
u80_type,
|
||||
u128_type,
|
||||
i128_type,
|
||||
u256_type,
|
||||
usize_type,
|
||||
isize_type,
|
||||
c_char_type,
|
||||
@ -4594,6 +4595,7 @@ pub const Index = enum(u32) {
|
||||
vector_8_u8_type,
|
||||
vector_16_u8_type,
|
||||
vector_32_u8_type,
|
||||
vector_64_u8_type,
|
||||
vector_4_i16_type,
|
||||
vector_8_i16_type,
|
||||
vector_16_i16_type,
|
||||
@ -4608,7 +4610,9 @@ pub const Index = enum(u32) {
|
||||
vector_4_i64_type,
|
||||
vector_2_u64_type,
|
||||
vector_4_u64_type,
|
||||
vector_1_u128_type,
|
||||
vector_2_u128_type,
|
||||
vector_1_u256_type,
|
||||
vector_4_f16_type,
|
||||
vector_8_f16_type,
|
||||
vector_2_f32_type,
|
||||
@ -5022,6 +5026,11 @@ pub const static_keys = [_]Key{
|
||||
.bits = 128,
|
||||
} },
|
||||
|
||||
.{ .int_type = .{
|
||||
.signedness = .unsigned,
|
||||
.bits = 256,
|
||||
} },
|
||||
|
||||
.{ .simple_type = .usize },
|
||||
.{ .simple_type = .isize },
|
||||
.{ .simple_type = .c_char },
|
||||
@ -5125,6 +5134,8 @@ pub const static_keys = [_]Key{
|
||||
.{ .vector_type = .{ .len = 16, .child = .u8_type } },
|
||||
// @Vector(32, u8)
|
||||
.{ .vector_type = .{ .len = 32, .child = .u8_type } },
|
||||
// @Vector(64, u8)
|
||||
.{ .vector_type = .{ .len = 64, .child = .u8_type } },
|
||||
// @Vector(4, i16)
|
||||
.{ .vector_type = .{ .len = 4, .child = .i16_type } },
|
||||
// @Vector(8, i16)
|
||||
@ -5153,8 +5164,12 @@ pub const static_keys = [_]Key{
|
||||
.{ .vector_type = .{ .len = 2, .child = .u64_type } },
|
||||
// @Vector(8, u64)
|
||||
.{ .vector_type = .{ .len = 4, .child = .u64_type } },
|
||||
// @Vector(1, u128)
|
||||
.{ .vector_type = .{ .len = 1, .child = .u128_type } },
|
||||
// @Vector(2, u128)
|
||||
.{ .vector_type = .{ .len = 2, .child = .u128_type } },
|
||||
// @Vector(1, u256)
|
||||
.{ .vector_type = .{ .len = 1, .child = .u256_type } },
|
||||
// @Vector(4, f16)
|
||||
.{ .vector_type = .{ .len = 4, .child = .f16_type } },
|
||||
// @Vector(8, f16)
|
||||
@ -11767,6 +11782,7 @@ pub fn typeOf(ip: *const InternPool, index: Index) Index {
|
||||
.u80_type,
|
||||
.u128_type,
|
||||
.i128_type,
|
||||
.u256_type,
|
||||
.usize_type,
|
||||
.isize_type,
|
||||
.c_char_type,
|
||||
@ -11811,6 +11827,7 @@ pub fn typeOf(ip: *const InternPool, index: Index) Index {
|
||||
.vector_8_u8_type,
|
||||
.vector_16_u8_type,
|
||||
.vector_32_u8_type,
|
||||
.vector_64_u8_type,
|
||||
.vector_4_i16_type,
|
||||
.vector_8_i16_type,
|
||||
.vector_16_i16_type,
|
||||
@ -11825,7 +11842,9 @@ pub fn typeOf(ip: *const InternPool, index: Index) Index {
|
||||
.vector_4_i64_type,
|
||||
.vector_2_u64_type,
|
||||
.vector_4_u64_type,
|
||||
.vector_1_u128_type,
|
||||
.vector_2_u128_type,
|
||||
.vector_1_u256_type,
|
||||
.vector_4_f16_type,
|
||||
.vector_8_f16_type,
|
||||
.vector_2_f32_type,
|
||||
@ -12084,6 +12103,7 @@ pub fn zigTypeTag(ip: *const InternPool, index: Index) std.builtin.TypeId {
|
||||
.u80_type,
|
||||
.u128_type,
|
||||
.i128_type,
|
||||
.u256_type,
|
||||
.usize_type,
|
||||
.isize_type,
|
||||
.c_char_type,
|
||||
@ -12135,6 +12155,7 @@ pub fn zigTypeTag(ip: *const InternPool, index: Index) std.builtin.TypeId {
|
||||
.vector_8_u8_type,
|
||||
.vector_16_u8_type,
|
||||
.vector_32_u8_type,
|
||||
.vector_64_u8_type,
|
||||
.vector_4_i16_type,
|
||||
.vector_8_i16_type,
|
||||
.vector_16_i16_type,
|
||||
@ -12149,7 +12170,9 @@ pub fn zigTypeTag(ip: *const InternPool, index: Index) std.builtin.TypeId {
|
||||
.vector_4_i64_type,
|
||||
.vector_2_u64_type,
|
||||
.vector_4_u64_type,
|
||||
.vector_1_u128_type,
|
||||
.vector_2_u128_type,
|
||||
.vector_1_u256_type,
|
||||
.vector_4_f16_type,
|
||||
.vector_8_f16_type,
|
||||
.vector_2_f32_type,
|
||||
|
||||
@ -36595,6 +36595,7 @@ pub fn typeHasOnePossibleValue(sema: *Sema, ty: Type) CompileError!?Value {
|
||||
.u80_type,
|
||||
.u128_type,
|
||||
.i128_type,
|
||||
.u256_type,
|
||||
.usize_type,
|
||||
.isize_type,
|
||||
.c_char_type,
|
||||
@ -36635,6 +36636,7 @@ pub fn typeHasOnePossibleValue(sema: *Sema, ty: Type) CompileError!?Value {
|
||||
.vector_8_u8_type,
|
||||
.vector_16_u8_type,
|
||||
.vector_32_u8_type,
|
||||
.vector_64_u8_type,
|
||||
.vector_4_i16_type,
|
||||
.vector_8_i16_type,
|
||||
.vector_16_i16_type,
|
||||
@ -36649,7 +36651,9 @@ pub fn typeHasOnePossibleValue(sema: *Sema, ty: Type) CompileError!?Value {
|
||||
.vector_4_i64_type,
|
||||
.vector_2_u64_type,
|
||||
.vector_4_u64_type,
|
||||
.vector_1_u128_type,
|
||||
.vector_2_u128_type,
|
||||
.vector_1_u256_type,
|
||||
.vector_4_f16_type,
|
||||
.vector_8_f16_type,
|
||||
.vector_2_f32_type,
|
||||
|
||||
@ -994,7 +994,7 @@ pub fn abiAlignmentInner(
|
||||
.stage2_x86_64 => {
|
||||
if (vector_type.child == .bool_type) {
|
||||
if (vector_type.len > 256 and std.Target.x86.featureSetHas(target.cpu.features, .avx512f)) return .{ .scalar = .@"64" };
|
||||
if (vector_type.len > 128 and std.Target.x86.featureSetHas(target.cpu.features, .avx2)) return .{ .scalar = .@"32" };
|
||||
if (vector_type.len > 128 and std.Target.x86.featureSetHas(target.cpu.features, .avx)) return .{ .scalar = .@"32" };
|
||||
if (vector_type.len > 64) return .{ .scalar = .@"16" };
|
||||
const bytes = std.math.divCeil(u32, vector_type.len, 8) catch unreachable;
|
||||
const alignment = std.math.ceilPowerOfTwoAssert(u32, bytes);
|
||||
@ -4060,6 +4060,7 @@ pub const @"u32": Type = .{ .ip_index = .u32_type };
|
||||
pub const @"u64": Type = .{ .ip_index = .u64_type };
|
||||
pub const @"u80": Type = .{ .ip_index = .u80_type };
|
||||
pub const @"u128": Type = .{ .ip_index = .u128_type };
|
||||
pub const @"u256": Type = .{ .ip_index = .u256_type };
|
||||
|
||||
pub const @"i8": Type = .{ .ip_index = .i8_type };
|
||||
pub const @"i16": Type = .{ .ip_index = .i16_type };
|
||||
@ -4115,6 +4116,7 @@ pub const vector_4_u8: Type = .{ .ip_index = .vector_4_u8_type };
|
||||
pub const vector_8_u8: Type = .{ .ip_index = .vector_8_u8_type };
|
||||
pub const vector_16_u8: Type = .{ .ip_index = .vector_16_u8_type };
|
||||
pub const vector_32_u8: Type = .{ .ip_index = .vector_32_u8_type };
|
||||
pub const vector_64_u8: Type = .{ .ip_index = .vector_64_u8_type };
|
||||
pub const vector_4_i16: Type = .{ .ip_index = .vector_4_i16_type };
|
||||
pub const vector_8_i16: Type = .{ .ip_index = .vector_8_i16_type };
|
||||
pub const vector_16_i16: Type = .{ .ip_index = .vector_16_i16_type };
|
||||
@ -4129,7 +4131,9 @@ pub const vector_2_i64: Type = .{ .ip_index = .vector_2_i64_type };
|
||||
pub const vector_4_i64: Type = .{ .ip_index = .vector_4_i64_type };
|
||||
pub const vector_2_u64: Type = .{ .ip_index = .vector_2_u64_type };
|
||||
pub const vector_4_u64: Type = .{ .ip_index = .vector_4_u64_type };
|
||||
pub const vector_1_u128: Type = .{ .ip_index = .vector_1_u128_type };
|
||||
pub const vector_2_u128: Type = .{ .ip_index = .vector_2_u128_type };
|
||||
pub const vector_1_u256: Type = .{ .ip_index = .vector_1_u256_type };
|
||||
pub const vector_4_f16: Type = .{ .ip_index = .vector_4_f16_type };
|
||||
pub const vector_8_f16: Type = .{ .ip_index = .vector_8_f16_type };
|
||||
pub const vector_2_f32: Type = .{ .ip_index = .vector_2_f32_type };
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1374,6 +1374,10 @@ pub const Pool = struct {
|
||||
.i64_type => return .i64,
|
||||
.u80_type, .u128_type => return .u128,
|
||||
.i128_type => return .i128,
|
||||
.u256_type => return pool.fromIntInfo(allocator, .{
|
||||
.signedness = .unsigned,
|
||||
.bits = 256,
|
||||
}, mod, kind),
|
||||
.usize_type => return .usize,
|
||||
.isize_type => return .isize,
|
||||
.c_char_type => return .{ .index = .char },
|
||||
@ -1578,6 +1582,21 @@ pub const Pool = struct {
|
||||
};
|
||||
return pool.fromFields(allocator, .@"struct", &fields, kind);
|
||||
},
|
||||
.vector_64_u8_type => {
|
||||
const vector_ctype = try pool.getVector(allocator, .{
|
||||
.elem_ctype = .u8,
|
||||
.len = 64,
|
||||
});
|
||||
if (!kind.isParameter()) return vector_ctype;
|
||||
var fields = [_]Info.Field{
|
||||
.{
|
||||
.name = .{ .index = .array },
|
||||
.ctype = vector_ctype,
|
||||
.alignas = AlignAs.fromAbiAlignment(Type.u8.abiAlignment(zcu)),
|
||||
},
|
||||
};
|
||||
return pool.fromFields(allocator, .@"struct", &fields, kind);
|
||||
},
|
||||
.vector_4_i16_type => {
|
||||
const vector_ctype = try pool.getVector(allocator, .{
|
||||
.elem_ctype = .i16,
|
||||
@ -1788,6 +1807,21 @@ pub const Pool = struct {
|
||||
};
|
||||
return pool.fromFields(allocator, .@"struct", &fields, kind);
|
||||
},
|
||||
.vector_1_u128_type => {
|
||||
const vector_ctype = try pool.getVector(allocator, .{
|
||||
.elem_ctype = .u128,
|
||||
.len = 1,
|
||||
});
|
||||
if (!kind.isParameter()) return vector_ctype;
|
||||
var fields = [_]Info.Field{
|
||||
.{
|
||||
.name = .{ .index = .array },
|
||||
.ctype = vector_ctype,
|
||||
.alignas = AlignAs.fromAbiAlignment(Type.u128.abiAlignment(zcu)),
|
||||
},
|
||||
};
|
||||
return pool.fromFields(allocator, .@"struct", &fields, kind);
|
||||
},
|
||||
.vector_2_u128_type => {
|
||||
const vector_ctype = try pool.getVector(allocator, .{
|
||||
.elem_ctype = .u128,
|
||||
@ -1803,6 +1837,24 @@ pub const Pool = struct {
|
||||
};
|
||||
return pool.fromFields(allocator, .@"struct", &fields, kind);
|
||||
},
|
||||
.vector_1_u256_type => {
|
||||
const vector_ctype = try pool.getVector(allocator, .{
|
||||
.elem_ctype = try pool.fromIntInfo(allocator, .{
|
||||
.signedness = .unsigned,
|
||||
.bits = 256,
|
||||
}, mod, kind),
|
||||
.len = 1,
|
||||
});
|
||||
if (!kind.isParameter()) return vector_ctype;
|
||||
var fields = [_]Info.Field{
|
||||
.{
|
||||
.name = .{ .index = .array },
|
||||
.ctype = vector_ctype,
|
||||
.alignas = AlignAs.fromAbiAlignment(Type.u256.abiAlignment(zcu)),
|
||||
},
|
||||
};
|
||||
return pool.fromFields(allocator, .@"struct", &fields, kind);
|
||||
},
|
||||
.vector_4_f16_type => {
|
||||
const vector_ctype = try pool.getVector(allocator, .{
|
||||
.elem_ctype = .f16,
|
||||
|
||||
@ -236,11 +236,11 @@ test "vector cmp f16" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
|
||||
if (builtin.cpu.arch.isArm()) return error.SkipZigTest;
|
||||
if (builtin.cpu.arch.isPowerPC64()) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .hexagon) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest;
|
||||
|
||||
try testCmpVector(f16);
|
||||
try comptime testCmpVector(f16);
|
||||
@ -250,11 +250,11 @@ test "vector cmp f32" {
|
||||
if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
|
||||
if (builtin.cpu.arch.isArm()) return error.SkipZigTest;
|
||||
if (builtin.cpu.arch.isPowerPC64()) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .hexagon) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest;
|
||||
|
||||
try testCmpVector(f32);
|
||||
try comptime testCmpVector(f32);
|
||||
@ -263,11 +263,11 @@ test "vector cmp f32" {
|
||||
test "vector cmp f64" {
|
||||
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
|
||||
if (builtin.cpu.arch.isArm()) return error.SkipZigTest;
|
||||
if (builtin.cpu.arch.isPowerPC64()) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .hexagon) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest;
|
||||
|
||||
try testCmpVector(f64);
|
||||
try comptime testCmpVector(f64);
|
||||
@ -279,11 +279,11 @@ test "vector cmp f128" {
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
|
||||
if (builtin.zig_backend == .stage2_c and builtin.cpu.arch.isArm()) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest;
|
||||
if (builtin.cpu.arch.isArm()) return error.SkipZigTest;
|
||||
if (builtin.cpu.arch.isPowerPC64()) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .hexagon) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_x86_64 and builtin.target.ofmt != .elf and builtin.target.ofmt != .macho) return error.SkipZigTest;
|
||||
|
||||
try testCmpVector(f128);
|
||||
try comptime testCmpVector(f128);
|
||||
|
||||
@ -5434,6 +5434,60 @@ test optionalsNotEqual {
|
||||
try test_optionals_not_equal.testFloats();
|
||||
}
|
||||
|
||||
inline fn reduceAndEqual(comptime Type: type, lhs: Type, rhs: Type) bool {
|
||||
return @reduce(.And, lhs == rhs);
|
||||
}
|
||||
test reduceAndEqual {
|
||||
const test_reduce_and_equal = binary(reduceAndEqual, .{});
|
||||
try test_reduce_and_equal.testIntVectors();
|
||||
try test_reduce_and_equal.testFloatVectors();
|
||||
}
|
||||
|
||||
inline fn reduceAndNotEqual(comptime Type: type, lhs: Type, rhs: Type) bool {
|
||||
return @reduce(.And, lhs != rhs);
|
||||
}
|
||||
test reduceAndNotEqual {
|
||||
const test_reduce_and_not_equal = binary(reduceAndNotEqual, .{});
|
||||
try test_reduce_and_not_equal.testIntVectors();
|
||||
try test_reduce_and_not_equal.testFloatVectors();
|
||||
}
|
||||
|
||||
inline fn reduceOrEqual(comptime Type: type, lhs: Type, rhs: Type) bool {
|
||||
return @reduce(.Or, lhs == rhs);
|
||||
}
|
||||
test reduceOrEqual {
|
||||
const test_reduce_or_equal = binary(reduceOrEqual, .{});
|
||||
try test_reduce_or_equal.testIntVectors();
|
||||
try test_reduce_or_equal.testFloatVectors();
|
||||
}
|
||||
|
||||
inline fn reduceOrNotEqual(comptime Type: type, lhs: Type, rhs: Type) bool {
|
||||
return @reduce(.Or, lhs != rhs);
|
||||
}
|
||||
test reduceOrNotEqual {
|
||||
const test_reduce_or_not_equal = binary(reduceOrNotEqual, .{});
|
||||
try test_reduce_or_not_equal.testIntVectors();
|
||||
try test_reduce_or_not_equal.testFloatVectors();
|
||||
}
|
||||
|
||||
inline fn reduceXorEqual(comptime Type: type, lhs: Type, rhs: Type) bool {
|
||||
return @reduce(.Xor, lhs == rhs);
|
||||
}
|
||||
test reduceXorEqual {
|
||||
const test_reduce_xor_equal = binary(reduceXorEqual, .{});
|
||||
try test_reduce_xor_equal.testIntVectors();
|
||||
try test_reduce_xor_equal.testFloatVectors();
|
||||
}
|
||||
|
||||
inline fn reduceXorNotEqual(comptime Type: type, lhs: Type, rhs: Type) bool {
|
||||
return @reduce(.Xor, lhs != rhs);
|
||||
}
|
||||
test reduceXorNotEqual {
|
||||
const test_reduce_xor_not_equal = binary(reduceXorNotEqual, .{});
|
||||
try test_reduce_xor_not_equal.testIntVectors();
|
||||
try test_reduce_xor_not_equal.testFloatVectors();
|
||||
}
|
||||
|
||||
inline fn mulAdd(comptime Type: type, lhs: Type, rhs: Type) @TypeOf(@mulAdd(Type, lhs, rhs, rhs)) {
|
||||
return @mulAdd(Type, lhs, rhs, rhs);
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ pub fn build(b: *std.Build) void {
|
||||
.{
|
||||
.cpu_arch = .x86_64,
|
||||
.cpu_model = .{ .explicit = &std.Target.x86.cpu.x86_64_v2 },
|
||||
.cpu_features_add = std.Target.x86.featureSet(&.{ .adx, .gfni }),
|
||||
.cpu_features_add = std.Target.x86.featureSet(&.{ .adx, .gfni, .pclmul }),
|
||||
},
|
||||
.{
|
||||
.cpu_arch = .x86_64,
|
||||
@ -106,11 +106,12 @@ pub fn build(b: *std.Build) void {
|
||||
.{
|
||||
.cpu_arch = .x86_64,
|
||||
.cpu_model = .{ .explicit = &std.Target.x86.cpu.x86_64_v3 },
|
||||
.cpu_features_add = std.Target.x86.featureSet(&.{ .adx, .gfni }),
|
||||
.cpu_features_add = std.Target.x86.featureSet(&.{ .adx, .gfni, .pclmul }),
|
||||
},
|
||||
.{
|
||||
.cpu_arch = .x86_64,
|
||||
.cpu_model = .{ .explicit = &std.Target.x86.cpu.x86_64_v4 },
|
||||
.cpu_features_add = std.Target.x86.featureSet(&.{.vpclmulqdq}),
|
||||
},
|
||||
}) |query| {
|
||||
const target = b.resolveTargetQuery(query);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -117,9 +117,9 @@ export fn testMutablePointer() void {
|
||||
// tmp.zig:37:38: note: imported here
|
||||
// neg_inf.zon:1:1: error: expected type '?u8'
|
||||
// tmp.zig:57:28: note: imported here
|
||||
// neg_inf.zon:1:1: error: expected type 'tmp.testNonExhaustiveEnum__enum_501'
|
||||
// neg_inf.zon:1:1: error: expected type 'tmp.testNonExhaustiveEnum__enum_505'
|
||||
// tmp.zig:62:39: note: imported here
|
||||
// neg_inf.zon:1:1: error: expected type 'tmp.testUntaggedUnion__union_503'
|
||||
// neg_inf.zon:1:1: error: expected type 'tmp.testUntaggedUnion__union_507'
|
||||
// tmp.zig:67:44: note: imported here
|
||||
// neg_inf.zon:1:1: error: expected type 'tmp.testTaggedUnionVoid__union_506'
|
||||
// neg_inf.zon:1:1: error: expected type 'tmp.testTaggedUnionVoid__union_510'
|
||||
// tmp.zig:72:50: note: imported here
|
||||
|
||||
@ -15,6 +15,6 @@ pub export fn entry() void {
|
||||
// error
|
||||
//
|
||||
// :7:25: error: unable to resolve comptime value
|
||||
// :7:25: note: initializer of comptime-only struct 'tmp.S.foo__anon_475.C' must be comptime-known
|
||||
// :7:25: note: initializer of comptime-only struct 'tmp.S.foo__anon_479.C' must be comptime-known
|
||||
// :4:16: note: struct requires comptime because of this field
|
||||
// :4:16: note: types are not available at runtime
|
||||
|
||||
@ -16,5 +16,5 @@ pub export fn entry2() void {
|
||||
//
|
||||
// :3:6: error: no field or member function named 'copy' in '[]const u8'
|
||||
// :9:8: error: no field or member function named 'bar' in '@TypeOf(.{})'
|
||||
// :12:18: error: no field or member function named 'bar' in 'tmp.entry2__struct_479'
|
||||
// :12:18: error: no field or member function named 'bar' in 'tmp.entry2__struct_483'
|
||||
// :12:6: note: struct declared here
|
||||
|
||||
@ -6,6 +6,6 @@ export fn foo() void {
|
||||
|
||||
// error
|
||||
//
|
||||
// :4:16: error: expected type 'tmp.T', found 'tmp.foo__struct_468'
|
||||
// :4:16: error: expected type 'tmp.T', found 'tmp.foo__struct_472'
|
||||
// :3:16: note: struct declared here
|
||||
// :1:11: note: struct declared here
|
||||
|
||||
@ -44,9 +44,9 @@ comptime {
|
||||
//
|
||||
// :5:23: error: expected error union type, found 'comptime_int'
|
||||
// :10:23: error: expected error union type, found '@TypeOf(.{})'
|
||||
// :15:23: error: expected error union type, found 'tmp.test2__struct_505'
|
||||
// :15:23: error: expected error union type, found 'tmp.test2__struct_509'
|
||||
// :15:23: note: struct declared here
|
||||
// :20:27: error: expected error union type, found 'tmp.test3__struct_507'
|
||||
// :20:27: error: expected error union type, found 'tmp.test3__struct_511'
|
||||
// :20:27: note: struct declared here
|
||||
// :25:23: error: expected error union type, found 'struct { comptime *const [5:0]u8 = "hello" }'
|
||||
// :31:13: error: expected error union type, found 'u32'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user