aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/c
diff options
context:
space:
mode:
authorJacob Young <15544577+jacobly0@users.noreply.github.com>2025-05-28 21:37:02 -0400
committerGitHub <noreply@github.com>2025-05-28 21:37:02 -0400
commitf25212a479c4f26566b6b851e245e49c6f508b96 (patch)
tree2c6a1420d007f4fffbb15a12e1ae7363da35f52d /src/codegen/c
parent4f3b59f708058ce4e4b6a1cacd2a3dae6e1c7aae (diff)
parent9f9e7e398f045c08a6652920af741c9f6569689e (diff)
downloadzig-f25212a479c4f26566b6b851e245e49c6f508b96.tar.gz
zig-f25212a479c4f26566b6b851e245e49c6f508b96.zip
Merge pull request #23924 from jacobly0/x86_64-rewrite
x86_64: implement reduce
Diffstat (limited to 'src/codegen/c')
-rw-r--r--src/codegen/c/Type.zig247
1 files changed, 247 insertions, 0 deletions
diff --git a/src/codegen/c/Type.zig b/src/codegen/c/Type.zig
index 98edeb54a6..7d3a485e2a 100644
--- a/src/codegen/c/Type.zig
+++ b/src/codegen/c/Type.zig
@@ -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 },
@@ -1488,6 +1492,21 @@ pub const Pool = struct {
};
return pool.fromFields(allocator, .@"struct", &fields, kind);
},
+ .vector_64_i8_type => {
+ const vector_ctype = try pool.getVector(allocator, .{
+ .elem_ctype = .i8,
+ .len = 64,
+ });
+ if (!kind.isParameter()) return vector_ctype;
+ var fields = [_]Info.Field{
+ .{
+ .name = .{ .index = .array },
+ .ctype = vector_ctype,
+ .alignas = AlignAs.fromAbiAlignment(Type.i8.abiAlignment(zcu)),
+ },
+ };
+ return pool.fromFields(allocator, .@"struct", &fields, kind);
+ },
.vector_1_u8_type => {
const vector_ctype = try pool.getVector(allocator, .{
.elem_ctype = .u8,
@@ -1578,6 +1597,36 @@ 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_2_i16_type => {
+ const vector_ctype = try pool.getVector(allocator, .{
+ .elem_ctype = .i16,
+ .len = 2,
+ });
+ if (!kind.isParameter()) return vector_ctype;
+ var fields = [_]Info.Field{
+ .{
+ .name = .{ .index = .array },
+ .ctype = vector_ctype,
+ .alignas = AlignAs.fromAbiAlignment(Type.i16.abiAlignment(zcu)),
+ },
+ };
+ return pool.fromFields(allocator, .@"struct", &fields, kind);
+ },
.vector_4_i16_type => {
const vector_ctype = try pool.getVector(allocator, .{
.elem_ctype = .i16,
@@ -1623,6 +1672,21 @@ pub const Pool = struct {
};
return pool.fromFields(allocator, .@"struct", &fields, kind);
},
+ .vector_32_i16_type => {
+ const vector_ctype = try pool.getVector(allocator, .{
+ .elem_ctype = .i16,
+ .len = 32,
+ });
+ if (!kind.isParameter()) return vector_ctype;
+ var fields = [_]Info.Field{
+ .{
+ .name = .{ .index = .array },
+ .ctype = vector_ctype,
+ .alignas = AlignAs.fromAbiAlignment(Type.i16.abiAlignment(zcu)),
+ },
+ };
+ return pool.fromFields(allocator, .@"struct", &fields, kind);
+ },
.vector_4_u16_type => {
const vector_ctype = try pool.getVector(allocator, .{
.elem_ctype = .u16,
@@ -1668,6 +1732,36 @@ pub const Pool = struct {
};
return pool.fromFields(allocator, .@"struct", &fields, kind);
},
+ .vector_32_u16_type => {
+ const vector_ctype = try pool.getVector(allocator, .{
+ .elem_ctype = .u16,
+ .len = 32,
+ });
+ if (!kind.isParameter()) return vector_ctype;
+ var fields = [_]Info.Field{
+ .{
+ .name = .{ .index = .array },
+ .ctype = vector_ctype,
+ .alignas = AlignAs.fromAbiAlignment(Type.u16.abiAlignment(zcu)),
+ },
+ };
+ return pool.fromFields(allocator, .@"struct", &fields, kind);
+ },
+ .vector_2_i32_type => {
+ const vector_ctype = try pool.getVector(allocator, .{
+ .elem_ctype = .i32,
+ .len = 2,
+ });
+ if (!kind.isParameter()) return vector_ctype;
+ var fields = [_]Info.Field{
+ .{
+ .name = .{ .index = .array },
+ .ctype = vector_ctype,
+ .alignas = AlignAs.fromAbiAlignment(Type.i32.abiAlignment(zcu)),
+ },
+ };
+ return pool.fromFields(allocator, .@"struct", &fields, kind);
+ },
.vector_4_i32_type => {
const vector_ctype = try pool.getVector(allocator, .{
.elem_ctype = .i32,
@@ -1698,6 +1792,21 @@ pub const Pool = struct {
};
return pool.fromFields(allocator, .@"struct", &fields, kind);
},
+ .vector_16_i32_type => {
+ const vector_ctype = try pool.getVector(allocator, .{
+ .elem_ctype = .i32,
+ .len = 16,
+ });
+ if (!kind.isParameter()) return vector_ctype;
+ var fields = [_]Info.Field{
+ .{
+ .name = .{ .index = .array },
+ .ctype = vector_ctype,
+ .alignas = AlignAs.fromAbiAlignment(Type.i32.abiAlignment(zcu)),
+ },
+ };
+ return pool.fromFields(allocator, .@"struct", &fields, kind);
+ },
.vector_4_u32_type => {
const vector_ctype = try pool.getVector(allocator, .{
.elem_ctype = .u32,
@@ -1728,6 +1837,21 @@ pub const Pool = struct {
};
return pool.fromFields(allocator, .@"struct", &fields, kind);
},
+ .vector_16_u32_type => {
+ const vector_ctype = try pool.getVector(allocator, .{
+ .elem_ctype = .u32,
+ .len = 16,
+ });
+ if (!kind.isParameter()) return vector_ctype;
+ var fields = [_]Info.Field{
+ .{
+ .name = .{ .index = .array },
+ .ctype = vector_ctype,
+ .alignas = AlignAs.fromAbiAlignment(Type.u32.abiAlignment(zcu)),
+ },
+ };
+ return pool.fromFields(allocator, .@"struct", &fields, kind);
+ },
.vector_2_i64_type => {
const vector_ctype = try pool.getVector(allocator, .{
.elem_ctype = .i64,
@@ -1758,6 +1882,21 @@ pub const Pool = struct {
};
return pool.fromFields(allocator, .@"struct", &fields, kind);
},
+ .vector_8_i64_type => {
+ const vector_ctype = try pool.getVector(allocator, .{
+ .elem_ctype = .i64,
+ .len = 8,
+ });
+ if (!kind.isParameter()) return vector_ctype;
+ var fields = [_]Info.Field{
+ .{
+ .name = .{ .index = .array },
+ .ctype = vector_ctype,
+ .alignas = AlignAs.fromAbiAlignment(Type.i64.abiAlignment(zcu)),
+ },
+ };
+ return pool.fromFields(allocator, .@"struct", &fields, kind);
+ },
.vector_2_u64_type => {
const vector_ctype = try pool.getVector(allocator, .{
.elem_ctype = .u64,
@@ -1788,6 +1927,36 @@ pub const Pool = struct {
};
return pool.fromFields(allocator, .@"struct", &fields, kind);
},
+ .vector_8_u64_type => {
+ const vector_ctype = try pool.getVector(allocator, .{
+ .elem_ctype = .u64,
+ .len = 8,
+ });
+ if (!kind.isParameter()) return vector_ctype;
+ var fields = [_]Info.Field{
+ .{
+ .name = .{ .index = .array },
+ .ctype = vector_ctype,
+ .alignas = AlignAs.fromAbiAlignment(Type.u64.abiAlignment(zcu)),
+ },
+ };
+ 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 +1972,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,
@@ -1833,6 +2020,36 @@ pub const Pool = struct {
};
return pool.fromFields(allocator, .@"struct", &fields, kind);
},
+ .vector_16_f16_type => {
+ const vector_ctype = try pool.getVector(allocator, .{
+ .elem_ctype = .f16,
+ .len = 16,
+ });
+ if (!kind.isParameter()) return vector_ctype;
+ var fields = [_]Info.Field{
+ .{
+ .name = .{ .index = .array },
+ .ctype = vector_ctype,
+ .alignas = AlignAs.fromAbiAlignment(Type.f16.abiAlignment(zcu)),
+ },
+ };
+ return pool.fromFields(allocator, .@"struct", &fields, kind);
+ },
+ .vector_32_f16_type => {
+ const vector_ctype = try pool.getVector(allocator, .{
+ .elem_ctype = .f16,
+ .len = 32,
+ });
+ if (!kind.isParameter()) return vector_ctype;
+ var fields = [_]Info.Field{
+ .{
+ .name = .{ .index = .array },
+ .ctype = vector_ctype,
+ .alignas = AlignAs.fromAbiAlignment(Type.f16.abiAlignment(zcu)),
+ },
+ };
+ return pool.fromFields(allocator, .@"struct", &fields, kind);
+ },
.vector_2_f32_type => {
const vector_ctype = try pool.getVector(allocator, .{
.elem_ctype = .f32,
@@ -1878,6 +2095,21 @@ pub const Pool = struct {
};
return pool.fromFields(allocator, .@"struct", &fields, kind);
},
+ .vector_16_f32_type => {
+ const vector_ctype = try pool.getVector(allocator, .{
+ .elem_ctype = .f32,
+ .len = 16,
+ });
+ if (!kind.isParameter()) return vector_ctype;
+ var fields = [_]Info.Field{
+ .{
+ .name = .{ .index = .array },
+ .ctype = vector_ctype,
+ .alignas = AlignAs.fromAbiAlignment(Type.f32.abiAlignment(zcu)),
+ },
+ };
+ return pool.fromFields(allocator, .@"struct", &fields, kind);
+ },
.vector_2_f64_type => {
const vector_ctype = try pool.getVector(allocator, .{
.elem_ctype = .f64,
@@ -1908,6 +2140,21 @@ pub const Pool = struct {
};
return pool.fromFields(allocator, .@"struct", &fields, kind);
},
+ .vector_8_f64_type => {
+ const vector_ctype = try pool.getVector(allocator, .{
+ .elem_ctype = .f64,
+ .len = 8,
+ });
+ if (!kind.isParameter()) return vector_ctype;
+ var fields = [_]Info.Field{
+ .{
+ .name = .{ .index = .array },
+ .ctype = vector_ctype,
+ .alignas = AlignAs.fromAbiAlignment(Type.f64.abiAlignment(zcu)),
+ },
+ };
+ return pool.fromFields(allocator, .@"struct", &fields, kind);
+ },
.undef,
.zero,