def Instructions(bitness): """Returns crc32w variants.""" mem = proof_tools.AllMemoryOperands(bitness=bitness) reg16_read = proof_tools.GprOperands(bitness, operand_size=16, is_write_for_64_bit=False) reg32_write = proof_tools.GprOperands(bitness, operand_size=32, is_write_for_64_bit=True) crc32w = OpsProd(MnemonicOp('crc32w'), mem | reg16_read, reg32_write) return crc32w
def Validate(trie_diffs, bitness): """Validate that trie_diffs adds 16 bit shld/shrd in 32bit mode.""" # No instructions should be removed for 32/64 bit DFAs. # No instructions should be added for 64 bit DFA because it already # contains 16 bit shld/shrd instructions. # in 32-bit mode, 16 bit shld/shrd should be added. # This is of the forms: # shld|shrd, imm|%cl, reg16, reg16|mem if bitness == 32: mnemonics = proof_tools.MnemonicOp('shld') | proof_tools.MnemonicOp( 'shrd') reg16 = proof_tools.GprOperands(bitness=bitness, operand_size=16) mem = proof_tools.AllMemoryOperands(bitness=bitness) imm = proof_tools.ImmOp() cl = set([proof_tools.Operands(disasms=('%cl', ))]) expected_adds = proof_tools.OpsProd(mnemonics, imm | cl, reg16, reg16 | mem) else: expected_adds = set() proof_tools.AssertDiffSetEquals(trie_diffs, expected_adds=expected_adds, expected_removes=set())
def Instructions(bitness): """Returns all new instructions to be added with this change.""" xmm = proof_tools.AllXMMOperands(bitness) reg32_restricting_write = proof_tools.GprOperands(bitness, operand_size=32, is_write_for_64_bit=True, can_restrict=True) mem = proof_tools.AllMemoryOperands(bitness=bitness) vmovd = OpsProd(MnemonicOp('vmovd'), xmm, mem | reg32_restricting_write) instructions = (vmovd) if bitness == 64: reg64_write = proof_tools.GprOperands(bitness=bitness, operand_size=64, is_write_for_64_bit=True) vmovq = OpsProd(MnemonicOp('vmovq'), xmm, mem | reg64_write) instructions = (instructions | vmovq) return instructions
def Instructions(bitness): """Returns avx2 promotions of 0f 6x and 0f 7x groups.""" mem = proof_tools.AllMemoryOperands(bitness=bitness) ymm = proof_tools.AllYMMOperands(bitness) xmm = proof_tools.AllXMMOperands(bitness) imm = proof_tools.ImmOp() reg32_write = proof_tools.GprOperands(bitness, operand_size=32, is_write_for_64_bit=True) vpunpcklbw = OpsProd(MnemonicOp('vpunpcklbw'), mem | ymm, ymm, ymm) vpunpcklwd = OpsProd(MnemonicOp('vpunpcklwd'), mem | ymm, ymm, ymm) vpunpckldq = OpsProd(MnemonicOp('vpunpckldq'), mem | ymm, ymm, ymm) vpacksswb = OpsProd(MnemonicOp('vpacksswb'), mem | ymm, ymm, ymm) vpunpcklqdq = OpsProd(MnemonicOp('vpunpcklqdq'), mem | ymm, ymm, ymm) vpunpckhqdq = OpsProd(MnemonicOp('vpunpckhqdq'), mem | ymm, ymm, ymm) vpcmpgtb = OpsProd(MnemonicOp('vpcmpgtb'), mem | ymm, ymm, ymm) vpcmpgtw = OpsProd(MnemonicOp('vpcmpgtw'), mem | ymm, ymm, ymm) vpcmpgtd = OpsProd(MnemonicOp('vpcmpgtd'), mem | ymm, ymm, ymm) vpackuswb = OpsProd(MnemonicOp('vpackuswb'), mem | ymm, ymm, ymm) vpunpckhbw = OpsProd(MnemonicOp('vpunpckhbw'), mem | ymm, ymm, ymm) vpunpckhwd = OpsProd(MnemonicOp('vpunpckhwd'), mem | ymm, ymm, ymm) vpunpckhdq = OpsProd(MnemonicOp('vpunpckhdq'), mem | ymm, ymm, ymm) vpackssdw = OpsProd(MnemonicOp('vpackssdw'), mem | ymm, ymm, ymm) vpshufd = OpsProd(MnemonicOp('vpshufd'), imm, mem | ymm, ymm) vpshufhw = OpsProd(MnemonicOp('vpshufhw'), imm, mem | ymm, ymm) vpshuflw = OpsProd(MnemonicOp('vpshuflw'), imm, mem | ymm, ymm) vpcmpeqb = OpsProd(MnemonicOp('vpcmpeqb'), mem | ymm, ymm, ymm) vpcmpeqw = OpsProd(MnemonicOp('vpcmpeqw'), mem | ymm, ymm, ymm) vpcmpeqd = OpsProd(MnemonicOp('vpcmpeqd'), mem | ymm, ymm, ymm) vpsrlw = OpsProd(MnemonicOp('vpsrlw'), imm | mem | xmm, ymm, ymm) vpsrld = OpsProd(MnemonicOp('vpsrld'), imm | mem | xmm, ymm, ymm) vpsrlq = OpsProd(MnemonicOp('vpsrlq'), imm | mem | xmm, ymm, ymm) vpaddq = OpsProd(MnemonicOp('vpaddq'), mem | ymm, ymm, ymm) vpmullw = OpsProd(MnemonicOp('vpmullw'), mem | ymm, ymm, ymm) vpmovmskb = OpsProd(MnemonicOp('vpmovmskb'), ymm, reg32_write) vpsubusb = OpsProd(MnemonicOp('vpsubusb'), mem | ymm, ymm, ymm) vpsubusw = OpsProd(MnemonicOp('vpsubusw'), mem | ymm, ymm, ymm) vpminub = OpsProd(MnemonicOp('vpminub'), mem | ymm, ymm, ymm) vpand = OpsProd(MnemonicOp('vpand'), mem | ymm, ymm, ymm) vpaddusb = OpsProd(MnemonicOp('vpaddusb'), mem | ymm, ymm, ymm) vpaddusw = OpsProd(MnemonicOp('vpaddusw'), mem | ymm, ymm, ymm) vpmaxub = OpsProd(MnemonicOp('vpmaxub'), mem | ymm, ymm, ymm) vpandn = OpsProd(MnemonicOp('vpandn'), mem | ymm, ymm, ymm) return (vpunpcklbw | vpunpcklwd | vpunpckldq | vpacksswb | vpcmpgtb | vpcmpgtw | vpcmpgtd | vpackuswb | vpunpckhbw | vpunpckhwd | vpunpckhdq | vpackssdw | vpunpcklqdq | vpunpckhqdq | vpshufd | vpshufhw | vpshuflw | vpcmpeqb | vpcmpeqw | vpcmpeqd | vpsrlw | vpsrld | vpsrlq | vpaddq | vpmullw | vpmovmskb | vpsubusb | vpsubusw | vpminub | vpand | vpaddusb | vpaddusw | vpmaxub | vpandn)
def Validate(trie_diffs, bitness): """Validate the trie_diffs adds 16 bit bsr/bsf is added in 32bit mode.""" # No instructions should be removed for 32/64 bit DFAs. # No instructions should be added for 64 bit DFA because it already # contains 16 bit bsr/bsf instructions. # in 32-bit mode, 16 bit bsr/bsf should be added. # This is of the forms: # {bsr,bsf} mem16/reg16, reg16 if bitness == 32: mnemonics = proof_tools.MnemonicOp('bsr') | proof_tools.MnemonicOp( 'bsf') reg16 = proof_tools.GprOperands(bitness=bitness, operand_size=16) mem = proof_tools.AllMemoryOperands(bitness=bitness) expected_adds = proof_tools.OpsProd(mnemonics, reg16 | mem, reg16) else: expected_adds = set() proof_tools.AssertDiffSetEquals(trie_diffs, expected_adds=expected_adds, expected_removes=set())
def Validate(trie_diffs, bitness): """Validate the trie_diffs adds 16 bit movbe is added in 32bit mode.""" # No instructions should be removed for 32/64 bit DFAs. # No instructions should be added for 64 bit DFA because it already # contains 16 bit movbe instructions. # in 32-bit mode, 16 bit movbe should be added. # This is of two forms: # movbe mem, reg16 # or # movbe reg16, mem if bitness == 32: mnemonic = proof_tools.MnemonicOp('movbe') reg16 = proof_tools.GprOperands(bitness=bitness, operand_size=16) mem = proof_tools.AllMemoryOperands(bitness=bitness) expected_adds = (proof_tools.OpsProd(mnemonic, mem, reg16) | proof_tools.OpsProd(mnemonic, reg16, mem)) else: expected_adds = set() proof_tools.AssertDiffSetEquals(trie_diffs, expected_adds=expected_adds, expected_removes=set())
def Instructions(bitness): """Returns all new instructions to be added with this change.""" imm = proof_tools.ImmOp() mem = proof_tools.AllMemoryOperands(bitness=bitness) xmm = proof_tools.AllXMMOperands(bitness) ymm = proof_tools.AllYMMOperands(bitness) reg32_write = proof_tools.GprOperands(bitness, operand_size=32, is_write_for_64_bit=True) reg32 = proof_tools.GprOperands(bitness, operand_size=32, is_write_for_64_bit=False) vblendpd = (OpsProd(MnemonicOp('vblendpd'), imm, mem | xmm, xmm, xmm) | OpsProd(MnemonicOp('vblendpd'), imm, mem | ymm, ymm, ymm)) vblendps = (OpsProd(MnemonicOp('vblendps'), imm, mem | xmm, xmm, xmm) | OpsProd(MnemonicOp('vblendps'), imm, mem | ymm, ymm, ymm)) vblendvpd = (OpsProd(MnemonicOp('vblendvpd'), xmm, mem | xmm, xmm, xmm) | OpsProd(MnemonicOp('vblendvpd'), ymm, mem | ymm, ymm, ymm)) vblendvps = (OpsProd(MnemonicOp('vblendvps'), xmm, mem | xmm, xmm, xmm) | OpsProd(MnemonicOp('vblendvps'), ymm, mem | ymm, ymm, ymm)) vcomisd = OpsProd(MnemonicOp('vcomisd'), mem | xmm, xmm) vcomiss = OpsProd(MnemonicOp('vcomiss'), mem | xmm, xmm) vcvtdq2pd = (OpsProd(MnemonicOp('vcvtdq2pd'), mem | xmm, xmm) | OpsProd(MnemonicOp('vcvtdq2pd'), mem | xmm, ymm)) vcvtdq2ps = (OpsProd(MnemonicOp('vcvtdq2ps'), mem | xmm, xmm) | OpsProd(MnemonicOp('vcvtdq2ps'), mem | ymm, ymm)) vcvtps2dq = (OpsProd(MnemonicOp('vcvtps2dq'), mem | xmm, xmm) | OpsProd(MnemonicOp('vcvtps2dq'), mem | ymm, ymm)) vcvtps2pd = (OpsProd(MnemonicOp('vcvtps2pd'), mem | xmm, xmm) | OpsProd(MnemonicOp('vcvtps2pd'), mem | xmm, ymm)) vdppd = OpsProd(MnemonicOp('vdppd'), imm, xmm | mem, xmm, xmm) vdpps = (OpsProd(MnemonicOp('vdpps'), imm, xmm | mem, xmm, xmm) | OpsProd(MnemonicOp('vdpps'), imm, ymm | mem, ymm, ymm)) vextractf128 = OpsProd(MnemonicOp('vextractf128'), imm, ymm, xmm | mem) vinsertps = OpsProd(MnemonicOp('vinsertps'), imm, xmm | mem, xmm, xmm) vldmxcsr = OpsProd(MnemonicOp('vldmxcsr'), mem) vstmxcsr = OpsProd(MnemonicOp('vstmxcsr'), mem) vldqqu = OpsProd(MnemonicOp('vlddqu'), mem, xmm | ymm) vmaskmovpd = (OpsProd(MnemonicOp('vmaskmovpd'), mem, xmm, xmm) | OpsProd(MnemonicOp('vmaskmovpd'), xmm, xmm, mem) | OpsProd(MnemonicOp('vmaskmovpd'), ymm, ymm, mem) | OpsProd(MnemonicOp('vmaskmovpd'), mem, ymm, ymm)) vmaskmovps = (OpsProd(MnemonicOp('vmaskmovps'), mem, xmm, xmm) | OpsProd(MnemonicOp('vmaskmovps'), xmm, xmm, mem) | OpsProd(MnemonicOp('vmaskmovps'), ymm, ymm, mem) | OpsProd(MnemonicOp('vmaskmovps'), mem, ymm, ymm)) vmovmskps = OpsProd(MnemonicOp('vmovmskps'), xmm | ymm, reg32_write) vmovmskpd = OpsProd(MnemonicOp('vmovmskpd'), xmm | ymm, reg32_write) vmovntdqa = OpsProd(MnemonicOp('vmovntdqa'), mem, xmm) vmovntdq = OpsProd(MnemonicOp('vmovntdq'), xmm | ymm, mem) vmovntpd = OpsProd(MnemonicOp('vmovntpd'), xmm | ymm, mem) vmovntps = OpsProd(MnemonicOp('vmovntps'), xmm | ymm, mem) vmpsadbw = OpsProd(MnemonicOp('vmpsadbw'), imm, mem | xmm, xmm, xmm) vpabsb = OpsProd(MnemonicOp('vpabsb'), mem | xmm, xmm) vpabsw = OpsProd(MnemonicOp('vpabsw'), mem | xmm, xmm) vpabsd = OpsProd(MnemonicOp('vpabsd'), mem | xmm, xmm) vpalignr = OpsProd(MnemonicOp('vpalignr'), imm, xmm | mem, xmm, xmm) vpblendvb = OpsProd(MnemonicOp('vpblendvb'), xmm, xmm | mem, xmm, xmm) vpblendw = OpsProd(MnemonicOp('vpblendw'), imm, xmm | mem, xmm, xmm) vpcmpestri = OpsProd(MnemonicOp('vpcmpestri'), imm, mem | xmm, xmm) vpcmpestrm = OpsProd(MnemonicOp('vpcmpestrm'), imm, mem | xmm, xmm) vpcmpistri = OpsProd(MnemonicOp('vpcmpistri'), imm, mem | xmm, xmm) vpcmpistrm = OpsProd(MnemonicOp('vpcmpistrm'), imm, mem | xmm, xmm) vperm2f128 = OpsProd(MnemonicOp('vperm2f128'), imm, ymm | mem, ymm, ymm) vpermilpd = (OpsProd(MnemonicOp('vpermilpd'), imm, xmm | mem, xmm) | OpsProd(MnemonicOp('vpermilpd'), imm, ymm | mem, ymm)) vpermilps = (OpsProd(MnemonicOp('vpermilps'), imm, xmm | mem, xmm) | OpsProd(MnemonicOp('vpermilps'), imm, ymm | mem, ymm)) vpextrb = OpsProd(MnemonicOp('vpextrb'), imm, xmm, reg32_write | mem) vpextrd = OpsProd(MnemonicOp('vpextrd'), imm, xmm, reg32_write | mem) vpextrw = OpsProd(MnemonicOp('vpextrw'), imm, xmm, reg32_write | mem) vphminposuw = OpsProd(MnemonicOp('vphminposuw'), mem | xmm, xmm) vpmovmskb = OpsProd(MnemonicOp('vpmovmskb'), xmm, reg32_write) vpmovsxbw = OpsProd(MnemonicOp('vpmovsxbw'), xmm | mem, xmm) vpmovsxbd = OpsProd(MnemonicOp('vpmovsxbd'), xmm | mem, xmm) vpmovsxbq = OpsProd(MnemonicOp('vpmovsxbq'), xmm | mem, xmm) vpmovsxdq = OpsProd(MnemonicOp('vpmovsxdq'), xmm | mem, xmm) vpmovsxwd = OpsProd(MnemonicOp('vpmovsxwd'), xmm | mem, xmm) vpmovsxwq = OpsProd(MnemonicOp('vpmovsxwq'), xmm | mem, xmm) vpmovzxbw = OpsProd(MnemonicOp('vpmovzxbw'), xmm | mem, xmm) vpmovzxbd = OpsProd(MnemonicOp('vpmovzxbd'), xmm | mem, xmm) vpmovzxbq = OpsProd(MnemonicOp('vpmovzxbq'), xmm | mem, xmm) vpmovzxdq = OpsProd(MnemonicOp('vpmovzxdq'), xmm | mem, xmm) vpmovzxwd = OpsProd(MnemonicOp('vpmovzxwd'), xmm | mem, xmm) vpmovzxwq = OpsProd(MnemonicOp('vpmovzxwq'), xmm | mem, xmm) vpshufd = OpsProd(MnemonicOp('vpshufd'), imm, mem | xmm, xmm) vpshufhw = OpsProd(MnemonicOp('vpshufhw'), imm, mem | xmm, xmm) vpshuflw = OpsProd(MnemonicOp('vpshuflw'), imm, mem | xmm, xmm) # These have non immediate versions where the source operand is xmm/mem # instead of the immediate. But they have already been enabled. vpslld = OpsProd(MnemonicOp('vpslld'), imm, xmm, xmm) vpslldq = OpsProd(MnemonicOp('vpslldq'), imm, xmm, xmm) vpsllq = OpsProd(MnemonicOp('vpsllq'), imm, xmm, xmm) vpsllw = OpsProd(MnemonicOp('vpsllw'), imm, xmm, xmm) vpsrad = OpsProd(MnemonicOp('vpsrad'), imm, xmm, xmm) vpsraw = OpsProd(MnemonicOp('vpsraw'), imm, xmm, xmm) vpsrld = OpsProd(MnemonicOp('vpsrld'), imm, xmm, xmm) vpsrldq = OpsProd(MnemonicOp('vpsrldq'), imm, xmm, xmm) vpsrlq = OpsProd(MnemonicOp('vpsrlq'), imm, xmm, xmm) vpsrlw = OpsProd(MnemonicOp('vpsrlw'), imm, xmm, xmm) vptest = (OpsProd(MnemonicOp('vptest'), mem | xmm, xmm) | OpsProd(MnemonicOp('vptest'), mem | ymm, ymm)) vrcpps = (OpsProd(MnemonicOp('vrcpps'), mem | xmm, xmm) | OpsProd(MnemonicOp('vrcpps'), mem | ymm, ymm)) vroundpd = (OpsProd(MnemonicOp('vroundpd'), imm, mem | xmm, xmm) | OpsProd(MnemonicOp('vroundpd'), imm, mem | ymm, ymm)) vroundps = (OpsProd(MnemonicOp('vroundps'), imm, mem | xmm, xmm) | OpsProd(MnemonicOp('vroundps'), imm, mem | ymm, ymm)) vroundsd = OpsProd(MnemonicOp('vroundsd'), imm, mem | xmm, xmm, xmm) vroundss = OpsProd(MnemonicOp('vroundss'), imm, mem | xmm, xmm, xmm) vrsqrtps = (OpsProd(MnemonicOp('vrsqrtps'), xmm | mem, xmm) | OpsProd(MnemonicOp('vrsqrtps'), ymm | mem, ymm)) vshufpd = (OpsProd(MnemonicOp('vshufpd'), imm, mem | xmm, xmm, xmm) | OpsProd(MnemonicOp('vshufpd'), imm, mem | ymm, ymm, ymm)) vshufps = (OpsProd(MnemonicOp('vshufps'), imm, mem | xmm, xmm, xmm) | OpsProd(MnemonicOp('vshufps'), imm, mem | ymm, ymm, ymm)) vsqrtpd = (OpsProd(MnemonicOp('vsqrtpd'), mem | xmm, xmm) | OpsProd(MnemonicOp('vsqrtpd'), mem | ymm, ymm)) vsqrtps = (OpsProd(MnemonicOp('vsqrtps'), mem | xmm, xmm) | OpsProd(MnemonicOp('vsqrtps'), mem | ymm, ymm)) vtestpd = (OpsProd(MnemonicOp('vtestpd'), mem | xmm, xmm) | OpsProd(MnemonicOp('vtestpd'), mem | ymm, ymm)) vtestps = (OpsProd(MnemonicOp('vtestps'), mem | xmm, xmm) | OpsProd(MnemonicOp('vtestps'), mem | ymm, ymm)) vucomisd = OpsProd(MnemonicOp('vucomisd'), mem | xmm, xmm) vucomiss = OpsProd(MnemonicOp('vucomiss'), mem | xmm, xmm) return (vblendpd | vblendps | vblendvpd | vblendvps | vcomisd | vcomiss | vcvtdq2pd | vcvtdq2ps | vcvtps2dq | vcvtps2pd | vdppd | vdpps | vextractf128 | vinsertps | vldmxcsr | vstmxcsr | vldqqu | vmaskmovpd | vmaskmovps | vmovmskpd | vmovmskps | vmovntdqa | vmovntdq | vmovntpd | vmovntps | vmpsadbw | vpabsb | vpabsd | vpabsw | vpalignr | vpblendvb | vpblendw | vpcmpestri | vpcmpestrm | vpcmpistri | vpcmpistrm | vperm2f128 | vpermilpd | vpermilps | vpextrb | vpextrd | vpextrw | vphminposuw | vpmovmskb | vpmovsxbw | vpmovsxbd | vpmovsxbq | vpmovsxdq | vpmovsxwd | vpmovsxwq | vpmovzxbw | vpmovzxbd | vpmovzxbq | vpmovzxdq | vpmovzxwd | vpmovzxwq | vpshufd | vpshufhw | vpshuflw | vpslld | vpslldq | vpsllq | vpsllw | vpsrad | vpsraw | vpsrld | vpsrldq | vpsrlq | vpsrlw | vptest | vrcpps | vroundpd | vroundps | vroundsd | vroundss | vrsqrtps | vshufpd | vshufps | vsqrtpd | vsqrtps | vtestpd | vtestps | vucomisd | vucomiss)
def Instructions(bitness): """Returns all new instructions to be added with this change.""" imm = proof_tools.ImmOp() mem = proof_tools.AllMemoryOperands(bitness=bitness) xmm = proof_tools.AllXMMOperands(bitness) ymm = proof_tools.AllYMMOperands(bitness) reg32_write = proof_tools.GprOperands(bitness, operand_size=32, is_write_for_64_bit=True) reg32_restricting_write = proof_tools.GprOperands(bitness, operand_size=32, is_write_for_64_bit=True, can_restrict=True) reg32 = proof_tools.GprOperands(bitness, operand_size=32, is_write_for_64_bit=False) reg64 = None reg64_write = None if bitness == 64: reg64 = proof_tools.GprOperands(bitness=bitness, operand_size=64, is_write_for_64_bit=False) reg64_write = proof_tools.GprOperands(bitness=bitness, operand_size=64, is_write_for_64_bit=True) vcmpeqpd = (OpsProd(MnemonicOp('vcmpeqpd'), mem|xmm, xmm, xmm) | OpsProd(MnemonicOp('vcmpeqpd'), mem|ymm, ymm, ymm)) vcmpeqps = (OpsProd(MnemonicOp('vcmpeqps'), mem|xmm, xmm, xmm) | OpsProd(MnemonicOp('vcmpeqps'), mem|ymm, ymm, ymm)) vcmpeqss = OpsProd(MnemonicOp('vcmpeqss'), mem|xmm, xmm, xmm) vcvtpd2dq = OpsProd(MnemonicOp('vcvtpd2dq'), xmm|ymm, xmm) vcvtpd2dqx = OpsProd(MnemonicOp('vcvtpd2dqx'), mem, xmm) vcvtpd2dqy = OpsProd(MnemonicOp('vcvtpd2dqy'), mem, xmm) vcvtpd2ps = OpsProd(MnemonicOp('vcvtpd2ps'), xmm|ymm, xmm) vcvtpd2psx = OpsProd(MnemonicOp('vcvtpd2psx'), mem, xmm) vcvtpd2psy = OpsProd(MnemonicOp('vcvtpd2psy'), mem, xmm) vcvtsi2sd = (OpsProd(MnemonicOp('vcvtsi2sd'), reg32, xmm, xmm) | OpsProd(MnemonicOp('vcvtsi2sdl'), mem, xmm, xmm)) if bitness == 64: vcvtsi2sd |= (OpsProd(MnemonicOp('vcvtsi2sd'), reg64, xmm, xmm) | OpsProd(MnemonicOp('vcvtsi2sdq'), mem, xmm, xmm)) vcvtsi2ss = (OpsProd(MnemonicOp('vcvtsi2ss'), reg32, xmm, xmm) | OpsProd(MnemonicOp('vcvtsi2ssl'), mem, xmm, xmm)) if bitness == 64: vcvtsi2ss |= (OpsProd(MnemonicOp('vcvtsi2ss'), reg64, xmm, xmm) | OpsProd(MnemonicOp('vcvtsi2ssq'), mem, xmm, xmm)) vcvtsd2si = OpsProd(MnemonicOp('vcvtsd2si'), xmm|mem, reg32_write) if bitness == 64: vcvtsd2si |= OpsProd(MnemonicOp('vcvtsd2si'), xmm|mem, reg64_write) vcvtss2si = OpsProd(MnemonicOp('vcvtss2si'), xmm|mem, reg32_write) if bitness == 64: vcvtss2si |= OpsProd(MnemonicOp('vcvtss2si'), xmm|mem, reg64_write) vcvttpd2dq = OpsProd(MnemonicOp('vcvttpd2dq'), xmm|ymm, xmm) vcvttpd2dqx = OpsProd(MnemonicOp('vcvttpd2dqx'), mem, xmm) vcvttpd2dqy = OpsProd(MnemonicOp('vcvttpd2dqy'), mem, xmm) vcvttsd2si = OpsProd(MnemonicOp('vcvttsd2si'), mem|xmm, reg32_write) if bitness == 64: vcvttsd2si |= OpsProd(MnemonicOp('vcvttsd2si'), mem|xmm, reg64_write) vcvttss2si = OpsProd(MnemonicOp('vcvttss2si'), mem|xmm, reg32_write) if bitness == 64: vcvttss2si |= OpsProd(MnemonicOp('vcvttss2si'), mem|xmm, reg64_write) vcvttps2dq = (OpsProd(MnemonicOp('vcvttps2dq'), mem|xmm, xmm) | OpsProd(MnemonicOp('vcvttps2dq'), mem|ymm, ymm)) vextractps = OpsProd(MnemonicOp('vextractps'), imm, xmm, mem) vinsertf128 = OpsProd(MnemonicOp('vinsertf128'), imm, mem|xmm, ymm, ymm) vmovd = (OpsProd(MnemonicOp('vmovd'), mem|reg32, xmm) | OpsProd(MnemonicOp('vmovd'), xmm, mem|reg32_restricting_write)) vmovq = (OpsProd(MnemonicOp('vmovq'), xmm, xmm|mem) | OpsProd(MnemonicOp('vmovq'), xmm|mem, xmm)) if bitness == 64: vmovq |= (OpsProd(MnemonicOp('vmovq'), reg64|mem, xmm) | OpsProd(MnemonicOp('vmovq'), xmm, reg64_write|mem)) vpinsrb = OpsProd(MnemonicOp('vpinsrb'), imm, mem|reg32, xmm, xmm) vpinsrd = OpsProd(MnemonicOp('vpinsrd'), imm, mem|reg32, xmm, xmm) vpinsrw = OpsProd(MnemonicOp('vpinsrw'), imm, mem|reg32, xmm, xmm) vrsqrtss = OpsProd(MnemonicOp('vrsqrtss'), mem|xmm, xmm, xmm) instructions = ( vcmpeqpd | vcmpeqps | vcmpeqss | vcvtpd2dq | vcvtpd2dqx | vcvtpd2dqy | vcvtpd2ps | vcvtpd2psx | vcvtpd2psy | vcvtsi2sd | vcvtsi2ss | vcvtsd2si | vcvtss2si | vcvttpd2dq | vcvttpd2dqx | vcvttpd2dqy | vcvttps2dq | vcvttsd2si | vcvttss2si | vextractps | vinsertf128 | vmovd | vmovq | vpinsrb | vpinsrd | vpinsrw | vrsqrtss ) if bitness == 32: vmaskmovdqu = OpsProd(MnemonicOp('vmaskmovdqu'), xmm, xmm) # While this instruction is allowed in 64 bit mode, it has an implicit # masked memory operand, and is hence a superinstruction covered by # super instruction verification. instructions |= vmaskmovdqu elif bitness == 64: vpinsrq = OpsProd(MnemonicOp('vpinsrq'), imm, mem|reg64, xmm, xmm) vpextrq = OpsProd(MnemonicOp('vpextrq'), imm, xmm, mem|reg64_write) instructions |= (vpinsrq | vpextrq) return instructions
def Instructions(bitness): """Returns all remaining AVX2 promotions of avx1 instructions.""" mem = proof_tools.AllMemoryOperands(bitness=bitness) ymm = proof_tools.AllYMMOperands(bitness) xmm = proof_tools.AllXMMOperands(bitness) imm = proof_tools.ImmOp() reg32_write = proof_tools.GprOperands(bitness, operand_size=32, is_write_for_64_bit=True) # 0F EX Group vpavgb = OpsProd(MnemonicOp('vpavgb'), mem | ymm, ymm, ymm) vpsraw = OpsProd(MnemonicOp('vpsraw'), mem | xmm | imm, ymm, ymm) vpsrad = OpsProd(MnemonicOp('vpsrad'), mem | xmm | imm, ymm, ymm) vpavgw = OpsProd(MnemonicOp('vpavgw'), mem | ymm, ymm, ymm) vpmulhuw = OpsProd(MnemonicOp('vpmulhuw'), mem | ymm, ymm, ymm) vpmulhw = OpsProd(MnemonicOp('vpmulhw'), mem | ymm, ymm, ymm) vmovntdq = OpsProd(MnemonicOp('vmovntdq'), ymm, mem) vpsubsb = OpsProd(MnemonicOp('vpsubsb'), mem | ymm, ymm, ymm) vpsubsw = OpsProd(MnemonicOp('vpsubsw'), mem | ymm, ymm, ymm) vpminsw = OpsProd(MnemonicOp('vpminsw'), mem | ymm, ymm, ymm) vpor = OpsProd(MnemonicOp('vpor'), mem | ymm, ymm, ymm) vpaddsb = OpsProd(MnemonicOp('vpaddsb'), mem | ymm, ymm, ymm) vpaddsw = OpsProd(MnemonicOp('vpaddsw'), mem | ymm, ymm, ymm) vpmaxsw = OpsProd(MnemonicOp('vpmaxsw'), mem | ymm, ymm, ymm) vpxor = OpsProd(MnemonicOp('vpxor'), mem | ymm, ymm, ymm) # 0F FX Group vpsllw = OpsProd(MnemonicOp('vpsllw'), mem | xmm | imm, ymm, ymm) vpslld = OpsProd(MnemonicOp('vpslld'), mem | xmm | imm, ymm, ymm) vpsllq = OpsProd(MnemonicOp('vpsllq'), mem | xmm | imm, ymm, ymm) vpmuludq = OpsProd(MnemonicOp('vpmuludq'), mem | ymm, ymm, ymm) vpmaddwd = OpsProd(MnemonicOp('vpmaddwd'), mem | ymm, ymm, ymm) vpsadbw = OpsProd(MnemonicOp('vpsadbw'), mem | ymm, ymm, ymm) vpsubb = OpsProd(MnemonicOp('vpsubb'), mem | ymm, ymm, ymm) vpsubw = OpsProd(MnemonicOp('vpsubw'), mem | ymm, ymm, ymm) vpsubd = OpsProd(MnemonicOp('vpsubd'), mem | ymm, ymm, ymm) vpsubq = OpsProd(MnemonicOp('vpsubq'), mem | ymm, ymm, ymm) vpaddb = OpsProd(MnemonicOp('vpaddb'), mem | ymm, ymm, ymm) vpaddw = OpsProd(MnemonicOp('vpaddw'), mem | ymm, ymm, ymm) vpaddd = OpsProd(MnemonicOp('vpaddd'), mem | ymm, ymm, ymm) # SSE3 Group vphaddw = OpsProd(MnemonicOp('vphaddw'), mem | ymm, ymm, ymm) vphaddsw = OpsProd(MnemonicOp('vphaddsw'), mem | ymm, ymm, ymm) vphaddd = OpsProd(MnemonicOp('vphaddd'), mem | ymm, ymm, ymm) vphsubw = OpsProd(MnemonicOp('vphsubw'), mem | ymm, ymm, ymm) vphsubsw = OpsProd(MnemonicOp('vphsubsw'), mem | ymm, ymm, ymm) vphsubd = OpsProd(MnemonicOp('vphsubd'), mem | ymm, ymm, ymm) vpmaddubsw = OpsProd(MnemonicOp('vpmaddubsw'), mem | ymm, ymm, ymm) vpalignr = OpsProd(MnemonicOp('vpalignr'), imm, mem | ymm, ymm, ymm) vpshufb = OpsProd(MnemonicOp('vpshufb'), mem | ymm, ymm, ymm) vpmulhrsw = OpsProd(MnemonicOp('vpmulhrsw'), mem | ymm, ymm, ymm) vpsignb = OpsProd(MnemonicOp('vpsignb'), mem | ymm, ymm, ymm) vpsignw = OpsProd(MnemonicOp('vpsignw'), mem | ymm, ymm, ymm) vpsignd = OpsProd(MnemonicOp('vpsignd'), mem | ymm, ymm, ymm) vpabsb = OpsProd(MnemonicOp('vpabsb'), mem | ymm, ymm) vpabsw = OpsProd(MnemonicOp('vpabsw'), mem | ymm, ymm) vpabsd = OpsProd(MnemonicOp('vpabsd'), mem | ymm, ymm) vmovntdqa = OpsProd(MnemonicOp('vmovntdqa'), mem, ymm) vmpsadbw = OpsProd(MnemonicOp('vmpsadbw'), imm, mem | ymm, ymm, ymm) vpackusdw = OpsProd(MnemonicOp('vpackusdw'), mem | ymm, ymm, ymm) vpblendvb = OpsProd(MnemonicOp('vpblendvb'), ymm, ymm | mem, ymm, ymm) vpblendw = OpsProd(MnemonicOp('vpblendw'), imm, ymm | mem, ymm, ymm) vpcmpeqq = OpsProd(MnemonicOp('vpcmpeqq'), ymm | mem, ymm, ymm) vpmaxsb = OpsProd(MnemonicOp('vpmaxsb'), ymm | mem, ymm, ymm) vpmaxsd = OpsProd(MnemonicOp('vpmaxsd'), ymm | mem, ymm, ymm) vpmaxud = OpsProd(MnemonicOp('vpmaxud'), ymm | mem, ymm, ymm) vpmaxuw = OpsProd(MnemonicOp('vpmaxuw'), ymm | mem, ymm, ymm) vpminsb = OpsProd(MnemonicOp('vpminsb'), ymm | mem, ymm, ymm) vpminsd = OpsProd(MnemonicOp('vpminsd'), ymm | mem, ymm, ymm) vpminud = OpsProd(MnemonicOp('vpminud'), ymm | mem, ymm, ymm) vpminuw = OpsProd(MnemonicOp('vpminuw'), ymm | mem, ymm, ymm) vpmovsxbw = OpsProd(MnemonicOp('vpmovsxbw'), mem | xmm, ymm) vpmovsxbd = OpsProd(MnemonicOp('vpmovsxbd'), mem | xmm, ymm) vpmovsxbq = OpsProd(MnemonicOp('vpmovsxbq'), mem | xmm, ymm) vpmovsxwd = OpsProd(MnemonicOp('vpmovsxwd'), mem | xmm, ymm) vpmovsxwq = OpsProd(MnemonicOp('vpmovsxwq'), mem | xmm, ymm) vpmovsxdq = OpsProd(MnemonicOp('vpmovsxdq'), mem | xmm, ymm) vpmovzxbw = OpsProd(MnemonicOp('vpmovzxbw'), mem | xmm, ymm) vpmovzxbd = OpsProd(MnemonicOp('vpmovzxbd'), mem | xmm, ymm) vpmovzxbq = OpsProd(MnemonicOp('vpmovzxbq'), mem | xmm, ymm) vpmovzxwd = OpsProd(MnemonicOp('vpmovzxwd'), mem | xmm, ymm) vpmovzxwq = OpsProd(MnemonicOp('vpmovzxwq'), mem | xmm, ymm) vpmovzxdq = OpsProd(MnemonicOp('vpmovzxdq'), mem | xmm, ymm) vpmuldq = OpsProd(MnemonicOp('vpmuldq'), mem | ymm, ymm, ymm) vpmulld = OpsProd(MnemonicOp('vpmulld'), mem | ymm, ymm, ymm) # SSE 4.2 group. vpcmpgtq = OpsProd(MnemonicOp('vpcmpgtq'), mem | ymm, ymm, ymm) return ( # 0F EX Group vpavgb | vpsraw | vpsrad | vpavgw | vpmulhuw | vpmulhw | vmovntdqa | vpsubsb | vpsubsw | vpminsw | vpor | vpaddsb | vpaddsw | vpmaxsw | vpxor | # 0F FX Group vpsllw | vpslld | vpsllq | vpmuludq | vpmaddwd | vpsadbw | vpsubb | vpsubw | vpsubd | vpsubq | vpaddb | vpaddw | vpaddd | # SSE3 Group vphaddw | vphaddsw | vphaddd | vphsubw | vphsubsw | vphsubd | vpmaddubsw | vpalignr | vpshufb | vpmulhrsw | vpsignb | vpsignw | vpsignd | vpabsb | vpabsw | vpabsd | vmovntdqa | vmpsadbw | vpackusdw | vpblendvb | vpblendw | vpcmpeqq | vpmaxsb | vpmaxsd | vpmaxud | vpmaxuw | vpminsb | vpminud | vpminuw | vpmovsxbw | vpmovsxbd | vpmovsxbq | vpmovsxwd | vpmovsxwq | vpmovsxdq | vpmovzxbw | vpmovzxbd | vpmovzxbq | vpmovzxwd | vpmovzxwq | vpmovzxdq | vpmuldq | vpmulld | # SSE4.2 Group vpcmpgtq)