12fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto//===- subzero/unittest/AssemblerX8664/LowLevel.cpp -----------------------===//
22fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto//
32fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto//                        The Subzero Code Generator
42fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto//
52fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto// This file is distributed under the University of Illinois Open Source
62fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto// License. See LICENSE.TXT for details.
72fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto//
82fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto//===----------------------------------------------------------------------===//
92fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto#include "AssemblerX8664/TestUtil.h"
102fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
112fea26cae5a6b140c67e18aec3dcf645a16694d5John Portonamespace Ice {
122fea26cae5a6b140c67e18aec3dcf645a16694d5John Portonamespace X8664 {
132fea26cae5a6b140c67e18aec3dcf645a16694d5John Portonamespace Test {
142fea26cae5a6b140c67e18aec3dcf645a16694d5John Portonamespace {
152fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
162fea26cae5a6b140c67e18aec3dcf645a16694d5John PortoTEST_F(AssemblerX8664LowLevelTest, Ret) {
172fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ ret();
182fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
192fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  constexpr size_t ByteCount = 1;
202fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  ASSERT_EQ(ByteCount, codeBytesSize());
212fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
222fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  verifyBytes<ByteCount>(codeBytes(), 0xc3);
232fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto}
242fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
252fea26cae5a6b140c67e18aec3dcf645a16694d5John PortoTEST_F(AssemblerX8664LowLevelTest, RetImm) {
262fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ ret(Immediate(0x20));
272fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
282fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  constexpr size_t ByteCount = 3;
292fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  ASSERT_EQ(ByteCount, codeBytesSize());
302fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
312fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  verifyBytes<ByteCount>(codeBytes(), 0xC2, 0x20, 0x00);
322fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto}
332fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
342fea26cae5a6b140c67e18aec3dcf645a16694d5John PortoTEST_F(AssemblerX8664LowLevelTest, CallImm4) {
352fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ call(Immediate(4));
362fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
372fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  constexpr size_t ByteCount = 5;
382fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  ASSERT_EQ(ByteCount, codeBytesSize());
392fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
402fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  verifyBytes<ByteCount>(codeBytes(), 0xe8, 0x00, 0x00, 0x00, 0x00);
412fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto}
422fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
432fea26cae5a6b140c67e18aec3dcf645a16694d5John PortoTEST_F(AssemblerX8664LowLevelTest, PopRegs) {
442fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ popl(Encoded_GPR_eax());
452fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ popl(Encoded_GPR_ebx());
462fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ popl(Encoded_GPR_ecx());
472fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ popl(Encoded_GPR_edx());
482fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ popl(Encoded_GPR_edi());
492fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ popl(Encoded_GPR_esi());
502fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ popl(Encoded_GPR_ebp());
512fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ popl(Encoded_GPR_r8());
522fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ popl(Encoded_GPR_r9());
532fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ popl(Encoded_GPR_r10());
542fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ popl(Encoded_GPR_r11());
552fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ popl(Encoded_GPR_r12());
562fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ popl(Encoded_GPR_r13());
572fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ popl(Encoded_GPR_r14());
582fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ popl(Encoded_GPR_r15());
592fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
602fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  constexpr size_t ByteCount = 23;
612fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  ASSERT_EQ(ByteCount, codeBytesSize());
622fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
632fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  constexpr uint8_t Rex_B = 0x41;
642fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  constexpr uint8_t PopOpcode = 0x58;
652fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  verifyBytes<ByteCount>(
662fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      codeBytes(), PopOpcode | Encoded_GPR_eax(), PopOpcode | Encoded_GPR_ebx(),
672fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      PopOpcode | Encoded_GPR_ecx(), PopOpcode | Encoded_GPR_edx(),
682fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      PopOpcode | Encoded_GPR_edi(), PopOpcode | Encoded_GPR_esi(),
692fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      PopOpcode | Encoded_GPR_ebp(), Rex_B, PopOpcode | (Encoded_GPR_r8() & 7),
702fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      Rex_B, PopOpcode | (Encoded_GPR_r9() & 7), Rex_B,
712fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      PopOpcode | (Encoded_GPR_r10() & 7), Rex_B,
722fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      PopOpcode | (Encoded_GPR_r11() & 7), Rex_B,
732fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      PopOpcode | (Encoded_GPR_r12() & 7), Rex_B,
742fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      PopOpcode | (Encoded_GPR_r13() & 7), Rex_B,
752fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      PopOpcode | (Encoded_GPR_r14() & 7), Rex_B,
762fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      PopOpcode | (Encoded_GPR_r15() & 7));
772fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto}
782fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
792fea26cae5a6b140c67e18aec3dcf645a16694d5John PortoTEST_F(AssemblerX8664LowLevelTest, PushRegs) {
802fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ pushl(Encoded_GPR_eax());
812fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ pushl(Encoded_GPR_ebx());
822fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ pushl(Encoded_GPR_ecx());
832fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ pushl(Encoded_GPR_edx());
842fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ pushl(Encoded_GPR_edi());
852fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ pushl(Encoded_GPR_esi());
862fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ pushl(Encoded_GPR_ebp());
872fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ pushl(Encoded_GPR_r8());
882fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ pushl(Encoded_GPR_r9());
892fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ pushl(Encoded_GPR_r10());
902fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ pushl(Encoded_GPR_r11());
912fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ pushl(Encoded_GPR_r12());
922fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ pushl(Encoded_GPR_r13());
932fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ pushl(Encoded_GPR_r14());
942fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ pushl(Encoded_GPR_r15());
952fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
962fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  constexpr size_t ByteCount = 23;
972fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  ASSERT_EQ(ByteCount, codeBytesSize());
982fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
992fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  constexpr uint8_t Rex_B = 0x41;
1002fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  constexpr uint8_t PushOpcode = 0x50;
1012fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  verifyBytes<ByteCount>(
1022fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      codeBytes(), PushOpcode | Encoded_GPR_eax(),
1032fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      PushOpcode | Encoded_GPR_ebx(), PushOpcode | Encoded_GPR_ecx(),
1042fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      PushOpcode | Encoded_GPR_edx(), PushOpcode | Encoded_GPR_edi(),
1052fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      PushOpcode | Encoded_GPR_esi(), PushOpcode | Encoded_GPR_ebp(), Rex_B,
1062fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      PushOpcode | (Encoded_GPR_r8() & 7), Rex_B,
1072fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      PushOpcode | (Encoded_GPR_r9() & 7), Rex_B,
1082fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      PushOpcode | (Encoded_GPR_r10() & 7), Rex_B,
1092fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      PushOpcode | (Encoded_GPR_r11() & 7), Rex_B,
1102fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      PushOpcode | (Encoded_GPR_r12() & 7), Rex_B,
1112fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      PushOpcode | (Encoded_GPR_r13() & 7), Rex_B,
1122fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      PushOpcode | (Encoded_GPR_r14() & 7), Rex_B,
1132fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      PushOpcode | (Encoded_GPR_r15() & 7));
1142fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto}
1152fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
1162fea26cae5a6b140c67e18aec3dcf645a16694d5John PortoTEST_F(AssemblerX8664LowLevelTest, MovRegisterZero) {
1172fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ mov(IceType_i32, Encoded_GPR_eax(), Immediate(0x00));
1182fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ mov(IceType_i32, Encoded_GPR_ebx(), Immediate(0x00));
1192fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ mov(IceType_i32, Encoded_GPR_ecx(), Immediate(0x00));
1202fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ mov(IceType_i32, Encoded_GPR_edx(), Immediate(0x00));
1212fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ mov(IceType_i32, Encoded_GPR_edi(), Immediate(0x00));
1222fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ mov(IceType_i32, Encoded_GPR_esi(), Immediate(0x00));
1232fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ mov(IceType_i32, Encoded_GPR_ebp(), Immediate(0x00));
1242fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ mov(IceType_i32, Encoded_GPR_r8(), Immediate(0x00));
1252fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ mov(IceType_i32, Encoded_GPR_r10(), Immediate(0x00));
1262fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ mov(IceType_i32, Encoded_GPR_r11(), Immediate(0x00));
1272fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ mov(IceType_i32, Encoded_GPR_r12(), Immediate(0x00));
1282fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ mov(IceType_i32, Encoded_GPR_r13(), Immediate(0x00));
1292fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ mov(IceType_i32, Encoded_GPR_r14(), Immediate(0x00));
1302fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  __ mov(IceType_i32, Encoded_GPR_r15(), Immediate(0x00));
1312fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
1322fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  constexpr uint8_t Rex_B = 0x41;
1332fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  constexpr size_t MovReg32BitImmBytes = 5;
1342fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  constexpr size_t ByteCount = 14 * MovReg32BitImmBytes + 7 /*Rex_B*/;
1352fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
1362fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  ASSERT_EQ(ByteCount, codeBytesSize());
1372fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
1382fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  constexpr uint8_t MovOpcode = 0xb8;
1392fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  verifyBytes<ByteCount>(
1402fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      codeBytes(), MovOpcode | Encoded_GPR_eax(), 0x00, 0x00, 0x00, 0x00,
1412fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      MovOpcode | Encoded_GPR_ebx(), 0x00, 0x00, 0x00, 0x00,
1422fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      MovOpcode | Encoded_GPR_ecx(), 0x00, 0x00, 0x00, 0x00,
1432fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      MovOpcode | Encoded_GPR_edx(), 0x00, 0x00, 0x00, 0x00,
1442fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      MovOpcode | Encoded_GPR_edi(), 0x00, 0x00, 0x00, 0x00,
1452fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      MovOpcode | Encoded_GPR_esi(), 0x00, 0x00, 0x00, 0x00,
1462fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      MovOpcode | Encoded_GPR_ebp(), 0x00, 0x00, 0x00, 0x00, Rex_B,
1472fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      MovOpcode | (Encoded_GPR_r8() & 7), 0x00, 0x00, 0x00, 0x00, Rex_B,
1482fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      MovOpcode | (Encoded_GPR_r10() & 7), 0x00, 0x00, 0x00, 0x00, Rex_B,
1492fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      MovOpcode | (Encoded_GPR_r11() & 7), 0x00, 0x00, 0x00, 0x00, Rex_B,
1502fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      MovOpcode | (Encoded_GPR_r12() & 7), 0x00, 0x00, 0x00, 0x00, Rex_B,
1512fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      MovOpcode | (Encoded_GPR_r13() & 7), 0x00, 0x00, 0x00, 0x00, Rex_B,
1522fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      MovOpcode | (Encoded_GPR_r14() & 7), 0x00, 0x00, 0x00, 0x00, Rex_B,
1532fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto      MovOpcode | (Encoded_GPR_r15() & 7), 0x00, 0x00, 0x00, 0x00);
1542fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto}
1552fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
1562fea26cae5a6b140c67e18aec3dcf645a16694d5John PortoTEST_F(AssemblerX8664LowLevelTest, Cmp) {
1572fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto#define TestRegReg(Inst, Dst, Src, OpType, ByteCountUntyped, ...)              \
1582fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  do {                                                                         \
1592fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    static constexpr char TestString[] =                                       \
1602fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto        "(" #Inst ", " #Dst ", " #Src ", " #OpType ", " #ByteCountUntyped      \
1612fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto        ",  " #__VA_ARGS__ ")";                                                \
1622fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    static constexpr uint8_t ByteCount = ByteCountUntyped;                     \
1632fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    __ Inst(IceType_##OpType, Encoded_GPR_##Dst(), Encoded_GPR_##Src());       \
1642fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    ASSERT_EQ(ByteCount, codeBytesSize()) << TestString;                       \
1652fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    ASSERT_TRUE(verifyBytes<ByteCount>(codeBytes(), __VA_ARGS__))              \
1662fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto        << TestString;                                                         \
1672fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    reset();                                                                   \
1682fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  } while (0)
1692fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
1702fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto#define TestRegImm(Inst, Dst, Imm, OpType, ByteCountUntyped, ...)              \
1712fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  do {                                                                         \
1722fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    static constexpr char TestString[] =                                       \
1732fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto        "(" #Inst ", " #Dst ", " #Imm ", " #OpType ", " #ByteCountUntyped      \
1742fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto        ",  " #__VA_ARGS__ ")";                                                \
1752fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    static constexpr uint8_t ByteCount = ByteCountUntyped;                     \
1762fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    __ Inst(IceType_##OpType, Encoded_GPR_##Dst(), Immediate(Imm));            \
1772fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    ASSERT_EQ(ByteCount, codeBytesSize()) << TestString;                       \
1782fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    ASSERT_TRUE(verifyBytes<ByteCount>(codeBytes(), __VA_ARGS__))              \
1792fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto        << TestString;                                                         \
1802fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    reset();                                                                   \
1812fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  } while (0)
1822fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
1832fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto#define TestRegAbsoluteAddr(Inst, Dst, Disp, OpType, ByteCountUntyped, ...)    \
1842fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  do {                                                                         \
1852fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    static constexpr char TestString[] =                                       \
1862fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto        "(" #Inst ", " #Dst ", " #Disp ", " #OpType ", " #ByteCountUntyped     \
1872fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto        ",  " #__VA_ARGS__ ")";                                                \
1882fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    static constexpr uint8_t ByteCount = ByteCountUntyped;                     \
189d1bd1d330c8eb8116811ad4dc01fe636b80b86cbJohn Porto    __ Inst(IceType_##OpType, Encoded_GPR_##Dst(), Address::Absolute(Disp));   \
1902fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    ASSERT_EQ(ByteCount, codeBytesSize()) << TestString;                       \
1912fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    ASSERT_TRUE(verifyBytes<ByteCount>(codeBytes(), __VA_ARGS__))              \
1922fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto        << TestString;                                                         \
1932fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    reset();                                                                   \
1942fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  } while (0)
1952fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
1962fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto#define TestRegAddrBase(Inst, Dst, Base, Disp, OpType, ByteCountUntyped, ...)  \
1972fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  do {                                                                         \
1982fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    static constexpr char TestString[] =                                       \
1992fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto        "(" #Inst ", " #Dst ", " #Base ", " #Disp ", " #OpType                 \
2002fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto        ", " #ByteCountUntyped ",  " #__VA_ARGS__ ")";                         \
2012fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    static constexpr uint8_t ByteCount = ByteCountUntyped;                     \
2022fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    __ Inst(IceType_##OpType, Encoded_GPR_##Dst(),                             \
203aa0b1a176f6c3306be3e95374d72e735bab2bbabDavid Sehr            Address(Encoded_GPR_##Base(), Disp, AssemblerFixup::NoFixup));     \
2042fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    ASSERT_EQ(ByteCount, codeBytesSize()) << TestString;                       \
2052fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    ASSERT_TRUE(verifyBytes<ByteCount>(codeBytes(), __VA_ARGS__))              \
2062fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto        << TestString;                                                         \
2072fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    reset();                                                                   \
2082fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  } while (0)
2092fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
2102fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto#define TestRegAddrScaledIndex(Inst, Dst, Index, Scale, Disp, OpType,          \
2112fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                               ByteCountUntyped, ...)                          \
2122fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  do {                                                                         \
2132fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    static constexpr char TestString[] =                                       \
2142fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto        "(" #Inst ", " #Dst ", " #Index ", " #Scale ", " #Disp ", " #OpType    \
2152fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto        ", " #ByteCountUntyped ",  " #__VA_ARGS__ ")";                         \
2162fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    static constexpr uint8_t ByteCount = ByteCountUntyped;                     \
2175bff61c44841990680781892036adb17b3cff0c4Jim Stichnoth    __ Inst(IceType_##OpType, Encoded_GPR_##Dst(),                             \
2185bff61c44841990680781892036adb17b3cff0c4Jim Stichnoth            Address(Encoded_GPR_##Index(), Traits::TIMES_##Scale, Disp,        \
2195bff61c44841990680781892036adb17b3cff0c4Jim Stichnoth                    AssemblerFixup::NoFixup));                                 \
2202fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    ASSERT_EQ(ByteCount, codeBytesSize()) << TestString;                       \
2212fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    ASSERT_TRUE(verifyBytes<ByteCount>(codeBytes(), __VA_ARGS__))              \
2222fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto        << TestString;                                                         \
2232fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    reset();                                                                   \
2242fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  } while (0)
2252fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
2262fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto#define TestRegAddrBaseScaledIndex(Inst, Dst, Base, Index, Scale, Disp,        \
2272fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                                   OpType, ByteCountUntyped, ...)              \
2282fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  do {                                                                         \
2292fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    static constexpr char TestString[] =                                       \
2302fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto        "(" #Inst ", " #Dst ", " #Base ", " #Index ", " #Scale ", " #Disp      \
2312fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto        ", " #OpType ", " #ByteCountUntyped ",  " #__VA_ARGS__ ")";            \
2322fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    static constexpr uint8_t ByteCount = ByteCountUntyped;                     \
2332fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    __ Inst(IceType_##OpType, Encoded_GPR_##Dst(),                             \
2342fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto            Address(Encoded_GPR_##Base(), Encoded_GPR_##Index(),               \
235aa0b1a176f6c3306be3e95374d72e735bab2bbabDavid Sehr                    Traits::TIMES_##Scale, Disp, AssemblerFixup::NoFixup));    \
2362fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    ASSERT_EQ(ByteCount, codeBytesSize()) << TestString;                       \
2372fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    ASSERT_TRUE(verifyBytes<ByteCount>(codeBytes(), __VA_ARGS__))              \
2382fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto        << TestString;                                                         \
2392fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    reset();                                                                   \
2402fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  } while (0)
2412fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
2422fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto#define TestAddrBaseScaledIndexImm(Inst, Base, Index, Scale, Disp, Imm,        \
2432fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                                   OpType, ByteCountUntyped, ...)              \
2442fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  do {                                                                         \
2452fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    static constexpr char TestString[] =                                       \
2462fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto        "(" #Inst ", " #Base ", " #Index ", " #Scale ", " #Disp ", " #Imm      \
2472fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto        ", " #OpType ", " #ByteCountUntyped ",  " #__VA_ARGS__ ")";            \
2482fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    static constexpr uint8_t ByteCount = ByteCountUntyped;                     \
2492fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    __ Inst(IceType_##OpType,                                                  \
2502fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto            Address(Encoded_GPR_##Base(), Encoded_GPR_##Index(),               \
251aa0b1a176f6c3306be3e95374d72e735bab2bbabDavid Sehr                    Traits::TIMES_##Scale, Disp, AssemblerFixup::NoFixup),     \
2522fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto            Immediate(Imm));                                                   \
2532fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    ASSERT_EQ(ByteCount, codeBytesSize()) << TestString;                       \
2542fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    ASSERT_TRUE(verifyBytes<ByteCount>(codeBytes(), __VA_ARGS__))              \
2552fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto        << TestString;                                                         \
2562fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    reset();                                                                   \
2572fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  } while (0)
2582fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
2592fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto#define TestAddrBaseScaledIndexReg(Inst, Base, Index, Scale, Disp, Src,        \
2602fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                                   OpType, ByteCountUntyped, ...)              \
2612fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  do {                                                                         \
2622fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    static constexpr char TestString[] =                                       \
2632fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto        "(" #Inst ", " #Base ", " #Index ", " #Scale ", " #Disp ", " #Src      \
2642fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto        ", " #OpType ", " #ByteCountUntyped ",  " #__VA_ARGS__ ")";            \
2652fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    static constexpr uint8_t ByteCount = ByteCountUntyped;                     \
2662fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    __ Inst(IceType_##OpType,                                                  \
2672fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto            Address(Encoded_GPR_##Base(), Encoded_GPR_##Index(),               \
268aa0b1a176f6c3306be3e95374d72e735bab2bbabDavid Sehr                    Traits::TIMES_##Scale, Disp, AssemblerFixup::NoFixup),     \
2692fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto            Encoded_GPR_##Src());                                              \
2702fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    ASSERT_EQ(ByteCount, codeBytesSize()) << TestString;                       \
2712fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    ASSERT_TRUE(verifyBytes<ByteCount>(codeBytes(), __VA_ARGS__))              \
2722fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto        << TestString;                                                         \
2732fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto    reset();                                                                   \
2742fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  } while (0)
2752fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
2762fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  /* cmp GPR, GPR */
2772fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, eax, ecx, i32, 2, 0x3B, 0xC1);
2782fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, ecx, edx, i32, 2, 0x3B, 0xCA);
2792fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, edx, ebx, i32, 2, 0x3B, 0xD3);
2802fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, ebx, esp, i32, 2, 0x3B, 0xDC);
2812fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, esp, ebp, i32, 2, 0x3B, 0xE5);
2822fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, ebp, esi, i32, 2, 0x3B, 0xEE);
2832fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, esi, edi, i32, 2, 0x3B, 0xF7);
2842fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, edi, r8, i32, 3, 0x41, 0x3B, 0xF8);
2852fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, r8, r9, i32, 3, 0x45, 0x3B, 0xC1);
2862fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, r9, r10, i32, 3, 0x45, 0x3B, 0xCA);
2872fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, r10, r11, i32, 3, 0x45, 0x3B, 0xD3);
2882fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, r11, r12, i32, 3, 0x45, 0x3B, 0xDC);
2892fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, r12, r13, i32, 3, 0x45, 0x3B, 0xE5);
2902fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, r13, r14, i32, 3, 0x45, 0x3B, 0xEE);
2912fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, r14, r15, i32, 3, 0x45, 0x3B, 0xF7);
2922fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, r15, eax, i32, 3, 0x44, 0x3B, 0xF8);
2932fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
2942fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, eax, ecx, i16, 3, 0x66, 0x3B, 0xC1);
2952fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, ecx, edx, i16, 3, 0x66, 0x3B, 0xCA);
2962fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, edx, ebx, i16, 3, 0x66, 0x3B, 0xD3);
2972fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, ebx, esp, i16, 3, 0x66, 0x3B, 0xDC);
2982fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, esp, ebp, i16, 3, 0x66, 0x3B, 0xE5);
2992fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, ebp, esi, i16, 3, 0x66, 0x3B, 0xEE);
3002fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, esi, edi, i16, 3, 0x66, 0x3B, 0xF7);
3012fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, edi, r8, i16, 4, 0x66, 0x41, 0x3B, 0xF8);
3022fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, r8, r9, i16, 4, 0x66, 0x45, 0x3B, 0xC1);
3032fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, r9, r10, i16, 4, 0x66, 0x45, 0x3B, 0xCA);
3042fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, r10, r11, i16, 4, 0x66, 0x45, 0x3B, 0xD3);
3052fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, r11, r12, i16, 4, 0x66, 0x45, 0x3B, 0xDC);
3062fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, r12, r13, i16, 4, 0x66, 0x45, 0x3B, 0xE5);
3072fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, r13, r14, i16, 4, 0x66, 0x45, 0x3B, 0xEE);
3082fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, r14, r15, i16, 4, 0x66, 0x45, 0x3B, 0xF7);
3092fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, r15, eax, i16, 4, 0x66, 0x44, 0x3B, 0xF8);
3102fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
3112fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, eax, ecx, i8, 2, 0x3A, 0xC1);
3122fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, ecx, edx, i8, 2, 0x3A, 0xCA);
3132fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, edx, ebx, i8, 2, 0x3A, 0xD3);
3143c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegReg(cmp, ebx, esp, i8, 2, 0x3A, 0xDC); // emit: cmp bl, ah
3152fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, esp, ebp, i8, 3, 0x40, 0x3A, 0xE5);
3162fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, ebp, esi, i8, 3, 0x40, 0x3A, 0xEE);
3172fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, esi, edi, i8, 3, 0x40, 0x3A, 0xF7);
3182fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, edi, r8, i8, 3, 0x41, 0x3A, 0xF8);
3192fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, r8, r9, i8, 3, 0x45, 0x3A, 0xC1);
3202fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, r9, r10, i8, 3, 0x45, 0x3A, 0xCA);
3212fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, r10, r11, i8, 3, 0x45, 0x3A, 0xD3);
3222fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, r11, r12, i8, 3, 0x45, 0x3A, 0xDC);
3232fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, r12, r13, i8, 3, 0x45, 0x3A, 0xE5);
3242fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, r13, r14, i8, 3, 0x45, 0x3A, 0xEE);
3252fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, r14, r15, i8, 3, 0x45, 0x3A, 0xF7);
3262fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegReg(cmp, r15, eax, i8, 3, 0x44, 0x3A, 0xF8);
3272fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
3282fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  /* cmp GPR, Imm8 */
3292fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, eax, 5, i32, 3, 0x83, 0xF8, 0x05);
3302fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, ecx, 5, i32, 3, 0x83, 0xF9, 0x05);
3312fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, edx, 5, i32, 3, 0x83, 0xFA, 0x05);
3322fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, ebx, 5, i32, 3, 0x83, 0xFB, 0x05);
3332fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, esp, 5, i32, 3, 0x83, 0xFC, 0x05);
3342fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, ebp, 5, i32, 3, 0x83, 0xFD, 0x05);
3352fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, esi, 5, i32, 3, 0x83, 0xFE, 0x05);
3362fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, edi, 5, i32, 3, 0x83, 0xFF, 0x05);
3372fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r8, 5, i32, 4, 0x41, 0x83, 0xF8, 0x05);
3382fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r9, 5, i32, 4, 0x41, 0x83, 0xF9, 0x05);
3392fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r10, 5, i32, 4, 0x41, 0x83, 0xFA, 0x05);
3402fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r11, 5, i32, 4, 0x41, 0x83, 0xFB, 0x05);
3412fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r12, 5, i32, 4, 0x41, 0x83, 0xFC, 0x05);
3422fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r13, 5, i32, 4, 0x41, 0x83, 0xFD, 0x05);
3432fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r14, 5, i32, 4, 0x41, 0x83, 0xFE, 0x05);
3442fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r15, 5, i32, 4, 0x41, 0x83, 0xFF, 0x05);
3452fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
3462fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, eax, 5, i16, 4, 0x66, 0x83, 0xF8, 0x05);
3472fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, ecx, 5, i16, 4, 0x66, 0x83, 0xF9, 0x05);
3482fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, edx, 5, i16, 4, 0x66, 0x83, 0xFA, 0x05);
3492fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, ebx, 5, i16, 4, 0x66, 0x83, 0xFB, 0x05);
3502fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, esp, 5, i16, 4, 0x66, 0x83, 0xFC, 0x05);
3512fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, ebp, 5, i16, 4, 0x66, 0x83, 0xFD, 0x05);
3522fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, esi, 5, i16, 4, 0x66, 0x83, 0xFE, 0x05);
3532fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, edi, 5, i16, 4, 0x66, 0x83, 0xFF, 0x05);
3542fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r8, 5, i16, 5, 0x66, 0x41, 0x83, 0xF8, 0x05);
3552fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r9, 5, i16, 5, 0x66, 0x41, 0x83, 0xF9, 0x05);
3562fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r10, 5, i16, 5, 0x66, 0x41, 0x83, 0xFA, 0x05);
3572fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r11, 5, i16, 5, 0x66, 0x41, 0x83, 0xFB, 0x05);
3582fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r12, 5, i16, 5, 0x66, 0x41, 0x83, 0xFC, 0x05);
3592fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r13, 5, i16, 5, 0x66, 0x41, 0x83, 0xFD, 0x05);
3602fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r14, 5, i16, 5, 0x66, 0x41, 0x83, 0xFE, 0x05);
3612fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r15, 5, i16, 5, 0x66, 0x41, 0x83, 0xFF, 0x05);
3622fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
3632fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, eax, 5, i8, 2, 0x3C, 0x05);
3642fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, ecx, 5, i8, 3, 0x80, 0xF9, 0x05);
3652fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, edx, 5, i8, 3, 0x80, 0xFA, 0x05);
3662fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, ebx, 5, i8, 3, 0x80, 0xFB, 0x05);
3673c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegImm(cmp, esp, 5, i8, 3, 0x80, 0xFC, 0x05); // emit: cmp ah, 5
3682fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, ebp, 5, i8, 4, 0x40, 0x80, 0xFD, 0x05);
3692fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, esi, 5, i8, 4, 0x40, 0x80, 0xFE, 0x05);
3702fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, edi, 5, i8, 4, 0x40, 0x80, 0xFF, 0x05);
3712fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r8, 5, i8, 4, 0x41, 0x80, 0xF8, 0x05);
3722fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r9, 5, i8, 4, 0x41, 0x80, 0xF9, 0x05);
3732fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r10, 5, i8, 4, 0x41, 0x80, 0xFA, 0x05);
3742fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r11, 5, i8, 4, 0x41, 0x80, 0xFB, 0x05);
3752fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r12, 5, i8, 4, 0x41, 0x80, 0xFC, 0x05);
3762fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r13, 5, i8, 4, 0x41, 0x80, 0xFD, 0x05);
3772fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r14, 5, i8, 4, 0x41, 0x80, 0xFE, 0x05);
3782fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r15, 5, i8, 4, 0x41, 0x80, 0xFF, 0x05);
3792fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
3802fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  /* cmp GPR, Imm16 */
3812fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, eax, 0x100, i32, 5, 0x3D, 0x00, 0x01, 0x00, 0x00);
3822fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, ecx, 0x100, i32, 6, 0x81, 0xF9, 0x00, 0x01, 0x00, 0x00);
3832fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, edx, 0x100, i32, 6, 0x81, 0xFA, 0x00, 0x01, 0x00, 0x00);
3842fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, ebx, 0x100, i32, 6, 0x81, 0xFB, 0x00, 0x01, 0x00, 0x00);
3852fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, esp, 0x100, i32, 6, 0x81, 0xFC, 0x00, 0x01, 0x00, 0x00);
3862fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, ebp, 0x100, i32, 6, 0x81, 0xFD, 0x00, 0x01, 0x00, 0x00);
3872fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, esi, 0x100, i32, 6, 0x81, 0xFE, 0x00, 0x01, 0x00, 0x00);
3882fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, edi, 0x100, i32, 6, 0x81, 0xFF, 0x00, 0x01, 0x00, 0x00);
3892fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r8, 0x100, i32, 7, 0x41, 0x81, 0xF8, 0x00, 0x01, 0x00, 0x00);
3902fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r9, 0x100, i32, 7, 0x41, 0x81, 0xF9, 0x00, 0x01, 0x00, 0x00);
3912fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r10, 0x100, i32, 7, 0x41, 0x81, 0xFA, 0x00, 0x01, 0x00, 0x00);
3922fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r11, 0x100, i32, 7, 0x41, 0x81, 0xFB, 0x00, 0x01, 0x00, 0x00);
3932fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r12, 0x100, i32, 7, 0x41, 0x81, 0xFC, 0x00, 0x01, 0x00, 0x00);
3942fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r13, 0x100, i32, 7, 0x41, 0x81, 0xFD, 0x00, 0x01, 0x00, 0x00);
3952fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r14, 0x100, i32, 7, 0x41, 0x81, 0xFE, 0x00, 0x01, 0x00, 0x00);
3962fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r15, 0x100, i32, 7, 0x41, 0x81, 0xFF, 0x00, 0x01, 0x00, 0x00);
3972fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
3982fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, eax, 0x100, i16, 4, 0x66, 0x3D, 0x00, 0x01);
3992fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, ecx, 0x100, i16, 5, 0x66, 0x81, 0xF9, 0x00, 0x01);
4002fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, edx, 0x100, i16, 5, 0x66, 0x81, 0xFA, 0x00, 0x01);
4012fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, ebx, 0x100, i16, 5, 0x66, 0x81, 0xFB, 0x00, 0x01);
4022fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, esp, 0x100, i16, 5, 0x66, 0x81, 0xFC, 0x00, 0x01);
4032fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, ebp, 0x100, i16, 5, 0x66, 0x81, 0xFD, 0x00, 0x01);
4042fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, esi, 0x100, i16, 5, 0x66, 0x81, 0xFE, 0x00, 0x01);
4052fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, edi, 0x100, i16, 5, 0x66, 0x81, 0xFF, 0x00, 0x01);
4062fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r8, 0x100, i16, 6, 0x66, 0x41, 0x81, 0xF8, 0x00, 0x01);
4072fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r9, 0x100, i16, 6, 0x66, 0x41, 0x81, 0xF9, 0x00, 0x01);
4082fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r10, 0x100, i16, 6, 0x66, 0x41, 0x81, 0xFA, 0x00, 0x01);
4092fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r11, 0x100, i16, 6, 0x66, 0x41, 0x81, 0xFB, 0x00, 0x01);
4102fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r12, 0x100, i16, 6, 0x66, 0x41, 0x81, 0xFC, 0x00, 0x01);
4112fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r13, 0x100, i16, 6, 0x66, 0x41, 0x81, 0xFD, 0x00, 0x01);
4122fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r14, 0x100, i16, 6, 0x66, 0x41, 0x81, 0xFE, 0x00, 0x01);
4132fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  TestRegImm(cmp, r15, 0x100, i16, 6, 0x66, 0x41, 0x81, 0xFF, 0x00, 0x01);
4142fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
4152fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  /* cmp GPR, Absolute */
4163c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAbsoluteAddr(cmp, eax, 0xF00FBEEF, i32, 8, 0x67, 0x3B, 0x04, 0x25,
4173c275ce1e832ba9ccfb730c4235db786cf080465John Porto                      0xEF, 0xBE, 0x0F, 0xF0);
4183c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAbsoluteAddr(cmp, eax, 0xF00FBEEF, i16, 9, 0x66, 0x67, 0x3B, 0x04,
4193c275ce1e832ba9ccfb730c4235db786cf080465John Porto                      0x25, 0xEF, 0xBE, 0x0F, 0xF0);
4203c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAbsoluteAddr(cmp, eax, 0xF00FBEEF, i8, 8, 0x67, 0x3A, 0x04, 0x25, 0xEF,
4212fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                      0xBE, 0x0F, 0xF0);
4223c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAbsoluteAddr(cmp, r8, 0xF00FBEEF, i32, 9, 0x67, 0x44, 0x3B, 0x04, 0x25,
4233c275ce1e832ba9ccfb730c4235db786cf080465John Porto                      0xEF, 0xBE, 0x0F, 0xF0);
4243c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAbsoluteAddr(cmp, r8, 0xF00FBEEF, i16, 10, 0x66, 0x67, 0x44, 0x3B,
4253c275ce1e832ba9ccfb730c4235db786cf080465John Porto                      0x04, 0x25, 0xEF, 0xBE, 0x0F, 0xF0);
4263c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAbsoluteAddr(cmp, r8, 0xF00FBEEF, i8, 9, 0x67, 0x44, 0x3A, 0x04, 0x25,
4273c275ce1e832ba9ccfb730c4235db786cf080465John Porto                      0xEF, 0xBE, 0x0F, 0xF0);
4282fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
4292fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  /* cmp GPR, 0(Base) */
4303c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, eax, ecx, 0, i32, 3, 0x67, 0x3B, 0x01);
4313c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, ecx, edx, 0, i32, 3, 0x67, 0x3B, 0x0A);
4323c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, edx, ebx, 0, i32, 3, 0x67, 0x3B, 0x13);
4333c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, ebx, esp, 0, i32, 4, 0x67, 0x3B, 0x1C, 0x24);
4343c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, esp, ebp, 0, i32, 4, 0x67, 0x3B, 0x65, 0x00);
4353c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, ebp, esi, 0, i32, 3, 0x67, 0x3B, 0x2E);
4363c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, esi, edi, 0, i32, 3, 0x67, 0x3B, 0x37);
4373c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, edi, r8, 0, i32, 4, 0x67, 0x41, 0x3B, 0x38);
4383c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r8, r9, 0, i32, 4, 0x67, 0x45, 0x3B, 0x01);
4393c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r9, r10, 0, i32, 4, 0x67, 0x45, 0x3B, 0x0A);
4403c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r10, r11, 0, i32, 4, 0x67, 0x45, 0x3B, 0x13);
4413c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r11, r12, 0, i32, 5, 0x67, 0x45, 0x3B, 0x1C, 0x24);
4423c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r12, r13, 0, i32, 5, 0x67, 0x45, 0x3B, 0x65, 0x00);
4433c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r13, r14, 0, i32, 4, 0x67, 0x45, 0x3B, 0x2E);
4443c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r14, r15, 0, i32, 4, 0x67, 0x45, 0x3B, 0x37);
4453c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r15, eax, 0, i32, 4, 0x67, 0x44, 0x3B, 0x38);
4463c275ce1e832ba9ccfb730c4235db786cf080465John Porto
4473c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, eax, ecx, 0, i16, 4, 0x66, 0x67, 0x3B, 0x01);
4483c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, ecx, edx, 0, i16, 4, 0x66, 0x67, 0x3B, 0x0A);
4493c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, edx, ebx, 0, i16, 4, 0x66, 0x67, 0x3B, 0x13);
4503c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, ebx, esp, 0, i16, 5, 0x66, 0x67, 0x3B, 0x1C, 0x24);
4513c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, esp, ebp, 0, i16, 5, 0x66, 0x67, 0x3B, 0x65, 0x00);
4523c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, ebp, esi, 0, i16, 4, 0x66, 0x67, 0x3B, 0x2E);
4533c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, esi, edi, 0, i16, 4, 0x66, 0x67, 0x3B, 0x37);
4543c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, edi, r8, 0, i16, 5, 0x66, 0x67, 0x41, 0x3B, 0x38);
4553c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r8, r9, 0, i16, 5, 0x66, 0x67, 0x45, 0x3B, 0x01);
4563c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r9, r10, 0, i16, 5, 0x66, 0x67, 0x45, 0x3B, 0x0A);
4573c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r10, r11, 0, i16, 5, 0x66, 0x67, 0x45, 0x3B, 0x13);
4583c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r11, r12, 0, i16, 6, 0x66, 0x67, 0x45, 0x3B, 0x1C, 0x24);
4593c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r12, r13, 0, i16, 6, 0x66, 0x67, 0x45, 0x3B, 0x65, 0x00);
4603c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r13, r14, 0, i16, 5, 0x66, 0x67, 0x45, 0x3B, 0x2E);
4613c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r14, r15, 0, i16, 5, 0x66, 0x67, 0x45, 0x3B, 0x37);
4623c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r15, eax, 0, i16, 5, 0x66, 0x67, 0x44, 0x3B, 0x38);
4633c275ce1e832ba9ccfb730c4235db786cf080465John Porto
4643c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, eax, ecx, 0, i8, 3, 0x67, 0x3A, 0x01);
4653c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, ecx, edx, 0, i8, 3, 0x67, 0x3A, 0x0A);
4663c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, edx, ebx, 0, i8, 3, 0x67, 0x3A, 0x13);
4673c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, ebx, esp, 0, i8, 4, 0x67, 0x3A, 0x1C, 0x24);
4683c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, esp, ebp, 0, i8, 4, 0x67, 0x3A, 0x65, 0x00);
4693c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, ebp, esi, 0, i8, 4, 0x67, 0x40, 0x3A, 0x2E);
4703c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, esi, edi, 0, i8, 4, 0x67, 0x40, 0x3A, 0x37);
4713c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, edi, r8, 0, i8, 4, 0x67, 0x41, 0x3A, 0x38);
4723c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r8, r9, 0, i8, 4, 0x67, 0x45, 0x3A, 0x01);
4733c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r9, r10, 0, i8, 4, 0x67, 0x45, 0x3A, 0x0A);
4743c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r10, r11, 0, i8, 4, 0x67, 0x45, 0x3A, 0x13);
4753c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r11, r12, 0, i8, 5, 0x67, 0x45, 0x3A, 0x1C, 0x24);
4763c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r12, r13, 0, i8, 5, 0x67, 0x45, 0x3A, 0x65, 0x00);
4773c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r13, r14, 0, i8, 4, 0x67, 0x45, 0x3A, 0x2E);
4783c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r14, r15, 0, i8, 4, 0x67, 0x45, 0x3A, 0x37);
4793c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r15, eax, 0, i8, 4, 0x67, 0x44, 0x3A, 0x38);
4802fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
4812fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  /* cmp GPR, Imm8(Base) */
4823c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, eax, ecx, 0x40, i32, 4, 0x67, 0x3B, 0x41, 0x40);
4833c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, ecx, edx, 0x40, i32, 4, 0x67, 0x3B, 0x4A, 0x40);
4843c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, edx, ebx, 0x40, i32, 4, 0x67, 0x3B, 0x53, 0x40);
4853c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, ebx, esp, 0x40, i32, 5, 0x67, 0x3B, 0x5C, 0x24, 0x40);
4863c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, esp, ebp, 0x40, i32, 4, 0x67, 0x3B, 0x65, 0x40);
4873c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, ebp, esi, 0x40, i32, 4, 0x67, 0x3B, 0x6E, 0x40);
4883c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, esi, edi, 0x40, i32, 4, 0x67, 0x3B, 0x77, 0x40);
4893c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, edi, r8, 0x40, i32, 5, 0x67, 0x41, 0x3B, 0x78, 0x40);
4903c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r8, r9, 0x40, i32, 5, 0x67, 0x45, 0x3B, 0x41, 0x40);
4913c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r9, r10, 0x40, i32, 5, 0x67, 0x45, 0x3B, 0x4A, 0x40);
4923c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r10, r11, 0x40, i32, 5, 0x67, 0x45, 0x3B, 0x53, 0x40);
4933c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r11, r12, 0x40, i32, 6, 0x67, 0x45, 0x3B, 0x5C, 0x24,
4943c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0x40);
4953c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r12, r13, 0x40, i32, 5, 0x67, 0x45, 0x3B, 0x65, 0x40);
4963c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r13, r14, 0x40, i32, 5, 0x67, 0x45, 0x3B, 0x6E, 0x40);
4973c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r14, r15, 0x40, i32, 5, 0x67, 0x45, 0x3B, 0x77, 0x40);
4983c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r15, eax, 0x40, i32, 5, 0x67, 0x44, 0x3B, 0x78, 0x40);
4993c275ce1e832ba9ccfb730c4235db786cf080465John Porto
5003c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, eax, ecx, 0x40, i16, 5, 0x66, 0x67, 0x3B, 0x41, 0x40);
5013c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, ecx, edx, 0x40, i16, 5, 0x66, 0x67, 0x3B, 0x4A, 0x40);
5023c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, edx, ebx, 0x40, i16, 5, 0x66, 0x67, 0x3B, 0x53, 0x40);
5033c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, ebx, esp, 0x40, i16, 6, 0x66, 0x67, 0x3B, 0x5C, 0x24,
5043c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0x40);
5053c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, esp, ebp, 0x40, i16, 5, 0x66, 0x67, 0x3B, 0x65, 0x40);
5063c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, ebp, esi, 0x40, i16, 5, 0x66, 0x67, 0x3B, 0x6E, 0x40);
5073c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, esi, edi, 0x40, i16, 5, 0x66, 0x67, 0x3B, 0x77, 0x40);
5083c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, edi, r8, 0x40, i16, 6, 0x66, 0x67, 0x41, 0x3B, 0x78,
5093c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0x40);
5103c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r8, r9, 0x40, i16, 6, 0x66, 0x67, 0x45, 0x3B, 0x41,
5113c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0x40);
5123c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r9, r10, 0x40, i16, 6, 0x66, 0x67, 0x45, 0x3B, 0x4A,
5133c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0x40);
5143c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r10, r11, 0x40, i16, 6, 0x66, 0x67, 0x45, 0x3B, 0x53,
5153c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0x40);
5163c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r11, r12, 0x40, i16, 7, 0x66, 0x67, 0x45, 0x3B, 0x5C,
5173c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0x24, 0x40);
5183c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r12, r13, 0x40, i16, 6, 0x66, 0x67, 0x45, 0x3B, 0x65,
5193c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0x40);
5203c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r13, r14, 0x40, i16, 6, 0x66, 0x67, 0x45, 0x3B, 0x6E,
5213c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0x40);
5223c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r14, r15, 0x40, i16, 6, 0x66, 0x67, 0x45, 0x3B, 0x77,
5233c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0x40);
5243c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r15, eax, 0x40, i16, 6, 0x66, 0x67, 0x44, 0x3B, 0x78,
5252fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                  0x40);
5263c275ce1e832ba9ccfb730c4235db786cf080465John Porto
5273c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, eax, ecx, 0x40, i8, 4, 0x67, 0x3A, 0x41, 0x40);
5283c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, ecx, edx, 0x40, i8, 4, 0x67, 0x3A, 0x4A, 0x40);
5293c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, edx, ebx, 0x40, i8, 4, 0x67, 0x3A, 0x53, 0x40);
5303c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, ebx, esp, 0x40, i8, 5, 0x67, 0x3A, 0x5C, 0x24, 0x40);
5313c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, esp, ebp, 0x40, i8, 4, 0x67, 0x3A, 0x65, 0x40);
5323c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, ebp, esi, 0x40, i8, 5, 0x67, 0x40, 0x3A, 0x6E, 0x40);
5333c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, esi, edi, 0x40, i8, 5, 0x67, 0x40, 0x3A, 0x77, 0x40);
5343c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, edi, r8, 0x40, i8, 5, 0x67, 0x41, 0x3A, 0x78, 0x40);
5353c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r8, r9, 0x40, i8, 5, 0x67, 0x45, 0x3A, 0x41, 0x40);
5363c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r9, r10, 0x40, i8, 5, 0x67, 0x45, 0x3A, 0x4A, 0x40);
5373c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r10, r11, 0x40, i8, 5, 0x67, 0x45, 0x3A, 0x53, 0x40);
5383c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r11, r12, 0x40, i8, 6, 0x67, 0x45, 0x3A, 0x5C, 0x24,
5393c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0x40);
5403c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r12, r13, 0x40, i8, 5, 0x67, 0x45, 0x3A, 0x65, 0x40);
5413c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r13, r14, 0x40, i8, 5, 0x67, 0x45, 0x3A, 0x6E, 0x40);
5423c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r14, r15, 0x40, i8, 5, 0x67, 0x45, 0x3A, 0x77, 0x40);
5433c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r15, eax, 0x40, i8, 5, 0x67, 0x44, 0x3A, 0x78, 0x40);
5442fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
5452fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  /* cmp GPR, Imm32(Base) */
5463c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, eax, ecx, 0xF0, i32, 7, 0x67, 0x3B, 0x81, 0xF0, 0x00,
5472fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                  0x00, 0x00);
5483c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, ecx, edx, 0xF0, i32, 7, 0x67, 0x3B, 0x8A, 0xF0, 0x00,
5492fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                  0x00, 0x00);
5503c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, edx, ebx, 0xF0, i32, 7, 0x67, 0x3B, 0x93, 0xF0, 0x00,
5512fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                  0x00, 0x00);
5523c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, ebx, esp, 0xF0, i32, 8, 0x67, 0x3B, 0x9C, 0x24, 0xF0,
5532fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                  0x00, 0x00, 0x00);
5543c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, esp, ebp, 0xF0, i32, 7, 0x67, 0x3B, 0xA5, 0xF0, 0x00,
5552fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                  0x00, 0x00);
5563c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, ebp, esi, 0xF0, i32, 7, 0x67, 0x3B, 0xAE, 0xF0, 0x00,
5572fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                  0x00, 0x00);
5583c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, esi, edi, 0xF0, i32, 7, 0x67, 0x3B, 0xB7, 0xF0, 0x00,
5592fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                  0x00, 0x00);
5603c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, edi, r8, 0xF0, i32, 8, 0x67, 0x41, 0x3B, 0xB8, 0xF0,
5612fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                  0x00, 0x00, 0x00);
5623c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r8, r9, 0xF0, i32, 8, 0x67, 0x45, 0x3B, 0x81, 0xF0, 0x00,
5632fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                  0x00, 0x00);
5643c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r9, r10, 0xF0, i32, 8, 0x67, 0x45, 0x3B, 0x8A, 0xF0,
5652fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                  0x00, 0x00, 0x00);
5663c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r10, r11, 0xF0, i32, 8, 0x67, 0x45, 0x3B, 0x93, 0xF0,
5672fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                  0x00, 0x00, 0x00);
5683c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r11, r12, 0xF0, i32, 9, 0x67, 0x45, 0x3B, 0x9C, 0x24,
5693c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0xF0, 0x00, 0x00, 0x00);
5703c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r12, r13, 0xF0, i32, 8, 0x67, 0x45, 0x3B, 0xA5, 0xF0,
5713c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0x00, 0x00, 0x00);
5723c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r13, r14, 0xF0, i32, 8, 0x67, 0x45, 0x3B, 0xAE, 0xF0,
5733c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0x00, 0x00, 0x00);
5743c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r14, r15, 0xF0, i32, 8, 0x67, 0x45, 0x3B, 0xB7, 0xF0,
5753c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0x00, 0x00, 0x00);
5763c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r15, eax, 0xF0, i32, 8, 0x67, 0x44, 0x3B, 0xB8, 0xF0,
5773c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0x00, 0x00, 0x00);
5783c275ce1e832ba9ccfb730c4235db786cf080465John Porto
5793c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, eax, ecx, 0xF0, i16, 8, 0x66, 0x67, 0x3B, 0x81, 0xF0,
5802fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                  0x00, 0x00, 0x00);
5813c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, ecx, edx, 0xF0, i16, 8, 0x66, 0x67, 0x3B, 0x8A, 0xF0,
5823c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0x00, 0x00, 0x00);
5833c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, edx, ebx, 0xF0, i16, 8, 0x66, 0x67, 0x3B, 0x93, 0xF0,
5843c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0x00, 0x00, 0x00);
5853c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, ebx, esp, 0xF0, i16, 9, 0x66, 0x67, 0x3B, 0x9C, 0x24,
5862fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                  0xF0, 0x00, 0x00, 0x00);
5873c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, esp, ebp, 0xF0, i16, 8, 0x66, 0x67, 0x3B, 0xa5, 0xF0,
5882fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                  0x00, 0x00, 0x00);
5893c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, ebp, esi, 0xF0, i16, 8, 0x66, 0x67, 0x3B, 0xaE, 0xF0,
5902fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                  0x00, 0x00, 0x00);
5913c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, esi, edi, 0xF0, i16, 8, 0x66, 0x67, 0x3B, 0xb7, 0xF0,
5922fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                  0x00, 0x00, 0x00);
5933c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, edi, r8, 0xF0, i16, 9, 0x66, 0x67, 0x41, 0x3B, 0xb8,
5943c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0xF0, 0x00, 0x00, 0x00);
5953c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r8, r9, 0xF0, i16, 9, 0x66, 0x67, 0x45, 0x3B, 0x81, 0xF0,
5962fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                  0x00, 0x00, 0x00);
5973c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r9, r10, 0xF0, i16, 9, 0x66, 0x67, 0x45, 0x3B, 0x8A,
5983c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0xF0, 0x00, 0x00, 0x00);
5993c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r10, r11, 0xF0, i16, 9, 0x66, 0x67, 0x45, 0x3B, 0x93,
6003c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0xF0, 0x00, 0x00, 0x00);
6013c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r11, r12, 0xF0, i16, 10, 0x66, 0x67, 0x45, 0x3B, 0x9C,
6023c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0x24, 0xF0, 0x00, 0x00, 0x00);
6033c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r12, r13, 0xF0, i16, 9, 0x66, 0x67, 0x45, 0x3B, 0xa5,
6043c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0xF0, 0x00, 0x00, 0x00);
6053c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r13, r14, 0xF0, i16, 9, 0x66, 0x67, 0x45, 0x3B, 0xaE,
6063c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0xF0, 0x00, 0x00, 0x00);
6073c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r14, r15, 0xF0, i16, 9, 0x66, 0x67, 0x45, 0x3B, 0xb7,
6083c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0xF0, 0x00, 0x00, 0x00);
6093c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r15, eax, 0xF0, i16, 9, 0x66, 0x67, 0x44, 0x3B, 0xb8,
6103c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0xF0, 0x00, 0x00, 0x00);
6112fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
6123c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, eax, ecx, 0xF0, i8, 7, 0x67, 0x3A, 0x81, 0xF0, 0x00,
6132fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                  0x00, 0x00);
6143c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, ecx, edx, 0xF0, i8, 7, 0x67, 0x3A, 0x8A, 0xF0, 0x00,
6152fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                  0x00, 0x00);
6163c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, edx, ebx, 0xF0, i8, 7, 0x67, 0x3A, 0x93, 0xF0, 0x00,
6172fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                  0x00, 0x00);
6183c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, ebx, esp, 0xF0, i8, 8, 0x67, 0x3A, 0x9C, 0x24, 0xF0,
6192fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                  0x00, 0x00, 0x00);
6203c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, esp, ebp, 0xF0, i8, 7, 0x67, 0x3A, 0xA5, 0xF0, 0x00,
6212fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                  0x00, 0x00);
6223c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, ebp, esi, 0xF0, i8, 8, 0x67, 0x40, 0x3A, 0xAE, 0xF0,
6233c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0x00, 0x00, 0x00);
6243c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, esi, edi, 0xF0, i8, 8, 0x67, 0x40, 0x3A, 0xB7, 0xF0,
6253c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0x00, 0x00, 0x00);
6263c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, edi, r8, 0xF0, i8, 8, 0x67, 0x41, 0x3A, 0xB8, 0xF0, 0x00,
6272fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                  0x00, 0x00);
6283c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r8, r9, 0xF0, i8, 8, 0x67, 0x45, 0x3A, 0x81, 0xF0, 0x00,
6292fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                  0x00, 0x00);
6303c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r9, r10, 0xF0, i8, 8, 0x67, 0x45, 0x3A, 0x8A, 0xF0, 0x00,
6312fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                  0x00, 0x00);
6323c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r10, r11, 0xF0, i8, 8, 0x67, 0x45, 0x3A, 0x93, 0xF0,
6333c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0x00, 0x00, 0x00);
6343c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r11, r12, 0xF0, i8, 9, 0x67, 0x45, 0x3A, 0x9C, 0x24,
6353c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0xF0, 0x00, 0x00, 0x00);
6363c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r12, r13, 0xF0, i8, 8, 0x67, 0x45, 0x3A, 0xA5, 0xF0,
6373c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0x00, 0x00, 0x00);
6383c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r13, r14, 0xF0, i8, 8, 0x67, 0x45, 0x3A, 0xAE, 0xF0,
6393c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0x00, 0x00, 0x00);
6403c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r14, r15, 0xF0, i8, 8, 0x67, 0x45, 0x3A, 0xB7, 0xF0,
6413c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0x00, 0x00, 0x00);
6423c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBase(cmp, r15, eax, 0xF0, i8, 8, 0x67, 0x44, 0x3A, 0xB8, 0xF0,
6433c275ce1e832ba9ccfb730c4235db786cf080465John Porto                  0x00, 0x00, 0x00);
6442fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
6452fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  /* cmp GPR, Imm(,Index,Scale) */
6463c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, eax, ecx, 1, 0, i32, 8, 0x67, 0x3B, 0x04, 0x0D,
6472fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                         0x00, 0x00, 0x00, 0x00);
6483c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, ecx, edx, 2, 0, i32, 8, 0x67, 0x3B, 0x0C, 0x55,
6492fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                         0x00, 0x00, 0x00, 0x00);
6503c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, edx, ebx, 4, 0, i32, 8, 0x67, 0x3B, 0x14, 0x9D,
6512fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                         0x00, 0x00, 0x00, 0x00);
6523c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, r8, r9, 1, 0, i32, 9, 0x67, 0x46, 0x3B, 0x04,
6533c275ce1e832ba9ccfb730c4235db786cf080465John Porto                         0x0D, 0x00, 0x00, 0x00, 0x00);
6543c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, r9, r10, 2, 0, i32, 9, 0x67, 0x46, 0x3B, 0x0C,
6553c275ce1e832ba9ccfb730c4235db786cf080465John Porto                         0x55, 0x00, 0x00, 0x00, 0x00);
6563c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, r10, r11, 4, 0, i32, 9, 0x67, 0x46, 0x3B, 0x14,
6573c275ce1e832ba9ccfb730c4235db786cf080465John Porto                         0x9D, 0x00, 0x00, 0x00, 0x00);
6582fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  // esp cannot be an scaled index.
6593c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, esp, ebp, 8, 0, i32, 8, 0x67, 0x3B, 0x24, 0xED,
6602fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                         0x00, 0x00, 0x00, 0x00);
6613c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, ebp, esi, 1, 0, i32, 8, 0x67, 0x3B, 0x2C, 0x35,
6622fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                         0x00, 0x00, 0x00, 0x00);
6633c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, esi, edi, 2, 0, i32, 8, 0x67, 0x3B, 0x34, 0x7D,
6642fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                         0x00, 0x00, 0x00, 0x00);
6653c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, edi, eax, 4, 0, i32, 8, 0x67, 0x3B, 0x3C, 0x85,
6662fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                         0x00, 0x00, 0x00, 0x00);
6673c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, ebx, ecx, 8, 0, i32, 8, 0x67, 0x3B, 0x1C, 0xCD,
6682fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                         0x00, 0x00, 0x00, 0x00);
6693c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, r12, r13, 8, 0, i32, 9, 0x67, 0x46, 0x3B, 0x24,
6703c275ce1e832ba9ccfb730c4235db786cf080465John Porto                         0xED, 0x00, 0x00, 0x00, 0x00);
6713c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, r13, r14, 1, 0, i32, 9, 0x67, 0x46, 0x3B, 0x2C,
6723c275ce1e832ba9ccfb730c4235db786cf080465John Porto                         0x35, 0x00, 0x00, 0x00, 0x00);
6733c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, r14, r15, 2, 0, i32, 9, 0x67, 0x46, 0x3B, 0x34,
6743c275ce1e832ba9ccfb730c4235db786cf080465John Porto                         0x7D, 0x00, 0x00, 0x00, 0x00);
6753c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, r15, r8, 4, 0, i32, 9, 0x67, 0x46, 0x3B, 0x3C,
6763c275ce1e832ba9ccfb730c4235db786cf080465John Porto                         0x85, 0x00, 0x00, 0x00, 0x00);
6773c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, r11, r9, 8, 0, i32, 9, 0x67, 0x46, 0x3B, 0x1C,
6783c275ce1e832ba9ccfb730c4235db786cf080465John Porto                         0xCD, 0x00, 0x00, 0x00, 0x00);
6792fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
6803c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, eax, ecx, 8, 0, i16, 9, 0x66, 0x67, 0x3B, 0x04,
6812fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                         0xCD, 0x00, 0x00, 0x00, 0x00);
6823c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, ecx, edx, 1, 0, i16, 9, 0x66, 0x67, 0x3B, 0x0C,
6832fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                         0x15, 0x00, 0x00, 0x00, 0x00);
6843c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, edx, ebx, 2, 0, i16, 9, 0x66, 0x67, 0x3B, 0x14,
6852fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                         0x5D, 0x00, 0x00, 0x00, 0x00);
6863c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, r8, r9, 8, 0, i16, 10, 0x66, 0x67, 0x46, 0x3B,
6873c275ce1e832ba9ccfb730c4235db786cf080465John Porto                         0x04, 0xCD, 0x00, 0x00, 0x00, 0x00);
6883c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, r9, r10, 1, 0, i16, 10, 0x66, 0x67, 0x46, 0x3B,
6893c275ce1e832ba9ccfb730c4235db786cf080465John Porto                         0x0C, 0x15, 0x00, 0x00, 0x00, 0x00);
6903c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, r10, r11, 2, 0, i16, 10, 0x66, 0x67, 0x46, 0x3B,
6913c275ce1e832ba9ccfb730c4235db786cf080465John Porto                         0x14, 0x5D, 0x00, 0x00, 0x00, 0x00);
6922fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  // esp cannot be an scaled index.
6933c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, esp, ebp, 4, 0, i16, 9, 0x66, 0x67, 0x3B, 0x24,
6943c275ce1e832ba9ccfb730c4235db786cf080465John Porto                         0xAD, 0x00, 0x00, 0x00, 0x00);
6953c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, ebp, esi, 8, 0, i16, 9, 0x66, 0x67, 0x3B, 0x2C,
6963c275ce1e832ba9ccfb730c4235db786cf080465John Porto                         0xF5, 0x00, 0x00, 0x00, 0x00);
6973c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, esi, edi, 1, 0, i16, 9, 0x66, 0x67, 0x3B, 0x34,
6983c275ce1e832ba9ccfb730c4235db786cf080465John Porto                         0x3D, 0x00, 0x00, 0x00, 0x00);
6993c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, edi, eax, 2, 0, i16, 9, 0x66, 0x67, 0x3B, 0x3C,
7003c275ce1e832ba9ccfb730c4235db786cf080465John Porto                         0x45, 0x00, 0x00, 0x00, 0x00);
7013c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, ebx, ecx, 8, 0, i16, 9, 0x66, 0x67, 0x3B, 0x1C,
7023c275ce1e832ba9ccfb730c4235db786cf080465John Porto                         0xCD, 0x00, 0x00, 0x00, 0x00);
7032fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
7043c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, eax, ecx, 4, 0, i8, 8, 0x67, 0x3A, 0x04, 0x8D,
7052fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                         0x00, 0x00, 0x00, 0x00);
7063c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, ecx, edx, 8, 0, i8, 8, 0x67, 0x3A, 0x0C, 0xD5,
7072fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                         0x00, 0x00, 0x00, 0x00);
7083c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, edx, ebx, 1, 0, i8, 8, 0x67, 0x3A, 0x14, 0x1D,
7092fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                         0x00, 0x00, 0x00, 0x00);
7103c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, r8, r9, 4, 0, i8, 9, 0x67, 0x46, 0x3A, 0x04, 0x8D,
7112fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                         0x00, 0x00, 0x00, 0x00);
7123c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, r9, r10, 8, 0, i8, 9, 0x67, 0x46, 0x3A, 0x0C,
7133c275ce1e832ba9ccfb730c4235db786cf080465John Porto                         0xD5, 0x00, 0x00, 0x00, 0x00);
7143c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, r10, r11, 1, 0, i8, 9, 0x67, 0x46, 0x3A, 0x14,
7153c275ce1e832ba9ccfb730c4235db786cf080465John Porto                         0x1D, 0x00, 0x00, 0x00, 0x00);
7163c275ce1e832ba9ccfb730c4235db786cf080465John Porto  // esp cannot be an scaled index.
7173c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, esp, ebp, 2, 0, i8, 8, 0x67, 0x3A, 0x24, 0x6D,
7182fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                         0x00, 0x00, 0x00, 0x00);
7193c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, ebp, esi, 4, 0, i8, 9, 0x67, 0x40, 0x3A, 0x2C,
7203c275ce1e832ba9ccfb730c4235db786cf080465John Porto                         0xB5, 0x00, 0x00, 0x00, 0x00);
7213c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, esi, edi, 8, 0, i8, 9, 0x67, 0x40, 0x3A, 0x34,
7223c275ce1e832ba9ccfb730c4235db786cf080465John Porto                         0xFD, 0x00, 0x00, 0x00, 0x00);
7233c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, edi, eax, 1, 0, i8, 9, 0x67, 0x40, 0x3A, 0x3C,
7243c275ce1e832ba9ccfb730c4235db786cf080465John Porto                         0x05, 0x00, 0x00, 0x00, 0x00);
7253c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, ebx, ecx, 8, 0, i8, 8, 0x67, 0x3a, 0x1C, 0xCD,
7262fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                         0x00, 0x00, 0x00, 0x00);
7273c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, r12, r13, 2, 0, i8, 9, 0x67, 0x46, 0x3A, 0x24,
7283c275ce1e832ba9ccfb730c4235db786cf080465John Porto                         0x6D, 0x00, 0x00, 0x00, 0x00);
7293c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, r13, r14, 4, 0, i8, 9, 0x67, 0x46, 0x3A, 0x2C,
7303c275ce1e832ba9ccfb730c4235db786cf080465John Porto                         0xB5, 0x00, 0x00, 0x00, 0x00);
7313c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, r14, r15, 8, 0, i8, 9, 0x67, 0x46, 0x3A, 0x34,
7323c275ce1e832ba9ccfb730c4235db786cf080465John Porto                         0xFD, 0x00, 0x00, 0x00, 0x00);
7333c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, r15, r8, 1, 0, i8, 9, 0x67, 0x46, 0x3A, 0x3C,
7343c275ce1e832ba9ccfb730c4235db786cf080465John Porto                         0x05, 0x00, 0x00, 0x00, 0x00);
7353c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrScaledIndex(cmp, r11, r9, 8, 0, i8, 9, 0x67, 0x46, 0x3a, 0x1C,
7363c275ce1e832ba9ccfb730c4235db786cf080465John Porto                         0xCD, 0x00, 0x00, 0x00, 0x00);
7372fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
7382fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  /* cmp GPR, 0(Base,Index,Scale) */
7393c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, eax, ecx, edx, 1, 0, i32, 4, 0x67, 0x3B, 0x04,
7402fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x11);
7413c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ecx, edx, ebx, 2, 0, i32, 4, 0x67, 0x3B, 0x0C,
7422fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x5A);
7433c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r8, r9, r10, 1, 0, i32, 5, 0x67, 0x47, 0x3B,
7443c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x04, 0x11);
7453c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r9, r10, r11, 2, 0, i32, 5, 0x67, 0x47, 0x3B,
7463c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x0C, 0x5A);
7472fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  // esp cannot be an scaled index.
7483c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ebx, esp, ebp, 4, 0, i32, 4, 0x67, 0x3B, 0x1C,
7492fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0xAC);
7503c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, esp, ebp, esi, 8, 0, i32, 5, 0x67, 0x3B, 0x64,
7512fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0xF5, 0x00);
7523c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ebp, esi, edi, 1, 0, i32, 4, 0x67, 0x3B, 0x2C,
7532fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x3E);
7543c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, esi, edi, eax, 2, 0, i32, 4, 0x67, 0x3B, 0x34,
7552fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x47);
7563c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, edi, eax, ebx, 4, 0, i32, 4, 0x67, 0x3B, 0x3C,
7572fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x98);
7583c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ebx, ecx, edx, 8, 0, i32, 4, 0x67, 0x3B, 0x1C,
7592fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0xD1);
7603c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r11, r12, r13, 4, 0, i32, 5, 0x67, 0x47, 0x3B,
7613c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x1C, 0xAC);
7623c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r12, r13, r14, 8, 0, i32, 6, 0x67, 0x47, 0x3B,
7633c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x64, 0xF5, 0x00);
7643c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r13, r14, r15, 1, 0, i32, 5, 0x67, 0x47, 0x3B,
7653c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x2C, 0x3E);
7663c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r14, r15, r8, 2, 0, i32, 5, 0x67, 0x47, 0x3B,
7673c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x34, 0x47);
7683c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r15, r8, r11, 4, 0, i32, 5, 0x67, 0x47, 0x3B,
7693c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3C, 0x98);
7703c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r11, r9, r10, 8, 0, i32, 5, 0x67, 0x47, 0x3B,
7713c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x1C, 0xD1);
7722fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
7733c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, eax, ecx, edx, 1, 0, i16, 5, 0x66, 0x67, 0x3B,
7742fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x04, 0x11);
7753c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ecx, edx, ebx, 2, 0, i16, 5, 0x66, 0x67, 0x3B,
7762fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x0C, 0x5A);
7773c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r8, r9, r10, 1, 0, i16, 6, 0x66, 0x67, 0x47,
7783c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3B, 0x04, 0x11);
7793c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r9, r10, r11, 2, 0, i16, 6, 0x66, 0x67, 0x47,
7803c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3B, 0x0C, 0x5A);
7812fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  // esp cannot be an scaled index.
7823c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ebx, esp, ebp, 4, 0, i16, 5, 0x66, 0x67, 0x3B,
7832fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x1C, 0xAC);
7843c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, esp, ebp, esi, 8, 0, i16, 6, 0x66, 0x67, 0x3B,
7852fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x64, 0xF5, 0x00);
7863c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ebp, esi, edi, 1, 0, i16, 5, 0x66, 0x67, 0x3B,
7872fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x2C, 0x3E);
7883c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, esi, edi, eax, 2, 0, i16, 5, 0x66, 0x67, 0x3B,
7892fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x34, 0x47);
7903c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, edi, eax, ebx, 4, 0, i16, 5, 0x66, 0x67, 0x3B,
7912fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x3C, 0x98);
7923c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ebx, ecx, edx, 8, 0, i16, 5, 0x66, 0x67, 0x3B,
7932fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x1C, 0xD1);
7943c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r11, r12, r13, 4, 0, i16, 6, 0x66, 0x67, 0x47,
7953c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3B, 0x1C, 0xAC);
7963c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r12, r13, r14, 8, 0, i16, 7, 0x66, 0x67, 0x47,
7973c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3B, 0x64, 0xF5, 0x00);
7983c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r13, r14, r15, 1, 0, i16, 6, 0x66, 0x67, 0x47,
7993c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3B, 0x2C, 0x3E);
8003c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r14, r15, r8, 2, 0, i16, 6, 0x66, 0x67, 0x47,
8013c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3B, 0x34, 0x47);
8023c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r15, r8, r11, 4, 0, i16, 6, 0x66, 0x67, 0x47,
8033c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3B, 0x3C, 0x98);
8043c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r11, r9, r10, 8, 0, i16, 6, 0x66, 0x67, 0x47,
8053c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3B, 0x1C, 0xD1);
8063c275ce1e832ba9ccfb730c4235db786cf080465John Porto
8073c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, eax, ecx, edx, 1, 0, i8, 4, 0x67, 0x3A, 0x04,
8082fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x11);
8093c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ecx, edx, ebx, 2, 0, i8, 4, 0x67, 0x3A, 0x0C,
8102fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x5A);
8113c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r8, r9, r10, 1, 0, i8, 5, 0x67, 0x47, 0x3A,
8123c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x04, 0x11);
8133c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r9, r10, r11, 2, 0, i8, 5, 0x67, 0x47, 0x3A,
8143c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x0C, 0x5A);
8152fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  // esp cannot be an scaled index.
8163c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ebx, esp, ebp, 4, 0, i8, 4, 0x67, 0x3A, 0x1C,
8172fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0xAC);
8183c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, esp, ebp, esi, 8, 0, i8, 5, 0x67, 0x3A, 0x64,
8192fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0xF5, 0x00);
8203c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ebp, esi, edi, 1, 0, i8, 5, 0x67, 0x40, 0x3A,
8213c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x2C, 0x3E);
8223c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, esi, edi, eax, 2, 0, i8, 5, 0x67, 0x40, 0x3A,
8233c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x34, 0x47);
8243c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, edi, eax, ebx, 4, 0, i8, 5, 0x67, 0x40, 0x3A,
8253c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3C, 0x98);
8263c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ebx, ecx, edx, 8, 0, i8, 4, 0x67, 0x3A, 0x1C,
8272fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0xD1);
8283c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r11, r12, r13, 4, 0, i8, 5, 0x67, 0x47, 0x3A,
8293c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x1C, 0xAC);
8303c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r12, r13, r14, 8, 0, i8, 6, 0x67, 0x47, 0x3A,
8313c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x64, 0xF5, 0x00);
8323c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r13, r14, r15, 1, 0, i8, 5, 0x67, 0x47, 0x3A,
8333c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x2C, 0x3E);
8343c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r14, r15, r8, 2, 0, i8, 5, 0x67, 0x47, 0x3A,
8353c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x34, 0x47);
8363c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r15, r8, r11, 4, 0, i8, 5, 0x67, 0x47, 0x3A,
8373c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3C, 0x98);
8383c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r11, r9, r10, 8, 0, i8, 5, 0x67, 0x47, 0x3A,
8393c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x1C, 0xD1);
8402fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
8412fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  /* cmp GPR, Imm8(Base,Index,Scale) */
8423c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, eax, ecx, edx, 1, 0x40, i32, 5, 0x67, 0x3B,
8432fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x44, 0x11, 0x40);
8443c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ecx, edx, ebx, 2, 0x40, i32, 5, 0x67, 0x3B,
8452fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x4C, 0x5A, 0x40);
8463c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r8, r9, r10, 1, 0x40, i32, 6, 0x67, 0x47,
8473c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3B, 0x44, 0x11, 0x40);
8483c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r9, r10, r11, 2, 0x40, i32, 6, 0x67, 0x47,
8493c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3B, 0x4C, 0x5A, 0x40);
8502fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  // esp cannot be an scaled index.
8513c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ebx, esp, ebp, 4, 0x40, i32, 5, 0x67, 0x3B,
8522fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x5C, 0xAC, 0x40);
8533c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, esp, ebp, esi, 8, 0x40, i32, 5, 0x67, 0x3B,
8542fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x64, 0xF5, 0x40);
8553c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ebp, esi, edi, 1, 0x40, i32, 5, 0x67, 0x3B,
8562fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x6C, 0x3E, 0x40);
8573c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, esi, edi, eax, 2, 0x40, i32, 5, 0x67, 0x3B,
8582fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x74, 0x47, 0x40);
8593c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, edi, eax, ebx, 4, 0x40, i32, 5, 0x67, 0x3B,
8602fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x7C, 0x98, 0x40);
8613c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ebx, ecx, edx, 8, 0x40, i32, 5, 0x67, 0x3B,
8622fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x5C, 0xD1, 0x40);
8633c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r11, r12, r13, 4, 0x40, i32, 6, 0x67, 0x47,
8643c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3B, 0x5C, 0xAC, 0x40);
8653c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r12, r13, r14, 8, 0x40, i32, 6, 0x67, 0x47,
8663c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3B, 0x64, 0xF5, 0x40);
8673c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r13, r14, r15, 1, 0x40, i32, 6, 0x67, 0x47,
8683c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3B, 0x6C, 0x3E, 0x40);
8693c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r14, r15, r8, 2, 0x40, i32, 6, 0x67, 0x47,
8703c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3B, 0x74, 0x47, 0x40);
8713c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r15, r8, r11, 4, 0x40, i32, 6, 0x67, 0x47,
8723c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3B, 0x7C, 0x98, 0x40);
8733c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r11, r9, r10, 8, 0x40, i32, 6, 0x67, 0x47,
8743c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3B, 0x5C, 0xD1, 0x40);
8752fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
8763c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, eax, ecx, edx, 1, 0x40, i16, 6, 0x66, 0x67,
8772fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x3B, 0x44, 0x11, 0x40);
8783c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ecx, edx, ebx, 2, 0x40, i16, 6, 0x66, 0x67,
8792fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x3B, 0x4C, 0x5A, 0x40);
8803c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r8, r9, r10, 1, 0x40, i16, 7, 0x66, 0x67,
8813c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x47, 0x3B, 0x44, 0x11, 0x40);
8823c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r9, r10, r11, 2, 0x40, i16, 7, 0x66, 0x67,
8833c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x47, 0x3B, 0x4C, 0x5A, 0x40);
8842fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  // esp cannot be an scaled index.
8853c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ebx, esp, ebp, 4, 0x40, i16, 6, 0x66, 0x67,
8862fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x3B, 0x5C, 0xAC, 0x40);
8873c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, esp, ebp, esi, 8, 0x40, i16, 6, 0x66, 0x67,
8882fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x3B, 0x64, 0xF5, 0x40);
8893c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ebp, esi, edi, 1, 0x40, i16, 6, 0x66, 0x67,
8902fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x3B, 0x6C, 0x3E, 0x40);
8913c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, esi, edi, eax, 2, 0x40, i16, 6, 0x66, 0x67,
8922fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x3B, 0x74, 0x47, 0x40);
8933c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, edi, eax, ebx, 4, 0x40, i16, 6, 0x66, 0x67,
8942fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x3B, 0x7C, 0x98, 0x40);
8953c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ebx, ecx, edx, 8, 0x40, i16, 6, 0x66, 0x67,
8962fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x3B, 0x5C, 0xD1, 0x40);
8973c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r11, r12, r13, 4, 0x40, i16, 7, 0x66, 0x67,
8983c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x47, 0x3B, 0x5C, 0xAC, 0x40);
8993c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r12, r13, r14, 8, 0x40, i16, 7, 0x66, 0x67,
9003c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x47, 0x3B, 0x64, 0xF5, 0x40);
9013c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r13, r14, r15, 1, 0x40, i16, 7, 0x66, 0x67,
9023c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x47, 0x3B, 0x6C, 0x3E, 0x40);
9033c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r14, r15, r8, 2, 0x40, i16, 7, 0x66, 0x67,
9043c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x47, 0x3B, 0x74, 0x47, 0x40);
9053c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r15, r8, r11, 4, 0x40, i16, 7, 0x66, 0x67,
9063c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x47, 0x3B, 0x7C, 0x98, 0x40);
9073c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r11, r9, r10, 8, 0x40, i16, 7, 0x66, 0x67,
9083c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x47, 0x3B, 0x5C, 0xD1, 0x40);
9093c275ce1e832ba9ccfb730c4235db786cf080465John Porto
9103c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, eax, ecx, edx, 1, 0x40, i8, 5, 0x67, 0x3A,
9113c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x44, 0x11, 0x40);
9123c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ecx, edx, ebx, 2, 0x40, i8, 5, 0x67, 0x3A,
9132fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x4C, 0x5A, 0x40);
9143c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r8, r9, r10, 1, 0x40, i8, 6, 0x67, 0x47, 0x3A,
9153c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x44, 0x11, 0x40);
9163c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r9, r10, r11, 2, 0x40, i8, 6, 0x67, 0x47,
9173c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3A, 0x4C, 0x5A, 0x40);
9182fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  // esp cannot be an scaled index.
9193c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ebx, esp, ebp, 4, 0x40, i8, 5, 0x67, 0x3A,
9202fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x5C, 0xAC, 0x40);
9213c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, esp, ebp, esi, 8, 0x40, i8, 5, 0x67, 0x3A,
9222fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x64, 0xF5, 0x40);
9233c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ebp, esi, edi, 1, 0x40, i8, 6, 0x67, 0x40,
9243c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3A, 0x6C, 0x3E, 0x40);
9253c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, esi, edi, eax, 2, 0x40, i8, 6, 0x67, 0x40,
9263c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3A, 0x74, 0x47, 0x40);
9273c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, edi, eax, ebx, 4, 0x40, i8, 6, 0x67, 0x40,
9283c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3A, 0x7C, 0x98, 0x40);
9293c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ebx, ecx, edx, 8, 0x40, i8, 5, 0x67, 0x3A,
9302fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x5C, 0xD1, 0x40);
9313c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r11, r12, r13, 4, 0x40, i8, 6, 0x67, 0x47,
9323c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3A, 0x5C, 0xAC, 0x40);
9333c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r12, r13, r14, 8, 0x40, i8, 6, 0x67, 0x47,
9343c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3A, 0x64, 0xF5, 0x40);
9353c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r13, r14, r15, 1, 0x40, i8, 6, 0x67, 0x47,
9363c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3A, 0x6C, 0x3E, 0x40);
9373c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r14, r15, r8, 2, 0x40, i8, 6, 0x67, 0x47,
9383c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3A, 0x74, 0x47, 0x40);
9393c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r15, r8, r11, 4, 0x40, i8, 6, 0x67, 0x47,
9403c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3A, 0x7C, 0x98, 0x40);
9413c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r11, r9, r10, 8, 0x40, i8, 6, 0x67, 0x47,
9423c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3A, 0x5C, 0xD1, 0x40);
9432fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
9442fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  /* cmp GPR, Imm32(Base,Index,Scale) */
9453c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, eax, ecx, edx, 1, 0xF0, i32, 8, 0x67, 0x3B,
9462fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x84, 0x11, 0xF0, 0x00, 0x00, 0x00);
9473c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ecx, edx, ebx, 2, 0xF0, i32, 8, 0x67, 0x3B,
9482fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x8C, 0x5A, 0xF0, 0x00, 0x00, 0x00);
9493c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r8, r9, r10, 1, 0xF0, i32, 9, 0x67, 0x47,
9503c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3B, 0x84, 0x11, 0xF0, 0x00, 0x00, 0x00);
9513c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r9, r10, r11, 2, 0xF0, i32, 9, 0x67, 0x47,
9523c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3B, 0x8C, 0x5A, 0xF0, 0x00, 0x00, 0x00);
9532fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  // esp cannot be an scaled index.
9543c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ebx, esp, ebp, 4, 0xF0, i32, 8, 0x67, 0x3B,
9552fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x9C, 0xAC, 0xF0, 0x00, 0x00, 0x00);
9563c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, esp, ebp, esi, 8, 0xF0, i32, 8, 0x67, 0x3B,
9572fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0xA4, 0xF5, 0xF0, 0x00, 0x00, 0x00);
9583c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ebp, esi, edi, 1, 0xF0, i32, 8, 0x67, 0x3B,
9592fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0xAC, 0x3E, 0xF0, 0x00, 0x00, 0x00);
9603c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, esi, edi, eax, 2, 0xF0, i32, 8, 0x67, 0x3B,
9612fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0xB4, 0x47, 0xF0, 0x00, 0x00, 0x00);
9623c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, edi, eax, ebx, 4, 0xF0, i32, 8, 0x67, 0x3B,
9632fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0xBC, 0x98, 0xF0, 0x00, 0x00, 0x00);
9643c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ebx, ecx, edx, 8, 0xF0, i32, 8, 0x67, 0x3B,
9652fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x9C, 0xD1, 0xF0, 0x00, 0x00, 0x00);
9663c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r11, r12, r13, 4, 0xF0, i32, 9, 0x67, 0x47,
9673c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3B, 0x9C, 0xAC, 0xF0, 0x00, 0x00, 0x00);
9683c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r12, r13, r14, 8, 0xF0, i32, 9, 0x67, 0x47,
9693c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3B, 0xA4, 0xF5, 0xF0, 0x00, 0x00, 0x00);
9703c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r13, r14, r15, 1, 0xF0, i32, 9, 0x67, 0x47,
9713c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3B, 0xAC, 0x3E, 0xF0, 0x00, 0x00, 0x00);
9723c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r14, r15, r8, 2, 0xF0, i32, 9, 0x67, 0x47,
9733c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3B, 0xB4, 0x47, 0xF0, 0x00, 0x00, 0x00);
9743c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r15, r8, r11, 4, 0xF0, i32, 9, 0x67, 0x47,
9753c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3B, 0xBC, 0x98, 0xF0, 0x00, 0x00, 0x00);
9763c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r11, r9, r10, 8, 0xF0, i32, 9, 0x67, 0x47,
9773c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3B, 0x9C, 0xD1, 0xF0, 0x00, 0x00, 0x00);
9782fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
9793c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, eax, ecx, edx, 1, 0xF0, i16, 9, 0x66, 0x67,
9802fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x3B, 0x84, 0x11, 0xF0, 0x00, 0x00, 0x00);
9813c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ecx, edx, ebx, 2, 0xF0, i16, 9, 0x66, 0x67,
9822fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x3B, 0x8C, 0x5A, 0xF0, 0x00, 0x00, 0x00);
9833c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r8, r9, r10, 1, 0xF0, i16, 10, 0x66, 0x67,
9843c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x47, 0x3B, 0x84, 0x11, 0xF0, 0x00, 0x00, 0x00);
9853c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r9, r10, r11, 2, 0xF0, i16, 10, 0x66, 0x67,
9863c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x47, 0x3B, 0x8C, 0x5A, 0xF0, 0x00, 0x00, 0x00);
9872fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  // esp cannot be an scaled index.
9883c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ebx, esp, ebp, 4, 0xF0, i16, 9, 0x66, 0x67,
9892fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x3B, 0x9C, 0xAC, 0xF0, 0x00, 0x00, 0x00);
9903c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, esp, ebp, esi, 8, 0xF0, i16, 9, 0x66, 0x67,
9912fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x3B, 0xA4, 0xF5, 0xF0, 0x00, 0x00, 0x00);
9923c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ebp, esi, edi, 1, 0xF0, i16, 9, 0x66, 0x67,
9932fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x3B, 0xAC, 0x3E, 0xF0, 0x00, 0x00, 0x00);
9943c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, esi, edi, eax, 2, 0xF0, i16, 9, 0x66, 0x67,
9952fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x3B, 0xB4, 0x47, 0xF0, 0x00, 0x00, 0x00);
9963c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, edi, eax, ebx, 4, 0xF0, i16, 9, 0x66, 0x67,
9972fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x3B, 0xBC, 0x98, 0xF0, 0x00, 0x00, 0x00);
9983c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ebx, ecx, edx, 8, 0xF0, i16, 9, 0x66, 0x67,
9992fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x3B, 0x9C, 0xD1, 0xF0, 0x00, 0x00, 0x00);
10003c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r11, r12, r13, 4, 0xF0, i16, 10, 0x66, 0x67,
10013c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x47, 0x3B, 0x9C, 0xAC, 0xF0, 0x00, 0x00, 0x00);
10023c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r12, r13, r14, 8, 0xF0, i16, 10, 0x66, 0x67,
10033c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x47, 0x3B, 0xA4, 0xF5, 0xF0, 0x00, 0x00, 0x00);
10043c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r13, r14, r15, 1, 0xF0, i16, 10, 0x66, 0x67,
10053c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x47, 0x3B, 0xAC, 0x3E, 0xF0, 0x00, 0x00, 0x00);
10063c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r14, r15, r8, 2, 0xF0, i16, 10, 0x66, 0x67,
10073c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x47, 0x3B, 0xB4, 0x47, 0xF0, 0x00, 0x00, 0x00);
10083c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r15, r8, r11, 4, 0xF0, i16, 10, 0x66, 0x67,
10093c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x47, 0x3B, 0xBC, 0x98, 0xF0, 0x00, 0x00, 0x00);
10103c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r11, r9, r10, 8, 0xF0, i16, 10, 0x66, 0x67,
10113c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x47, 0x3B, 0x9C, 0xD1, 0xF0, 0x00, 0x00, 0x00);
10123c275ce1e832ba9ccfb730c4235db786cf080465John Porto
10133c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, eax, ecx, edx, 1, 0xF0, i8, 8, 0x67, 0x3A,
10143c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x84, 0x11, 0xF0, 0x00, 0x00, 0x00);
10153c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ecx, edx, ebx, 2, 0xF0, i8, 8, 0x67, 0x3A,
10162fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x8C, 0x5A, 0xF0, 0x00, 0x00, 0x00);
10173c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r8, r9, r10, 1, 0xF0, i8, 9, 0x67, 0x47, 0x3A,
10183c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x84, 0x11, 0xF0, 0x00, 0x00, 0x00);
10193c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r9, r10, r11, 2, 0xF0, i8, 9, 0x67, 0x47,
10203c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3A, 0x8C, 0x5A, 0xF0, 0x00, 0x00, 0x00);
10212fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  // esp cannot be an scaled index.
10223c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ebx, esp, ebp, 4, 0xF0, i8, 8, 0x67, 0x3A,
10232fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x9C, 0xAC, 0xF0, 0x00, 0x00, 0x00);
10243c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, esp, ebp, esi, 8, 0xF0, i8, 8, 0x67, 0x3A,
10252fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0xA4, 0xF5, 0xF0, 0x00, 0x00, 0x00);
10263c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ebp, esi, edi, 1, 0xF0, i8, 9, 0x67, 0x40,
10273c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3A, 0xAC, 0x3E, 0xF0, 0x00, 0x00, 0x00);
10283c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, esi, edi, eax, 2, 0xF0, i8, 9, 0x67, 0x40,
10293c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3A, 0xB4, 0x47, 0xF0, 0x00, 0x00, 0x00);
10303c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, edi, eax, ebx, 4, 0xF0, i8, 9, 0x67, 0x40,
10313c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3A, 0xBC, 0x98, 0xF0, 0x00, 0x00, 0x00);
10323c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, ebx, ecx, edx, 8, 0xF0, i8, 8, 0x67, 0x3A,
10332fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x9C, 0xD1, 0xF0, 0x00, 0x00, 0x00);
10343c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r11, r12, r13, 4, 0xF0, i8, 9, 0x67, 0x47,
10353c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3A, 0x9C, 0xAC, 0xF0, 0x00, 0x00, 0x00);
10363c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r12, r13, r14, 8, 0xF0, i8, 9, 0x67, 0x47,
10373c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3A, 0xA4, 0xF5, 0xF0, 0x00, 0x00, 0x00);
10383c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r13, r14, r15, 1, 0xF0, i8, 9, 0x67, 0x47,
10393c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3A, 0xAC, 0x3E, 0xF0, 0x00, 0x00, 0x00);
10403c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r14, r15, r8, 2, 0xF0, i8, 9, 0x67, 0x47,
10413c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3A, 0xB4, 0x47, 0xF0, 0x00, 0x00, 0x00);
10423c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r15, r8, r11, 4, 0xF0, i8, 9, 0x67, 0x47,
10433c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3A, 0xBC, 0x98, 0xF0, 0x00, 0x00, 0x00);
10443c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestRegAddrBaseScaledIndex(cmp, r11, r9, r10, 8, 0xF0, i8, 9, 0x67, 0x47,
10453c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x3A, 0x9C, 0xD1, 0xF0, 0x00, 0x00, 0x00);
10462fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
10472fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  /* cmp Addr, Imm */
10482fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  // Note: at this point we trust the assembler knows how to encode addresses,
10492fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  // so no more exhaustive addressing mode testing.
10503c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestAddrBaseScaledIndexImm(cmp, eax, ecx, 1, 0xF0, 0x12, i32, 9, 0x67, 0x83,
10512fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0xBC, 0x08, 0xF0, 0x00, 0x00, 0x00, 0x12);
10523c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestAddrBaseScaledIndexImm(cmp, ecx, edx, 1, 0xF0, 0xF0, i32, 12, 0x67, 0x81,
10532fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0xBC, 0x11, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0x00,
10542fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x00, 0x00);
10553c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestAddrBaseScaledIndexImm(cmp, r8, r9, 1, 0xF0, 0x12, i32, 10, 0x67, 0x43,
10563c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x83, 0xBC, 0x08, 0xF0, 0x00, 0x00, 0x00, 0x12);
10573c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestAddrBaseScaledIndexImm(cmp, r9, r10, 1, 0xF0, 0xF0, i32, 13, 0x67, 0x43,
10583c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x81, 0xBC, 0x11, 0xF0, 0x00, 0x00, 0x00, 0xF0,
10593c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x00, 0x00, 0x00);
10602fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
10613c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestAddrBaseScaledIndexImm(cmp, eax, ecx, 1, 0xF0, 0x12, i16, 10, 0x66, 0x67,
10622fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x83, 0xBC, 0x08, 0xF0, 0x00, 0x00, 0x00, 0x12);
10633c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestAddrBaseScaledIndexImm(cmp, ecx, edx, 1, 0xF0, 0xF0, i16, 11, 0x66, 0x67,
10642fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x81, 0xBC, 0x11, 0xF0, 0x00, 0x00, 0x00, 0xF0,
10652fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x00);
10663c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestAddrBaseScaledIndexImm(cmp, r8, r9, 1, 0xF0, 0x12, i16, 11, 0x66, 0x67,
10673c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x43, 0x83, 0xBC, 0x08, 0xF0, 0x00, 0x00, 0x00,
10683c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x12);
10693c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestAddrBaseScaledIndexImm(cmp, r9, r10, 1, 0xF0, 0xF0, i16, 12, 0x66, 0x67,
10703c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x43, 0x81, 0xBC, 0x11, 0xF0, 0x00, 0x00, 0x00,
10713c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0xF0, 0x00);
10723c275ce1e832ba9ccfb730c4235db786cf080465John Porto
10733c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestAddrBaseScaledIndexImm(cmp, eax, ecx, 1, 0xF0, 0x12, i8, 9, 0x67, 0x80,
10742fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0xBC, 0x08, 0xF0, 0x00, 0x00, 0x00, 0x12);
10753c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestAddrBaseScaledIndexImm(cmp, r8, r9, 1, 0xF0, 0x12, i8, 10, 0x67, 0x43,
10763c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x80, 0xBC, 0x08, 0xF0, 0x00, 0x00, 0x00, 0x12);
10772fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
10782fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  /* cmp Addr, GPR */
10793c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestAddrBaseScaledIndexReg(cmp, eax, ecx, 1, 0xF0, edx, i32, 8, 0x67, 0x39,
10802fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x94, 0x08, 0xF0, 0x00, 0x00, 0x00);
10813c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestAddrBaseScaledIndexReg(cmp, r8, r9, 1, 0xF0, r10, i32, 9, 0x67, 0x47,
10823c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x39, 0x94, 0x08, 0xF0, 0x00, 0x00, 0x00);
10832fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
10843c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestAddrBaseScaledIndexReg(cmp, eax, ecx, 1, 0xF0, edx, i16, 9, 0x66, 0x67,
10852fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto                             0x39, 0x94, 0x08, 0xF0, 0x00, 0x00, 0x00);
10863c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestAddrBaseScaledIndexReg(cmp, r8, r9, 1, 0xF0, r10, i16, 10, 0x66, 0x67,
10873c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x47, 0x39, 0x94, 0x08, 0xF0, 0x00, 0x00, 0x00);
10882fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
10893c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestAddrBaseScaledIndexReg(cmp, eax, ecx, 1, 0xF0, edx, i8, 8, 0x67, 0x38,
10903c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x94, 0x08, 0xF0, 0x00, 0x00, 0x00);
10913c275ce1e832ba9ccfb730c4235db786cf080465John Porto  TestAddrBaseScaledIndexReg(cmp, r8, r9, 1, 0xF0, r10, i8, 9, 0x67, 0x47, 0x38,
10923c275ce1e832ba9ccfb730c4235db786cf080465John Porto                             0x94, 0x08, 0xF0, 0x00, 0x00, 0x00);
10932fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
10942fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto#undef TestAddrBaseScaledIndexReg
10952fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto#undef TestAddrBaseScaledIndexImm
10962fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto#undef TestRegAddrBaseScaledIndex
10972fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto#undef TestRegAddrScaledIndex
10982fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto#undef TestRegAddrBase
10992fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto#undef TestRegAbsoluteAddr
11002fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto#undef TestRegImm
11012fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto#undef TestRegReg
11022fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto}
11032fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
11042fea26cae5a6b140c67e18aec3dcf645a16694d5John PortoTEST_F(AssemblerX8664Test, ScratchpadGettersAndSetters) {
11052fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  const uint32_t S0 = allocateDword();
11062fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  const uint32_t S1 = allocateDword();
11072fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  const uint32_t S2 = allocateDword();
11082fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  const uint32_t S3 = allocateDword();
11092fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  AssembledTest test = assemble();
11102fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  test.setDwordTo(S0, 0xBEEF0000u);
11112fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  test.setDwordTo(S1, 0xDEADu);
11122fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  test.setDwordTo(S2, 0x20406080u);
11132fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  ASSERT_EQ(0xBEEF0000u, test.contentsOfDword(S0));
11142fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  ASSERT_EQ(0xDEADu, test.contentsOfDword(S1));
11152fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  ASSERT_EQ(0x20406080u, test.contentsOfDword(S2));
11162fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  ASSERT_EQ(0xDEADBEEF0000ull, test.contentsOfQword(S0));
11172fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  ASSERT_EQ(0x204060800000DEADull, test.contentsOfQword(S1));
11182fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
11192fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  test.setQwordTo(S1, 0x1234567890ABCDEFull);
11202fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  ASSERT_EQ(0x1234567890ABCDEFull, test.contentsOfQword(S1));
11212fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  test.setDwordTo(S0, 0xBEEF0000u);
11222fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  ASSERT_EQ(0x90ABCDEFull, test.contentsOfDword(S1));
11232fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  ASSERT_EQ(0x12345678ull, test.contentsOfDword(S2));
11242fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
11252fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  test.setDwordTo(S0, 1.0f);
11262fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  ASSERT_FLOAT_EQ(1.0f, test.contentsOfDword<float>(S0));
11272fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  test.setQwordTo(S0, 3.14);
11282fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  ASSERT_DOUBLE_EQ(3.14, test.contentsOfQword<double>(S0));
11292fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
11302fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  test.setDqwordTo(S0, Dqword(1.0f, 2.0f, 3.0f, 4.0f));
11312fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  ASSERT_EQ(Dqword(1.0f, 2.0f, 3.0f, 4.0f), test.contentsOfDqword(S0));
11322fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  EXPECT_FLOAT_EQ(1.0f, test.contentsOfDword<float>(S0));
11332fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  EXPECT_FLOAT_EQ(2.0f, test.contentsOfDword<float>(S1));
11342fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  EXPECT_FLOAT_EQ(3.0f, test.contentsOfDword<float>(S2));
11352fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto  EXPECT_FLOAT_EQ(4.0f, test.contentsOfDword<float>(S3));
11362fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto}
11372fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto
11382fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto} // end of anonymous namespace
11392fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto} // end of namespace Test
11402fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto} // end of namespace X8664
11412fea26cae5a6b140c67e18aec3dcf645a16694d5John Porto} // end of namespace Ice
1142