mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
x86_64: delete usages of avx2 vpack?s??
This instruction actually has fairly useless semantics, and even the cases that were semantically correct could save 1 cycle of latency by using a different sequnce involving the avx version instead. Closes #25174
This commit is contained in:
parent
1a0a9d7d59
commit
e313b387a0
2 changed files with 323 additions and 55 deletions
|
|
@ -22283,8 +22283,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
|
|||
.{ ._, .vp_w, .movsxb, .dst0y, .src0x, ._, ._ },
|
||||
.{ ._, .vp_w, .movsxb, .tmp0y, .src1x, ._, ._ },
|
||||
.{ ._, .vp_w, .mull, .dst0y, .dst0y, .tmp0y, ._ },
|
||||
.{ ._, .vp_b, .ackssw, .dst0y, .dst0y, .dst0y, ._ },
|
||||
.{ ._, .v_q, .perm, .dst0y, .dst0y, .ui(0b10_00_10_00), ._ },
|
||||
.{ ._, .v_i128, .extract, .tmp0x, .dst0y, .ui(1), ._ },
|
||||
.{ ._, .vp_b, .ackssw, .dst0x, .dst0x, .tmp0x, ._ },
|
||||
} },
|
||||
}, .{
|
||||
.required_features = .{ .avx, null, null, null },
|
||||
|
|
@ -22414,8 +22414,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
|
|||
.{ ._, .vp_w, .movzxb, .dst0y, .src0x, ._, ._ },
|
||||
.{ ._, .vp_w, .movzxb, .tmp0y, .src1x, ._, ._ },
|
||||
.{ ._, .vp_w, .mull, .dst0y, .dst0y, .tmp0y, ._ },
|
||||
.{ ._, .vp_b, .ackusw, .dst0y, .dst0y, .dst0y, ._ },
|
||||
.{ ._, .v_q, .perm, .dst0y, .dst0y, .ui(0b10_00_10_00), ._ },
|
||||
.{ ._, .v_i128, .extract, .tmp0x, .dst0y, .ui(1), ._ },
|
||||
.{ ._, .vp_b, .ackusw, .dst0x, .dst0x, .tmp0x, ._ },
|
||||
} },
|
||||
}, .{
|
||||
.required_features = .{ .avx2, null, null, null },
|
||||
|
|
@ -22447,8 +22447,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
|
|||
.{ .@"0:", .vp_w, .movsxb, .tmp1y, .memia(.src0x, .tmp0, .add_unaligned_size), ._, ._ },
|
||||
.{ ._, .vp_w, .movsxb, .tmp2y, .memia(.src1x, .tmp0, .add_unaligned_size), ._, ._ },
|
||||
.{ ._, .vp_w, .mull, .tmp1y, .tmp1y, .tmp2y, ._ },
|
||||
.{ ._, .vp_b, .ackssw, .tmp1y, .tmp1y, .tmp1y, ._ },
|
||||
.{ ._, .v_q, .perm, .tmp1y, .tmp1y, .ui(0b10_00_10_00), ._ },
|
||||
.{ ._, .v_i128, .extract, .tmp2x, .tmp1y, .ui(1), ._ },
|
||||
.{ ._, .vp_b, .ackssw, .tmp1x, .tmp1x, .tmp2x, ._ },
|
||||
.{ ._, .v_dqa, .mov, .memia(.dst0x, .tmp0, .add_unaligned_size), .tmp1x, ._, ._ },
|
||||
.{ ._, ._, .add, .tmp0p, .si(16), ._, ._ },
|
||||
.{ ._, ._nc, .j, .@"0b", ._, ._, ._ },
|
||||
|
|
@ -22659,8 +22659,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
|
|||
.{ .@"0:", .vp_w, .movzxb, .tmp1y, .memia(.src0x, .tmp0, .add_unaligned_size), ._, ._ },
|
||||
.{ ._, .vp_w, .movzxb, .tmp2y, .memia(.src1x, .tmp0, .add_unaligned_size), ._, ._ },
|
||||
.{ ._, .vp_w, .mull, .tmp1y, .tmp1y, .tmp2y, ._ },
|
||||
.{ ._, .vp_b, .ackusw, .tmp1y, .tmp1y, .tmp1y, ._ },
|
||||
.{ ._, .v_q, .perm, .tmp1y, .tmp1y, .ui(0b10_00_10_00), ._ },
|
||||
.{ ._, .v_i128, .extract, .tmp2x, .tmp1y, .ui(1), ._ },
|
||||
.{ ._, .vp_b, .ackusw, .tmp1x, .tmp1x, .tmp2x, ._ },
|
||||
.{ ._, .v_dqa, .mov, .memia(.dst0x, .tmp0, .add_unaligned_size), .tmp1x, ._, ._ },
|
||||
.{ ._, ._, .add, .tmp0p, .si(16), ._, ._ },
|
||||
.{ ._, ._nc, .j, .@"0b", ._, ._, ._ },
|
||||
|
|
@ -82559,7 +82559,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
|
|||
.{ .type = .u32, .kind = .{ .rc = .general_purpose } },
|
||||
.{ .type = .u16, .kind = .{ .rc = .general_purpose } },
|
||||
.{ .kind = .{ .rc = .sse } },
|
||||
.unused,
|
||||
.{ .kind = .{ .rc = .sse } },
|
||||
.unused,
|
||||
.unused,
|
||||
.unused,
|
||||
|
|
@ -82576,8 +82576,9 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
|
|||
.{ ._, ._, .xor, .tmp1d, .tmp1d, ._, ._ },
|
||||
.{ .@"0:", .v_dqu, .mov, .tmp3y, .memia(.src0y, .tmp0, .add_size), ._, ._ },
|
||||
.{ ._, .vp_w, .cmpeq, .tmp3y, .tmp3y, .memia(.src1y, .tmp0, .add_size), ._ },
|
||||
.{ ._, .vp_b, .ackssw, .tmp3y, .tmp3y, .tmp3y, ._ },
|
||||
.{ ._, .vp_b, .movmsk, .tmp2d, .tmp3y, ._, ._ },
|
||||
.{ ._, .v_i128, .extract, .tmp4x, .tmp3y, .ui(1), ._ },
|
||||
.{ ._, .vp_b, .ackssw, .tmp3x, .tmp3x, .tmp4x, ._ },
|
||||
.{ ._, .vp_b, .movmsk, .tmp2d, .tmp3x, ._, ._ },
|
||||
.{ ._, ._, .mov, .memi(.dst0w, .tmp1), .tmp2w, ._, ._ },
|
||||
.{ ._, ._, .lea, .tmp1d, .lead(.tmp1, 2), ._, ._ },
|
||||
.{ ._, ._, .add, .tmp0p, .si(32), ._, ._ },
|
||||
|
|
@ -82588,8 +82589,9 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
|
|||
.{ ._, ._, .xor, .tmp1d, .tmp1d, ._, ._ },
|
||||
.{ .@"0:", .v_dqu, .mov, .tmp3y, .memia(.src0y, .tmp0, .add_size), ._, ._ },
|
||||
.{ ._, .vp_w, .cmpeq, .tmp3y, .tmp3y, .memia(.src1y, .tmp0, .add_size), ._ },
|
||||
.{ ._, .vp_b, .ackssw, .tmp3y, .tmp3y, .tmp3y, ._ },
|
||||
.{ ._, .vp_b, .movmsk, .tmp2d, .tmp3y, ._, ._ },
|
||||
.{ ._, .v_i128, .extract, .tmp4x, .tmp3y, .ui(1), ._ },
|
||||
.{ ._, .vp_b, .ackssw, .tmp3x, .tmp3x, .tmp4x, ._ },
|
||||
.{ ._, .vp_b, .movmsk, .tmp2d, .tmp3x, ._, ._ },
|
||||
.{ ._, ._, .not, .tmp2d, ._, ._, ._ },
|
||||
.{ ._, ._, .mov, .memi(.dst0w, .tmp1), .tmp2w, ._, ._ },
|
||||
.{ ._, ._, .lea, .tmp1d, .lead(.tmp1, 2), ._, ._ },
|
||||
|
|
@ -90324,7 +90326,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
|
|||
}, .{
|
||||
.required_features = .{ .avx, null, null, null },
|
||||
.src_constraints = .{ .{ .scalar_int = .{ .of = .xword, .is = .word } }, .any, .any },
|
||||
.dst_constraints = .{ .{ .scalar_int = .{ .of = .qword, .is = .byte } }, .any },
|
||||
.dst_constraints = .{ .{ .scalar_unsigned_int = .{ .of = .qword, .is = .byte } }, .any },
|
||||
.patterns = &.{
|
||||
.{ .src = .{ .to_sse, .none, .none } },
|
||||
},
|
||||
|
|
@ -90346,7 +90348,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
|
|||
}, .{
|
||||
.required_features = .{ .sse2, null, null, null },
|
||||
.src_constraints = .{ .{ .scalar_int = .{ .of = .xword, .is = .word } }, .any, .any },
|
||||
.dst_constraints = .{ .{ .scalar_int = .{ .of = .qword, .is = .byte } }, .any },
|
||||
.dst_constraints = .{ .{ .scalar_unsigned_int = .{ .of = .qword, .is = .byte } }, .any },
|
||||
.patterns = &.{
|
||||
.{ .src = .{ .to_mut_sse, .none, .none } },
|
||||
},
|
||||
|
|
@ -90361,20 +90363,46 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
|
|||
.patterns = &.{
|
||||
.{ .src = .{ .to_sse, .none, .none } },
|
||||
},
|
||||
.dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .sse } }, .unused },
|
||||
.dst_temps = .{ .{ .rc = .sse }, .unused },
|
||||
.each = .{ .once = &.{
|
||||
.{ ._, .vp_b, .ackssw, .dst0y, .src0y, .dst0y, ._ },
|
||||
.{ ._, .v_i128, .extract, .dst0x, .src0y, .ui(1), ._ },
|
||||
.{ ._, .vp_b, .ackssw, .dst0x, .src0x, .dst0x, ._ },
|
||||
} },
|
||||
}, .{
|
||||
.required_features = .{ .avx, null, null, null },
|
||||
.src_constraints = .{ .{ .scalar_int = .{ .of = .yword, .is = .word } }, .any, .any },
|
||||
.dst_constraints = .{ .{ .scalar_signed_int = .{ .of = .xword, .is = .byte } }, .any },
|
||||
.patterns = &.{
|
||||
.{ .src = .{ .to_sse, .none, .none } },
|
||||
},
|
||||
.dst_temps = .{ .{ .rc = .sse }, .unused },
|
||||
.each = .{ .once = &.{
|
||||
.{ ._, .v_f128, .extract, .dst0x, .src0y, .ui(1), ._ },
|
||||
.{ ._, .vp_b, .ackssw, .dst0x, .src0x, .dst0x, ._ },
|
||||
} },
|
||||
}, .{
|
||||
.required_features = .{ .avx2, null, null, null },
|
||||
.src_constraints = .{ .{ .scalar_int = .{ .of = .yword, .is = .word } }, .any, .any },
|
||||
.dst_constraints = .{ .{ .scalar_int = .{ .of = .xword, .is = .byte } }, .any },
|
||||
.dst_constraints = .{ .{ .scalar_unsigned_int = .{ .of = .xword, .is = .byte } }, .any },
|
||||
.patterns = &.{
|
||||
.{ .src = .{ .to_sse, .none, .none } },
|
||||
},
|
||||
.dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .sse } }, .unused },
|
||||
.dst_temps = .{ .{ .rc = .sse }, .unused },
|
||||
.each = .{ .once = &.{
|
||||
.{ ._, .vp_b, .ackusw, .dst0y, .src0y, .dst0y, ._ },
|
||||
.{ ._, .v_i128, .extract, .dst0x, .src0y, .ui(1), ._ },
|
||||
.{ ._, .vp_b, .ackusw, .dst0x, .src0x, .dst0x, ._ },
|
||||
} },
|
||||
}, .{
|
||||
.required_features = .{ .avx, null, null, null },
|
||||
.src_constraints = .{ .{ .scalar_int = .{ .of = .yword, .is = .word } }, .any, .any },
|
||||
.dst_constraints = .{ .{ .scalar_unsigned_int = .{ .of = .xword, .is = .byte } }, .any },
|
||||
.patterns = &.{
|
||||
.{ .src = .{ .to_sse, .none, .none } },
|
||||
},
|
||||
.dst_temps = .{ .{ .rc = .sse }, .unused },
|
||||
.each = .{ .once = &.{
|
||||
.{ ._, .v_f128, .extract, .dst0x, .src0y, .ui(1), ._ },
|
||||
.{ ._, .vp_b, .ackusw, .dst0x, .src0x, .dst0x, ._ },
|
||||
} },
|
||||
}, .{
|
||||
.required_features = .{ .slow_incdec, null, null, null },
|
||||
|
|
@ -90448,7 +90476,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
|
|||
}, .{
|
||||
.required_features = .{ .avx, null, null, null },
|
||||
.src_constraints = .{ .{ .scalar_int = .{ .of = .xword, .is = .dword } }, .any, .any },
|
||||
.dst_constraints = .{ .{ .scalar_int = .{ .of = .dword, .is = .byte } }, .any },
|
||||
.dst_constraints = .{ .{ .scalar_unsigned_int = .{ .of = .dword, .is = .byte } }, .any },
|
||||
.patterns = &.{
|
||||
.{ .src = .{ .to_sse, .none, .none } },
|
||||
},
|
||||
|
|
@ -90472,7 +90500,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
|
|||
}, .{
|
||||
.required_features = .{ .sse4_1, null, null, null },
|
||||
.src_constraints = .{ .{ .scalar_int = .{ .of = .xword, .is = .dword } }, .any, .any },
|
||||
.dst_constraints = .{ .{ .scalar_int = .{ .of = .dword, .is = .byte } }, .any },
|
||||
.dst_constraints = .{ .{ .scalar_unsigned_int = .{ .of = .dword, .is = .byte } }, .any },
|
||||
.patterns = &.{
|
||||
.{ .src = .{ .to_mut_sse, .none, .none } },
|
||||
},
|
||||
|
|
@ -90488,22 +90516,50 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
|
|||
.patterns = &.{
|
||||
.{ .src = .{ .to_sse, .none, .none } },
|
||||
},
|
||||
.dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .sse } }, .unused },
|
||||
.dst_temps = .{ .{ .rc = .sse }, .unused },
|
||||
.each = .{ .once = &.{
|
||||
.{ ._, .vp_w, .ackssd, .dst0y, .src0y, .dst0y, ._ },
|
||||
.{ ._, .vp_b, .ackssw, .dst0y, .dst0y, .dst0y, ._ },
|
||||
.{ ._, .v_i128, .extract, .dst0x, .src0y, .ui(1), ._ },
|
||||
.{ ._, .vp_w, .ackssd, .dst0x, .src0x, .dst0x, ._ },
|
||||
.{ ._, .vp_b, .ackssw, .dst0x, .dst0x, .dst0x, ._ },
|
||||
} },
|
||||
}, .{
|
||||
.required_features = .{ .avx, null, null, null },
|
||||
.src_constraints = .{ .{ .scalar_int = .{ .of = .yword, .is = .dword } }, .any, .any },
|
||||
.dst_constraints = .{ .{ .scalar_signed_int = .{ .of = .qword, .is = .byte } }, .any },
|
||||
.patterns = &.{
|
||||
.{ .src = .{ .to_sse, .none, .none } },
|
||||
},
|
||||
.dst_temps = .{ .{ .rc = .sse }, .unused },
|
||||
.each = .{ .once = &.{
|
||||
.{ ._, .v_f128, .extract, .dst0x, .src0y, .ui(1), ._ },
|
||||
.{ ._, .vp_w, .ackssd, .dst0x, .src0x, .dst0x, ._ },
|
||||
.{ ._, .vp_b, .ackssw, .dst0x, .dst0x, .dst0x, ._ },
|
||||
} },
|
||||
}, .{
|
||||
.required_features = .{ .avx2, null, null, null },
|
||||
.src_constraints = .{ .{ .scalar_int = .{ .of = .yword, .is = .dword } }, .any, .any },
|
||||
.dst_constraints = .{ .{ .scalar_int = .{ .of = .qword, .is = .byte } }, .any },
|
||||
.dst_constraints = .{ .{ .scalar_unsigned_int = .{ .of = .qword, .is = .byte } }, .any },
|
||||
.patterns = &.{
|
||||
.{ .src = .{ .to_sse, .none, .none } },
|
||||
},
|
||||
.dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .sse } }, .unused },
|
||||
.dst_temps = .{ .{ .rc = .sse }, .unused },
|
||||
.each = .{ .once = &.{
|
||||
.{ ._, .vp_w, .ackusd, .dst0y, .src0y, .dst0y, ._ },
|
||||
.{ ._, .vp_b, .ackusw, .dst0y, .dst0y, .dst0y, ._ },
|
||||
.{ ._, .v_i128, .extract, .dst0x, .src0y, .ui(1), ._ },
|
||||
.{ ._, .vp_w, .ackusd, .dst0x, .src0x, .dst0x, ._ },
|
||||
.{ ._, .vp_b, .ackusw, .dst0x, .dst0x, .dst0x, ._ },
|
||||
} },
|
||||
}, .{
|
||||
.required_features = .{ .avx, null, null, null },
|
||||
.src_constraints = .{ .{ .scalar_int = .{ .of = .yword, .is = .dword } }, .any, .any },
|
||||
.dst_constraints = .{ .{ .scalar_unsigned_int = .{ .of = .qword, .is = .byte } }, .any },
|
||||
.patterns = &.{
|
||||
.{ .src = .{ .to_sse, .none, .none } },
|
||||
},
|
||||
.dst_temps = .{ .{ .rc = .sse }, .unused },
|
||||
.each = .{ .once = &.{
|
||||
.{ ._, .v_f128, .extract, .dst0x, .src0y, .ui(1), ._ },
|
||||
.{ ._, .vp_w, .ackusd, .dst0x, .src0x, .dst0x, ._ },
|
||||
.{ ._, .vp_b, .ackusw, .dst0x, .dst0x, .dst0x, ._ },
|
||||
} },
|
||||
}, .{
|
||||
.required_features = .{ .slow_incdec, null, null, null },
|
||||
|
|
@ -90722,7 +90778,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
|
|||
}, .{
|
||||
.required_features = .{ .avx, null, null, null },
|
||||
.src_constraints = .{ .{ .scalar_int = .{ .of = .xword, .is = .dword } }, .any, .any },
|
||||
.dst_constraints = .{ .{ .scalar_int = .{ .of = .qword, .is = .word } }, .any },
|
||||
.dst_constraints = .{ .{ .scalar_unsigned_int = .{ .of = .qword, .is = .word } }, .any },
|
||||
.patterns = &.{
|
||||
.{ .src = .{ .to_sse, .none, .none } },
|
||||
},
|
||||
|
|
@ -90744,7 +90800,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
|
|||
}, .{
|
||||
.required_features = .{ .sse4_1, null, null, null },
|
||||
.src_constraints = .{ .{ .scalar_int = .{ .of = .xword, .is = .dword } }, .any, .any },
|
||||
.dst_constraints = .{ .{ .scalar_int = .{ .of = .qword, .is = .word } }, .any },
|
||||
.dst_constraints = .{ .{ .scalar_unsigned_int = .{ .of = .qword, .is = .word } }, .any },
|
||||
.patterns = &.{
|
||||
.{ .src = .{ .to_mut_sse, .none, .none } },
|
||||
},
|
||||
|
|
@ -90759,20 +90815,46 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
|
|||
.patterns = &.{
|
||||
.{ .src = .{ .to_sse, .none, .none } },
|
||||
},
|
||||
.dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .sse } }, .unused },
|
||||
.dst_temps = .{ .{ .rc = .sse }, .unused },
|
||||
.each = .{ .once = &.{
|
||||
.{ ._, .vp_w, .ackssd, .dst0y, .src0y, .dst0y, ._ },
|
||||
.{ ._, .v_i128, .extract, .dst0x, .src0y, .ui(1), ._ },
|
||||
.{ ._, .vp_w, .ackssd, .dst0x, .src0x, .dst0x, ._ },
|
||||
} },
|
||||
}, .{
|
||||
.required_features = .{ .avx, null, null, null },
|
||||
.src_constraints = .{ .{ .scalar_int = .{ .of = .yword, .is = .dword } }, .any, .any },
|
||||
.dst_constraints = .{ .{ .scalar_signed_int = .{ .of = .xword, .is = .word } }, .any },
|
||||
.patterns = &.{
|
||||
.{ .src = .{ .to_sse, .none, .none } },
|
||||
},
|
||||
.dst_temps = .{ .{ .rc = .sse }, .unused },
|
||||
.each = .{ .once = &.{
|
||||
.{ ._, .v_f128, .extract, .dst0x, .src0y, .ui(1), ._ },
|
||||
.{ ._, .vp_w, .ackssd, .dst0x, .src0x, .dst0x, ._ },
|
||||
} },
|
||||
}, .{
|
||||
.required_features = .{ .avx2, null, null, null },
|
||||
.src_constraints = .{ .{ .scalar_int = .{ .of = .yword, .is = .dword } }, .any, .any },
|
||||
.dst_constraints = .{ .{ .scalar_int = .{ .of = .xword, .is = .word } }, .any },
|
||||
.dst_constraints = .{ .{ .scalar_unsigned_int = .{ .of = .xword, .is = .word } }, .any },
|
||||
.patterns = &.{
|
||||
.{ .src = .{ .to_sse, .none, .none } },
|
||||
},
|
||||
.dst_temps = .{ .{ .mut_rc = .{ .ref = .src0, .rc = .sse } }, .unused },
|
||||
.dst_temps = .{ .{ .rc = .sse }, .unused },
|
||||
.each = .{ .once = &.{
|
||||
.{ ._, .vp_w, .ackusd, .dst0y, .src0y, .dst0y, ._ },
|
||||
.{ ._, .v_i128, .extract, .dst0x, .src0y, .ui(1), ._ },
|
||||
.{ ._, .vp_w, .ackusd, .dst0x, .src0x, .dst0x, ._ },
|
||||
} },
|
||||
}, .{
|
||||
.required_features = .{ .avx, null, null, null },
|
||||
.src_constraints = .{ .{ .scalar_int = .{ .of = .yword, .is = .dword } }, .any, .any },
|
||||
.dst_constraints = .{ .{ .scalar_unsigned_int = .{ .of = .xword, .is = .word } }, .any },
|
||||
.patterns = &.{
|
||||
.{ .src = .{ .to_sse, .none, .none } },
|
||||
},
|
||||
.dst_temps = .{ .{ .rc = .sse }, .unused },
|
||||
.each = .{ .once = &.{
|
||||
.{ ._, .v_f128, .extract, .dst0x, .src0y, .ui(1), ._ },
|
||||
.{ ._, .vp_w, .ackusd, .dst0x, .src0x, .dst0x, ._ },
|
||||
} },
|
||||
}, .{
|
||||
.src_constraints = .{ .{ .multiple_scalar_int = .{ .of = .dword, .is = .dword } }, .any, .any },
|
||||
|
|
@ -92413,7 +92495,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
|
|||
.clobbers = .{ .eflags = true },
|
||||
.each = .{ .once = &.{
|
||||
.{ ._, ._, .mov, .tmp0p, .sa(.src0, .sub_unaligned_size), ._, ._ },
|
||||
.{ .@"0:", .vp_d, .movzxb, .tmp1y, .memia(.src0x, .tmp0, .add_unaligned_size), ._, ._ },
|
||||
.{ .@"0:", .vp_d, .movzxb, .tmp1y, .memia(.src0q, .tmp0, .add_unaligned_size), ._, ._ },
|
||||
.{ ._, .v_dqa, .mov, .memsia(.dst0y, .@"4", .tmp0, .add_unaligned_size), .tmp1y, ._, ._ },
|
||||
.{ ._, ._, .add, .tmp0p, .si(8), ._, ._ },
|
||||
.{ ._, ._nc, .j, .@"0b", ._, ._, ._ },
|
||||
|
|
|
|||
|
|
@ -607,26 +607,212 @@ test "@intCast on vector" {
|
|||
|
||||
const S = struct {
|
||||
fn doTheTest() !void {
|
||||
// Upcast (implicit, equivalent to @intCast)
|
||||
var up0: @Vector(2, u8) = [_]u8{ 0x55, 0xaa };
|
||||
_ = &up0;
|
||||
const up1: @Vector(2, u16) = up0;
|
||||
const up2: @Vector(2, u32) = up0;
|
||||
const up3: @Vector(2, u64) = up0;
|
||||
// Downcast (safety-checked)
|
||||
var down0 = up3;
|
||||
_ = &down0;
|
||||
const down1: @Vector(2, u32) = @intCast(down0);
|
||||
const down2: @Vector(2, u16) = @intCast(down0);
|
||||
const down3: @Vector(2, u8) = @intCast(down0);
|
||||
{
|
||||
// Upcast (implicit, equivalent to @intCast)
|
||||
var up0: @Vector(2, u8) = .{ 0x55, 0xaa };
|
||||
_ = &up0;
|
||||
const up1: @Vector(2, u16) = up0;
|
||||
const up2: @Vector(2, u32) = up0;
|
||||
const up3: @Vector(2, u64) = up0;
|
||||
|
||||
try expect(mem.eql(u16, &@as([2]u16, up1), &[2]u16{ 0x55, 0xaa }));
|
||||
try expect(mem.eql(u32, &@as([2]u32, up2), &[2]u32{ 0x55, 0xaa }));
|
||||
try expect(mem.eql(u64, &@as([2]u64, up3), &[2]u64{ 0x55, 0xaa }));
|
||||
try expect(mem.eql(u16, &@as([2]u16, up1), &[2]u16{ 0x55, 0xaa }));
|
||||
try expect(mem.eql(u32, &@as([2]u32, up2), &[2]u32{ 0x55, 0xaa }));
|
||||
try expect(mem.eql(u64, &@as([2]u64, up3), &[2]u64{ 0x55, 0xaa }));
|
||||
|
||||
try expect(mem.eql(u32, &@as([2]u32, down1), &[2]u32{ 0x55, 0xaa }));
|
||||
try expect(mem.eql(u16, &@as([2]u16, down2), &[2]u16{ 0x55, 0xaa }));
|
||||
try expect(mem.eql(u8, &@as([2]u8, down3), &[2]u8{ 0x55, 0xaa }));
|
||||
{
|
||||
// Downcast (safety-checked)
|
||||
const down2: @Vector(2, u32) = @intCast(up3);
|
||||
const down1: @Vector(2, u16) = @intCast(up3);
|
||||
const down0: @Vector(2, u8) = @intCast(up3);
|
||||
|
||||
try expect(mem.eql(u32, &@as([2]u32, down2), &[2]u32{ 0x55, 0xaa }));
|
||||
try expect(mem.eql(u16, &@as([2]u16, down1), &[2]u16{ 0x55, 0xaa }));
|
||||
try expect(mem.eql(u8, &@as([2]u8, down0), &[2]u8{ 0x55, 0xaa }));
|
||||
}
|
||||
|
||||
{
|
||||
// Downcast (safety-checked)
|
||||
const down1: @Vector(2, u16) = @intCast(up2);
|
||||
const down0: @Vector(2, u8) = @intCast(up2);
|
||||
|
||||
try expect(mem.eql(u16, &@as([2]u16, down1), &[2]u16{ 0x55, 0xaa }));
|
||||
try expect(mem.eql(u8, &@as([2]u8, down0), &[2]u8{ 0x55, 0xaa }));
|
||||
}
|
||||
|
||||
{
|
||||
// Downcast (safety-checked)
|
||||
const down0: @Vector(2, u8) = @intCast(up1);
|
||||
|
||||
try expect(mem.eql(u8, &@as([2]u8, down0), &[2]u8{ 0x55, 0xaa }));
|
||||
}
|
||||
}
|
||||
{
|
||||
// Upcast (implicit, equivalent to @intCast)
|
||||
var up0: @Vector(4, u8) = .{ 0x00, 0x55, 0xaa, 0xff };
|
||||
_ = &up0;
|
||||
const up1: @Vector(4, u16) = up0;
|
||||
const up2: @Vector(4, u32) = up0;
|
||||
const up3: @Vector(4, u64) = up0;
|
||||
|
||||
try expect(mem.eql(u16, &@as([4]u16, up1), &[4]u16{ 0x00, 0x55, 0xaa, 0xff }));
|
||||
try expect(mem.eql(u32, &@as([4]u32, up2), &[4]u32{ 0x00, 0x55, 0xaa, 0xff }));
|
||||
try expect(mem.eql(u64, &@as([4]u64, up3), &[4]u64{ 0x00, 0x55, 0xaa, 0xff }));
|
||||
|
||||
{
|
||||
// Downcast (safety-checked)
|
||||
const down2: @Vector(4, u32) = @intCast(up3);
|
||||
const down1: @Vector(4, u16) = @intCast(up3);
|
||||
const down0: @Vector(4, u8) = @intCast(up3);
|
||||
|
||||
try expect(mem.eql(u32, &@as([4]u32, down2), &[4]u32{ 0x00, 0x55, 0xaa, 0xff }));
|
||||
try expect(mem.eql(u16, &@as([4]u16, down1), &[4]u16{ 0x00, 0x55, 0xaa, 0xff }));
|
||||
try expect(mem.eql(u8, &@as([4]u8, down0), &[4]u8{ 0x00, 0x55, 0xaa, 0xff }));
|
||||
}
|
||||
|
||||
{
|
||||
// Downcast (safety-checked)
|
||||
const down1: @Vector(4, u16) = @intCast(up2);
|
||||
const down0: @Vector(4, u8) = @intCast(up2);
|
||||
|
||||
try expect(mem.eql(u16, &@as([4]u16, down1), &[4]u16{ 0x00, 0x55, 0xaa, 0xff }));
|
||||
try expect(mem.eql(u8, &@as([4]u8, down0), &[4]u8{ 0x00, 0x55, 0xaa, 0xff }));
|
||||
}
|
||||
|
||||
{
|
||||
// Downcast (safety-checked)
|
||||
const down0: @Vector(4, u8) = @intCast(up1);
|
||||
|
||||
try expect(mem.eql(u8, &@as([4]u8, down0), &[4]u8{ 0x00, 0x55, 0xaa, 0xff }));
|
||||
}
|
||||
}
|
||||
{
|
||||
// Upcast (implicit, equivalent to @intCast)
|
||||
var up0: @Vector(8, u8) = .{
|
||||
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
|
||||
};
|
||||
_ = &up0;
|
||||
const up1: @Vector(8, u16) = up0;
|
||||
const up2: @Vector(8, u32) = up0;
|
||||
const up3: @Vector(8, u64) = up0;
|
||||
|
||||
try expect(mem.eql(u16, &@as([8]u16, up1), &[8]u16{
|
||||
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
|
||||
}));
|
||||
try expect(mem.eql(u32, &@as([8]u32, up2), &[8]u32{
|
||||
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
|
||||
}));
|
||||
try expect(mem.eql(u64, &@as([8]u64, up3), &[8]u64{
|
||||
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
|
||||
}));
|
||||
|
||||
{
|
||||
// Downcast (safety-checked)
|
||||
const down2: @Vector(8, u32) = @intCast(up3);
|
||||
const down1: @Vector(8, u16) = @intCast(up3);
|
||||
const down0: @Vector(8, u8) = @intCast(up3);
|
||||
|
||||
try expect(mem.eql(u32, &@as([8]u32, down2), &[8]u32{
|
||||
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
|
||||
}));
|
||||
try expect(mem.eql(u16, &@as([8]u16, down1), &[8]u16{
|
||||
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
|
||||
}));
|
||||
try expect(mem.eql(u8, &@as([8]u8, down0), &[8]u8{
|
||||
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
|
||||
}));
|
||||
}
|
||||
|
||||
{
|
||||
// Downcast (safety-checked)
|
||||
const down1: @Vector(8, u16) = @intCast(up2);
|
||||
const down0: @Vector(8, u8) = @intCast(up2);
|
||||
|
||||
try expect(mem.eql(u16, &@as([8]u16, down1), &[8]u16{
|
||||
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
|
||||
}));
|
||||
try expect(mem.eql(u8, &@as([8]u8, down0), &[8]u8{
|
||||
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
|
||||
}));
|
||||
}
|
||||
|
||||
{
|
||||
// Downcast (safety-checked)
|
||||
const down0: @Vector(8, u8) = @intCast(up1);
|
||||
|
||||
try expect(mem.eql(u8, &@as([8]u8, down0), &[8]u8{
|
||||
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
|
||||
}));
|
||||
}
|
||||
}
|
||||
{
|
||||
// Upcast (implicit, equivalent to @intCast)
|
||||
var up0: @Vector(16, u8) = .{
|
||||
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
|
||||
0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
|
||||
};
|
||||
_ = &up0;
|
||||
const up1: @Vector(16, u16) = up0;
|
||||
const up2: @Vector(16, u32) = up0;
|
||||
const up3: @Vector(16, u64) = up0;
|
||||
|
||||
try expect(mem.eql(u16, &@as([16]u16, up1), &[16]u16{
|
||||
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
|
||||
0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
|
||||
}));
|
||||
try expect(mem.eql(u32, &@as([16]u32, up2), &[16]u32{
|
||||
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
|
||||
0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
|
||||
}));
|
||||
try expect(mem.eql(u64, &@as([16]u64, up3), &[16]u64{
|
||||
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
|
||||
0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
|
||||
}));
|
||||
|
||||
{
|
||||
// Downcast (safety-checked)
|
||||
const down2: @Vector(16, u32) = @intCast(up3);
|
||||
const down1: @Vector(16, u16) = @intCast(up3);
|
||||
const down0: @Vector(16, u8) = @intCast(up3);
|
||||
|
||||
try expect(mem.eql(u32, &@as([16]u32, down2), &[16]u32{
|
||||
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
|
||||
0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
|
||||
}));
|
||||
try expect(mem.eql(u16, &@as([16]u16, down1), &[16]u16{
|
||||
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
|
||||
0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
|
||||
}));
|
||||
try expect(mem.eql(u8, &@as([16]u8, down0), &[16]u8{
|
||||
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
|
||||
0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
|
||||
}));
|
||||
}
|
||||
|
||||
{
|
||||
// Downcast (safety-checked)
|
||||
const down1: @Vector(16, u16) = @intCast(up2);
|
||||
const down0: @Vector(16, u8) = @intCast(up2);
|
||||
|
||||
try expect(mem.eql(u16, &@as([16]u16, down1), &[16]u16{
|
||||
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
|
||||
0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
|
||||
}));
|
||||
try expect(mem.eql(u8, &@as([16]u8, down0), &[16]u8{
|
||||
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
|
||||
0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
|
||||
}));
|
||||
}
|
||||
|
||||
{
|
||||
// Downcast (safety-checked)
|
||||
const down0: @Vector(16, u8) = @intCast(up1);
|
||||
|
||||
try expect(mem.eql(u8, &@as([16]u8, down0), &[16]u8{
|
||||
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
|
||||
0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue