Skip to content

Commit a4a1ebd

Browse files
committed
x86_64: implement optimized float @reduce(.Mul)
1 parent 612f578 commit a4a1ebd

File tree

14 files changed

+2082
-349
lines changed

14 files changed

+2082
-349
lines changed

lib/std/zig/Zir.zig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2142,7 +2142,7 @@ pub const Inst = struct {
21422142
ref_start_index = static_len,
21432143
_,
21442144

2145-
pub const static_len = 105;
2145+
pub const static_len = 109;
21462146

21472147
pub fn toRef(i: Index) Inst.Ref {
21482148
return @enumFromInt(@intFromEnum(Index.ref_start_index) + @intFromEnum(i));
@@ -2255,11 +2255,15 @@ pub const Inst = struct {
22552255
vector_1_u256_type,
22562256
vector_4_f16_type,
22572257
vector_8_f16_type,
2258+
vector_16_f16_type,
2259+
vector_32_f16_type,
22582260
vector_2_f32_type,
22592261
vector_4_f32_type,
22602262
vector_8_f32_type,
2263+
vector_16_f32_type,
22612264
vector_2_f64_type,
22622265
vector_4_f64_type,
2266+
vector_8_f64_type,
22632267
optional_noreturn_type,
22642268
anyerror_void_error_union_type,
22652269
adhoc_inferred_error_set_type,

src/Air.zig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,11 +1038,15 @@ pub const Inst = struct {
10381038
vector_1_u256_type = @intFromEnum(InternPool.Index.vector_1_u256_type),
10391039
vector_4_f16_type = @intFromEnum(InternPool.Index.vector_4_f16_type),
10401040
vector_8_f16_type = @intFromEnum(InternPool.Index.vector_8_f16_type),
1041+
vector_16_f16_type = @intFromEnum(InternPool.Index.vector_16_f16_type),
1042+
vector_32_f16_type = @intFromEnum(InternPool.Index.vector_32_f16_type),
10411043
vector_2_f32_type = @intFromEnum(InternPool.Index.vector_2_f32_type),
10421044
vector_4_f32_type = @intFromEnum(InternPool.Index.vector_4_f32_type),
10431045
vector_8_f32_type = @intFromEnum(InternPool.Index.vector_8_f32_type),
1046+
vector_16_f32_type = @intFromEnum(InternPool.Index.vector_16_f32_type),
10441047
vector_2_f64_type = @intFromEnum(InternPool.Index.vector_2_f64_type),
10451048
vector_4_f64_type = @intFromEnum(InternPool.Index.vector_4_f64_type),
1049+
vector_8_f64_type = @intFromEnum(InternPool.Index.vector_8_f64_type),
10461050
optional_noreturn_type = @intFromEnum(InternPool.Index.optional_noreturn_type),
10471051
anyerror_void_error_union_type = @intFromEnum(InternPool.Index.anyerror_void_error_union_type),
10481052
adhoc_inferred_error_set_type = @intFromEnum(InternPool.Index.adhoc_inferred_error_set_type),

src/InternPool.zig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4615,11 +4615,15 @@ pub const Index = enum(u32) {
46154615
vector_1_u256_type,
46164616
vector_4_f16_type,
46174617
vector_8_f16_type,
4618+
vector_16_f16_type,
4619+
vector_32_f16_type,
46184620
vector_2_f32_type,
46194621
vector_4_f32_type,
46204622
vector_8_f32_type,
4623+
vector_16_f32_type,
46214624
vector_2_f64_type,
46224625
vector_4_f64_type,
4626+
vector_8_f64_type,
46234627

46244628
optional_noreturn_type,
46254629
anyerror_void_error_union_type,
@@ -5174,16 +5178,24 @@ pub const static_keys = [_]Key{
51745178
.{ .vector_type = .{ .len = 4, .child = .f16_type } },
51755179
// @Vector(8, f16)
51765180
.{ .vector_type = .{ .len = 8, .child = .f16_type } },
5181+
// @Vector(16, f16)
5182+
.{ .vector_type = .{ .len = 16, .child = .f16_type } },
5183+
// @Vector(32, f16)
5184+
.{ .vector_type = .{ .len = 32, .child = .f16_type } },
51775185
// @Vector(2, f32)
51785186
.{ .vector_type = .{ .len = 2, .child = .f32_type } },
51795187
// @Vector(4, f32)
51805188
.{ .vector_type = .{ .len = 4, .child = .f32_type } },
51815189
// @Vector(8, f32)
51825190
.{ .vector_type = .{ .len = 8, .child = .f32_type } },
5191+
// @Vector(16, f32)
5192+
.{ .vector_type = .{ .len = 16, .child = .f32_type } },
51835193
// @Vector(2, f64)
51845194
.{ .vector_type = .{ .len = 2, .child = .f64_type } },
51855195
// @Vector(4, f64)
51865196
.{ .vector_type = .{ .len = 4, .child = .f64_type } },
5197+
// @Vector(8, f64)
5198+
.{ .vector_type = .{ .len = 8, .child = .f64_type } },
51875199

51885200
// ?noreturn
51895201
.{ .opt_type = .noreturn_type },
@@ -11847,11 +11859,15 @@ pub fn typeOf(ip: *const InternPool, index: Index) Index {
1184711859
.vector_1_u256_type,
1184811860
.vector_4_f16_type,
1184911861
.vector_8_f16_type,
11862+
.vector_16_f16_type,
11863+
.vector_32_f16_type,
1185011864
.vector_2_f32_type,
1185111865
.vector_4_f32_type,
1185211866
.vector_8_f32_type,
11867+
.vector_16_f32_type,
1185311868
.vector_2_f64_type,
1185411869
.vector_4_f64_type,
11870+
.vector_8_f64_type,
1185511871
.optional_noreturn_type,
1185611872
.anyerror_void_error_union_type,
1185711873
.adhoc_inferred_error_set_type,
@@ -12175,11 +12191,15 @@ pub fn zigTypeTag(ip: *const InternPool, index: Index) std.builtin.TypeId {
1217512191
.vector_1_u256_type,
1217612192
.vector_4_f16_type,
1217712193
.vector_8_f16_type,
12194+
.vector_16_f16_type,
12195+
.vector_32_f16_type,
1217812196
.vector_2_f32_type,
1217912197
.vector_4_f32_type,
1218012198
.vector_8_f32_type,
12199+
.vector_16_f32_type,
1218112200
.vector_2_f64_type,
1218212201
.vector_4_f64_type,
12202+
.vector_8_f64_type,
1218312203
=> .vector,
1218412204

1218512205
.optional_noreturn_type => .optional,

src/Sema.zig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36571,11 +36571,15 @@ pub fn typeHasOnePossibleValue(sema: *Sema, ty: Type) CompileError!?Value {
3657136571
.vector_1_u256_type,
3657236572
.vector_4_f16_type,
3657336573
.vector_8_f16_type,
36574+
.vector_16_f16_type,
36575+
.vector_32_f16_type,
3657436576
.vector_2_f32_type,
3657536577
.vector_4_f32_type,
3657636578
.vector_8_f32_type,
36579+
.vector_16_f32_type,
3657736580
.vector_2_f64_type,
3657836581
.vector_4_f64_type,
36582+
.vector_8_f64_type,
3657936583
.anyerror_void_error_union_type,
3658036584
=> null,
3658136585
.void_type => Value.void,

src/Type.zig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4136,11 +4136,15 @@ pub const vector_2_u128: Type = .{ .ip_index = .vector_2_u128_type };
41364136
pub const vector_1_u256: Type = .{ .ip_index = .vector_1_u256_type };
41374137
pub const vector_4_f16: Type = .{ .ip_index = .vector_4_f16_type };
41384138
pub const vector_8_f16: Type = .{ .ip_index = .vector_8_f16_type };
4139+
pub const vector_16_f16: Type = .{ .ip_index = .vector_16_f16_type };
4140+
pub const vector_32_f16: Type = .{ .ip_index = .vector_32_f16_type };
41394141
pub const vector_2_f32: Type = .{ .ip_index = .vector_2_f32_type };
41404142
pub const vector_4_f32: Type = .{ .ip_index = .vector_4_f32_type };
41414143
pub const vector_8_f32: Type = .{ .ip_index = .vector_8_f32_type };
4144+
pub const vector_16_f32: Type = .{ .ip_index = .vector_16_f32_type };
41424145
pub const vector_2_f64: Type = .{ .ip_index = .vector_2_f64_type };
41434146
pub const vector_4_f64: Type = .{ .ip_index = .vector_4_f64_type };
4147+
pub const vector_8_f64: Type = .{ .ip_index = .vector_8_f64_type };
41444148

41454149
pub const empty_tuple: Type = .{ .ip_index = .empty_tuple_type };
41464150

0 commit comments

Comments
 (0)