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