Merge pull request #23209 from jacobly0/x86_64-rewrite

x86_64: rewrite wrapping multiplication
This commit is contained in:
Jacob Young
2025-03-23 21:56:58 -04:00
committed by GitHub
23 changed files with 26211 additions and 22326 deletions

View File

@@ -8175,7 +8175,7 @@ fn formatIntLiteral(
try writer.writeAll(string);
} else {
try data.ctype.renderLiteralPrefix(writer, data.kind, ctype_pool);
wrap.convertToTwosComplement(int, data.int_info.signedness, c_bits);
wrap.truncate(int, .unsigned, c_bits);
@memset(wrap.limbs[wrap.len..], 0);
wrap.len = wrap.limbs.len;
const limbs_per_c_limb = @divExact(wrap.len, c_limb_info.count);
@@ -8207,7 +8207,6 @@ fn formatIntLiteral(
c_limb_int_info.signedness = .signed;
c_limb_ctype = c_limb_info.ctype.toSigned();
c_limb_mut.positive = wrap.positive;
c_limb_mut.truncate(
c_limb_mut.toConst(),
.signed,

View File

@@ -1474,6 +1474,66 @@ pub const Pool = struct {
};
return pool.fromFields(allocator, .@"struct", &fields, kind);
},
.vector_1_u8_type => {
const vector_ctype = try pool.getVector(allocator, .{
.elem_ctype = .u8,
.len = 1,
});
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_u8_type => {
const vector_ctype = try pool.getVector(allocator, .{
.elem_ctype = .u8,
.len = 2,
});
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_u8_type => {
const vector_ctype = try pool.getVector(allocator, .{
.elem_ctype = .u8,
.len = 4,
});
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_8_u8_type => {
const vector_ctype = try pool.getVector(allocator, .{
.elem_ctype = .u8,
.len = 8,
});
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_16_u8_type => {
const vector_ctype = try pool.getVector(allocator, .{
.elem_ctype = .u8,