OSDN Git Service

Fixed bug in disassembly of roundss/roundsd
authorAart Bik <ajcbik@google.com>
Mon, 1 Aug 2016 22:55:36 +0000 (15:55 -0700)
committerAart Bik <ajcbik@google.com>
Mon, 1 Aug 2016 23:11:10 +0000 (16:11 -0700)
Rationale:
These instructions should be marked as load, so that, using
Intel syntax, destination (xmm0) appears at left hand side, as in
   roundss xmm0, xmm1
and not the other way around. First I suspected a bug in the
encoding (hence the test) and even the register allocator, but
since the code behaved correctly, only disassembly was really wrong.

Test: disassembler_x86_test (but nothing for actual disassembly)

BUG=26327751

Change-Id: I060ef57f4d5a64cdc04b97ae8a799d1c0d22da05

compiler/utils/x86/assembler_x86_test.cc
disassembler/disassembler_x86.cc

index 67db51a..307e034 100644 (file)
@@ -346,6 +346,19 @@ TEST_F(AssemblerX86Test, UComisdAddr) {
   DriverStr(expected, "ucomisd");
 }
 
+TEST_F(AssemblerX86Test, RoundSS) {
+  GetAssembler()->roundss(
+      x86::XmmRegister(x86::XMM0), x86::XmmRegister(x86::XMM1), x86::Immediate(1));
+  const char* expected = "roundss $1, %xmm1, %xmm0\n";
+  DriverStr(expected, "roundss");
+}
+
+TEST_F(AssemblerX86Test, RoundSD) {
+  GetAssembler()->roundsd(
+      x86::XmmRegister(x86::XMM0), x86::XmmRegister(x86::XMM1), x86::Immediate(1));
+  const char* expected = "roundsd $1, %xmm1, %xmm0\n";
+  DriverStr(expected, "roundsd");
+}
 
 TEST_F(AssemblerX86Test, CmovlAddress) {
   GetAssembler()->cmovl(x86::kEqual, x86::Register(x86::EAX), x86::Address(
index 7f6a7ba..bac6b06 100644 (file)
@@ -597,7 +597,7 @@ DISASSEMBLER_ENTRY(cmp,
               opcode1 = "roundss";
               prefix[2] = 0;
               has_modrm = true;
-              store = true;
+              load = true;
               src_reg_file = SSE;
               dst_reg_file = SSE;
               immediate_bytes = 1;
@@ -606,7 +606,7 @@ DISASSEMBLER_ENTRY(cmp,
               opcode1 = "roundsd";
               prefix[2] = 0;
               has_modrm = true;
-              store = true;
+              load = true;
               src_reg_file = SSE;
               dst_reg_file = SSE;
               immediate_bytes = 1;