1 use crate::dsl::{Feature::*, Inst, Length::*, Location::*};
2 use crate::dsl::{align, fmt, inst, r, rex, rw, vex, w};
3
4 #[rustfmt::skip] // Keeps instructions on a single line.
list() -> Vec<Inst>5 pub fn list() -> Vec<Inst> {
6 vec![
7 // Floating-point maximum. Note, from the manual: "if the values being
8 // compared are both 0.0s (of either sign), the value in the second
9 // operand (source operand) is returned. If a value in the second
10 // operand is an SNaN, then SNaN is forwarded unchanged to the
11 // destination (that is, a QNaN version of the SNaN is not returned). If
12 // only one value is a NaN (SNaN or QNaN) for this instruction, the
13 // second operand (source operand), either a NaN or a valid
14 // floating-point value, is written to the result. If instead of this
15 // behavior, it is required that the NaN source operand (from either the
16 // first or second operand) be returned, the action of MAXPS can be
17 // emulated using a sequence of instructions, such as, a comparison
18 // followed by AND, ANDN, and OR."
19 inst("maxss", fmt("A", [rw(xmm1), r(xmm_m32)]), rex([0xF3, 0x0F, 0x5F]).r(), (_64b | compat) & sse).alt(avx, "vmaxss_b"),
20 inst("maxsd", fmt("A", [rw(xmm1), r(xmm_m64)]), rex([0xF2, 0x0F, 0x5F]).r(), (_64b | compat) & sse2).alt(avx, "vmaxsd_b"),
21 inst("maxps", fmt("A", [rw(xmm1), r(align(xmm_m128))]), rex([0x0F, 0x5F]).r(), (_64b | compat) & sse).alt(avx, "vmaxps_b"),
22 inst("maxpd", fmt("A", [rw(xmm1), r(align(xmm_m128))]), rex([0x66, 0x0F, 0x5F]).r(), (_64b | compat) & sse2).alt(avx, "vmaxpd_b"),
23 inst("vmaxss", fmt("B", [w(xmm1), r(xmm2), r(xmm_m32)]), vex(LIG)._f3()._0f().op(0x5F).r(), (_64b | compat) & avx),
24 inst("vmaxsd", fmt("B", [w(xmm1), r(xmm2), r(xmm_m64)]), vex(LIG)._f2()._0f().op(0x5F).r(), (_64b | compat) & avx),
25 inst("vmaxps", fmt("B", [w(xmm1), r(xmm2), r(xmm_m128)]), vex(L128)._0f().op(0x5F).r(), (_64b | compat) & avx),
26 inst("vmaxpd", fmt("B", [w(xmm1), r(xmm2), r(xmm_m128)]), vex(L128)._66()._0f().op(0x5F).r(), (_64b | compat) & avx),
27 // Packed integer maximum.
28 inst("pmaxsb", fmt("A", [rw(xmm1), r(align(xmm_m128))]), rex([0x66, 0x0F, 0x38, 0x3C]).r(), (_64b | compat) & sse41).alt(avx, "vpmaxsb_b"),
29 inst("pmaxsw", fmt("A", [rw(xmm1), r(align(xmm_m128))]), rex([0x66, 0x0F, 0xEE]).r(), (_64b | compat) & sse2).alt(avx, "vpmaxsw_b"),
30 inst("pmaxsd", fmt("A", [rw(xmm1), r(align(xmm_m128))]), rex([0x66, 0x0F, 0x38, 0x3D]).r(), (_64b | compat) & sse41).alt(avx, "vpmaxsd_b"),
31 inst("pmaxub", fmt("A", [rw(xmm1), r(align(xmm_m128))]), rex([0x66, 0x0F, 0xDE]).r(), (_64b | compat) & sse2).alt(avx, "vpmaxub_b"),
32 inst("pmaxuw", fmt("A", [rw(xmm1), r(align(xmm_m128))]), rex([0x66, 0x0F, 0x38, 0x3E]).r(), (_64b | compat) & sse41).alt(avx, "vpmaxuw_b"),
33 inst("pmaxud", fmt("A", [rw(xmm1), r(align(xmm_m128))]), rex([0x66, 0x0F, 0x38, 0x3F]).r(), (_64b | compat) & sse41).alt(avx, "vpmaxud_b"),
34 inst("vpmaxsb", fmt("B", [w(xmm1), r(xmm2), r(xmm_m128)]), vex(L128)._66()._0f38().op(0x3C).r(), (_64b | compat) & avx),
35 inst("vpmaxsw", fmt("B", [w(xmm1), r(xmm2), r(xmm_m128)]), vex(L128)._66()._0f().op(0xEE).r(), (_64b | compat) & avx),
36 inst("vpmaxsd", fmt("B", [w(xmm1), r(xmm2), r(xmm_m128)]), vex(L128)._66()._0f38().op(0x3D).r(), (_64b | compat) & avx),
37 inst("vpmaxub", fmt("B", [w(xmm1), r(xmm2), r(xmm_m128)]), vex(L128)._66()._0f().op(0xDE).r(), (_64b | compat) & avx),
38 inst("vpmaxuw", fmt("B", [w(xmm1), r(xmm2), r(xmm_m128)]), vex(L128)._66()._0f38().op(0x3E).r(), (_64b | compat) & avx),
39 inst("vpmaxud", fmt("B", [w(xmm1), r(xmm2), r(xmm_m128)]), vex(L128)._66()._0f38().op(0x3F).r(), (_64b | compat) & avx),
40 ]
41 }
42