diff --git a/runtime/vm/compiler/assembler/assembler_ia32_test.cc b/runtime/vm/compiler/assembler/assembler_ia32_test.cc index 715d5bb200b..3c6797b4907 100644 --- a/runtime/vm/compiler/assembler/assembler_ia32_test.cc +++ b/runtime/vm/compiler/assembler/assembler_ia32_test.cc @@ -4625,7 +4625,7 @@ ASSEMBLER_TEST_RUN(TestSetCC, test) { EXPECT_DISASSEMBLY( "mov eax,0xffffffff\n" "cmp eax,eax\n" - "setnz eax\n" + "setnz al\n" "ret\n"); } diff --git a/runtime/vm/compiler/assembler/assembler_x64_test.cc b/runtime/vm/compiler/assembler/assembler_x64_test.cc index 57daebc896c..d78aa0caab6 100644 --- a/runtime/vm/compiler/assembler/assembler_x64_test.cc +++ b/runtime/vm/compiler/assembler/assembler_x64_test.cc @@ -675,7 +675,7 @@ ASSEMBLER_TEST_RUN(Testb3, test) { EXPECT_DISASSEMBLY_NOT_WINDOWS( "push rdi\n" "movl rdx,0x10\n" - "testb rdx,[rsp]\n" + "testb dl,[rsp]\n" "jz +13\n" "movl rax,1\n" "pop rcx\n" @@ -5508,7 +5508,7 @@ ASSEMBLER_TEST_RUN(TestSetCC, test) { EXPECT_DISASSEMBLY( "movl rax,0xffffffff\n" "cmpq rax,rax\n" - "setnzl rax\n" + "setnz al\n" "ret\n"); } @@ -5530,7 +5530,7 @@ ASSEMBLER_TEST_RUN(TestSetCC2, test) { "push rbx\n" "movl rbx,0xffffffff\n" "cmpq rbx,rbx\n" - "setzl rdi\n" + "setz bh\n" "movq rax,rbx\n" "pop rbx\n" "ret\n"); @@ -5554,7 +5554,7 @@ ASSEMBLER_TEST_RUN(TestSetCC3, test) { "push r10\n" "movl r10,0xffffffff\n" "cmpq r10,r10\n" - "setnzl r10\n" + "setnz r10b\n" "movq rax,r10\n" "pop r10\n" "ret\n"); @@ -5578,7 +5578,7 @@ ASSEMBLER_TEST_RUN(TestSetCC4, test) { "push rsi\n" "movl rsi,0xffffffff\n" "cmpq rsi,rsi\n" - "setzl rsi\n" + "setz dh\n" "movq rax,rsi\n" "pop rsi\n" "ret\n"); diff --git a/runtime/vm/compiler/assembler/disassembler_x86.cc b/runtime/vm/compiler/assembler/disassembler_x86.cc index fb4c917caec..d99afbf810c 100644 --- a/runtime/vm/compiler/assembler/disassembler_x86.cc +++ b/runtime/vm/compiler/assembler/disassembler_x86.cc @@ -314,7 +314,7 @@ class DisassemblerX64 : public ValueObject { } const char* NameOfByteCPURegister(int reg) const { - return NameOfCPURegister(reg); + return RegisterNames::RegisterByteName(static_cast(reg)); } // A way to get rax or eax's name. @@ -842,7 +842,7 @@ int DisassemblerX64::SetCC(uint8_t* data) { ASSERT(0x0F == *data); uint8_t cond = *(data + 1) & 0x0F; const char* mnem = conditional_code_suffix[cond]; - Print("set%s%s ", mnem, operand_size_code()); + Print("set%s ", mnem); PrintRightByteOperand(data + 2); return 3; // includes 0x0F } diff --git a/runtime/vm/constants.h b/runtime/vm/constants.h index 916e23137ff..49a0889876f 100644 --- a/runtime/vm/constants.h +++ b/runtime/vm/constants.h @@ -60,6 +60,13 @@ class RegisterNames { return fpu_d_reg_names[reg]; } #endif // defined(TARGET_ARCH_ARM) + +#if defined(TARGET_ARCH_X64) || defined(TARGET_ARCH_IA32) + static const char* RegisterByteName(ByteRegister reg) { + ASSERT((0 <= reg) && (reg < kNumberOfByteRegisters)); + return cpu_reg_byte_names[reg]; + } +#endif // defined(TARGET_ARCH_X64) || defined(TARGET_ARCH_IA32) }; static constexpr bool IsArgumentRegister(Register reg) { diff --git a/runtime/vm/constants_ia32.cc b/runtime/vm/constants_ia32.cc index 057264d9ca0..ab777c554ce 100644 --- a/runtime/vm/constants_ia32.cc +++ b/runtime/vm/constants_ia32.cc @@ -13,6 +13,9 @@ namespace dart { const char* const cpu_reg_names[kNumberOfCpuRegisters] = { "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi"}; +const char* const cpu_reg_byte_names[kNumberOfCpuRegisters] = { + "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh"}; + const char* const cpu_reg_abi_names[kNumberOfCpuRegisters] = { "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi"}; diff --git a/runtime/vm/constants_ia32.h b/runtime/vm/constants_ia32.h index d1412855b89..335e9b757cc 100644 --- a/runtime/vm/constants_ia32.h +++ b/runtime/vm/constants_ia32.h @@ -42,6 +42,7 @@ enum ByteRegister { CH = 5, DH = 6, BH = 7, + kNumberOfByteRegisters = 8, kNoByteRegister = -1 // Signals an illegal register. }; @@ -76,6 +77,7 @@ const FpuRegister kNoFpuRegister = kNoXmmRegister; extern const char* const cpu_reg_names[kNumberOfCpuRegisters]; extern const char* const cpu_reg_abi_names[kNumberOfCpuRegisters]; +extern const char* const cpu_reg_byte_names[kNumberOfByteRegisters]; extern const char* const fpu_reg_names[kNumberOfXmmRegisters]; // Register aliases. diff --git a/runtime/vm/constants_x64.cc b/runtime/vm/constants_x64.cc index 7e03cb606a3..27c20323fde 100644 --- a/runtime/vm/constants_x64.cc +++ b/runtime/vm/constants_x64.cc @@ -18,6 +18,10 @@ const char* const cpu_reg_abi_names[kNumberOfCpuRegisters] = { "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"}; +const char* const cpu_reg_byte_names[kNumberOfByteRegisters] = { + "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh", + "r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b", "r15b"}; + const char* const fpu_reg_names[kNumberOfXmmRegisters] = { "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7", "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15"}; diff --git a/runtime/vm/constants_x64.h b/runtime/vm/constants_x64.h index 119f08c3c03..5128f4322e3 100644 --- a/runtime/vm/constants_x64.h +++ b/runtime/vm/constants_x64.h @@ -60,6 +60,7 @@ enum ByteRegister { R13B = 13, R14B = 14, R15B = 15, + kNumberOfByteRegisters = 16, kNoByteRegister = -1 // Signals an illegal register. }; @@ -102,6 +103,7 @@ const FpuRegister kNoFpuRegister = kNoXmmRegister; extern const char* const cpu_reg_names[kNumberOfCpuRegisters]; extern const char* const cpu_reg_abi_names[kNumberOfCpuRegisters]; +extern const char* const cpu_reg_byte_names[kNumberOfByteRegisters]; extern const char* const fpu_reg_names[kNumberOfXmmRegisters]; enum RexBits {