mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
x86_64: 2 means better
This commit is contained in:
parent
b9c4400776
commit
73a42953c9
File diff suppressed because it is too large
Load Diff
@ -353,6 +353,7 @@ pub const Mnemonic = enum {
|
||||
pmovsxbd, pmovsxbq, pmovsxbw, pmovsxdq, pmovsxwd, pmovsxwq,
|
||||
pmovzxbd, pmovzxbq, pmovzxbw, pmovzxdq, pmovzxwd, pmovzxwq,
|
||||
pmulld,
|
||||
ptest,
|
||||
roundpd, roundps, roundsd, roundss,
|
||||
// SSE4.2
|
||||
pcmpgtq,
|
||||
@ -413,6 +414,7 @@ pub const Mnemonic = enum {
|
||||
vpsrad, vpsraq, vpsraw,
|
||||
vpsrld, vpsrldq, vpsrlq, vpsrlw,
|
||||
vpsubb, vpsubd, vpsubq, vpsubsb, vpsubsw, vpsubusb, vpsubusw, vpsubw,
|
||||
vptest,
|
||||
vpunpckhbw, vpunpckhdq, vpunpckhqdq, vpunpckhwd,
|
||||
vpunpcklbw, vpunpckldq, vpunpcklqdq, vpunpcklwd,
|
||||
vpxor,
|
||||
@ -421,6 +423,7 @@ pub const Mnemonic = enum {
|
||||
vsqrtpd, vsqrtps, vsqrtsd, vsqrtss,
|
||||
vstmxcsr,
|
||||
vsubpd, vsubps, vsubsd, vsubss,
|
||||
vtestpd, vtestps,
|
||||
vxorpd, vxorps,
|
||||
// F16C
|
||||
vcvtph2ps, vcvtps2ph,
|
||||
|
||||
@ -150,6 +150,31 @@ pub const Condition = enum(u5) {
|
||||
.nz_or_p => .z_and_np,
|
||||
};
|
||||
}
|
||||
|
||||
/// Returns the equivalent condition when the operands are swapped.
|
||||
pub fn commute(cond: Condition) Condition {
|
||||
return switch (cond) {
|
||||
else => cond,
|
||||
.a => .b,
|
||||
.ae => .be,
|
||||
.b => .a,
|
||||
.be => .ae,
|
||||
.c => .a,
|
||||
.g => .l,
|
||||
.ge => .le,
|
||||
.l => .g,
|
||||
.le => .ge,
|
||||
.na => .nb,
|
||||
.nae => .nbe,
|
||||
.nb => .na,
|
||||
.nbe => .nae,
|
||||
.nc => .na,
|
||||
.ng => .nl,
|
||||
.nge => .nle,
|
||||
.nl => .ng,
|
||||
.nle => .nge,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
pub const Register = enum(u7) {
|
||||
|
||||
@ -1251,6 +1251,8 @@ pub const table = [_]Entry{
|
||||
|
||||
.{ .pmulld, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x40 }, 0, .none, .sse4_1 },
|
||||
|
||||
.{ .ptest, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x17 }, 0, .none, .sse4_1 },
|
||||
|
||||
.{ .roundpd, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x09 }, 0, .none, .sse4_1 },
|
||||
|
||||
.{ .roundps, .rmi, &.{ .xmm, .xmm_m128, .imm8 }, &.{ 0x66, 0x0f, 0x3a, 0x08 }, 0, .none, .sse4_1 },
|
||||
@ -1676,6 +1678,9 @@ pub const table = [_]Entry{
|
||||
.{ .vpsubusb, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd8 }, 0, .vex_128_wig, .avx },
|
||||
.{ .vpsubusw, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0xd9 }, 0, .vex_128_wig, .avx },
|
||||
|
||||
.{ .vptest, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x17 }, 0, .vex_128_wig, .avx },
|
||||
.{ .vptest, .rm, &.{ .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x17 }, 0, .vex_256_wig, .avx },
|
||||
|
||||
.{ .vpunpckhbw, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x68 }, 0, .vex_128_wig, .avx },
|
||||
.{ .vpunpckhwd, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x69 }, 0, .vex_128_wig, .avx },
|
||||
.{ .vpunpckhdq, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x6a }, 0, .vex_128_wig, .avx },
|
||||
@ -1726,6 +1731,11 @@ pub const table = [_]Entry{
|
||||
|
||||
.{ .vsubss, .rvm, &.{ .xmm, .xmm, .xmm_m32 }, &.{ 0xf3, 0x0f, 0x5c }, 0, .vex_lig_wig, .avx },
|
||||
|
||||
.{ .vtestps, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x0e }, 0, .vex_128_w0, .avx },
|
||||
.{ .vtestps, .rm, &.{ .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x0e }, 0, .vex_256_w0, .avx },
|
||||
.{ .vtestpd, .rm, &.{ .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x38, 0x0f }, 0, .vex_128_w0, .avx },
|
||||
.{ .vtestpd, .rm, &.{ .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x38, 0x0f }, 0, .vex_256_w0, .avx },
|
||||
|
||||
.{ .vxorpd, .rvm, &.{ .xmm, .xmm, .xmm_m128 }, &.{ 0x66, 0x0f, 0x57 }, 0, .vex_128_wig, .avx },
|
||||
.{ .vxorpd, .rvm, &.{ .ymm, .ymm, .ymm_m256 }, &.{ 0x66, 0x0f, 0x57 }, 0, .vex_256_wig, .avx },
|
||||
|
||||
|
||||
@ -263,6 +263,12 @@ fn testBinary(comptime op: anytype) !void {
|
||||
0xbfd88aee1d82ed32, 0x20e91c15b701059a,
|
||||
0xed533d18f8657f3f, 0x1ddd7cd7f6bab957,
|
||||
});
|
||||
|
||||
if (false) try testType(@Vector(1, u128), .{
|
||||
0x5f11e16b0ca3392f907a857881455d2e,
|
||||
}, .{
|
||||
0xf9142d73b408fd6955922f9fc147f7d7,
|
||||
});
|
||||
}
|
||||
|
||||
inline fn bitAnd(comptime Type: type, lhs: Type, rhs: Type) @TypeOf(lhs & rhs) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user