First round of fixes for the x86 fixes for the x86 move accumulator from/to memory offset instructions.

-Assembly parser now properly check the size of the memory operation specified in intel syntax. So 'mov word ptr [5], al' is no longer accepted.
-x86-32 disassembly of these instructions no longer sign extends the 32-bit address immediate based on size.
-Intel syntax printing prints the ptr size and places brackets around the address immediate.

Known remaining issues with these instructions:
-Segment override prefix is not supported. PR16962 and PR16961.
-Immediate size should be changed by address size prefix.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189201 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Craig Topper
2013-08-25 22:23:38 +00:00
parent f27c35347a
commit a4959f3f6e
10 changed files with 226 additions and 34 deletions
+12 -17
View File
@@ -231,16 +231,18 @@ static void translateImmediate(MCInst &mcInst, uint64_t immediate,
default:
break;
case 1:
type = TYPE_MOFFS8;
if(immediate & 0x80)
immediate |= ~(0xffull);
break;
case 2:
type = TYPE_MOFFS16;
if(immediate & 0x8000)
immediate |= ~(0xffffull);
break;
case 4:
type = TYPE_MOFFS32;
if(immediate & 0x80000000)
immediate |= ~(0xffffffffull);
break;
case 8:
type = TYPE_MOFFS64;
break;
}
}
@@ -263,16 +265,18 @@ static void translateImmediate(MCInst &mcInst, uint64_t immediate,
Opcode != X86::VMPSADBWrri && Opcode != X86::VDPPSYrri &&
Opcode != X86::VDPPSYrmi && Opcode != X86::VDPPDrri &&
Opcode != X86::VINSERTPSrr)
type = TYPE_MOFFS8;
if(immediate & 0x80)
immediate |= ~(0xffull);
break;
case ENCODING_IW:
type = TYPE_MOFFS16;
if(immediate & 0x8000)
immediate |= ~(0xffffull);
break;
case ENCODING_ID:
type = TYPE_MOFFS32;
if(immediate & 0x80000000)
immediate |= ~(0xffffffffull);
break;
case ENCODING_IO:
type = TYPE_MOFFS64;
break;
}
}
@@ -292,25 +296,16 @@ static void translateImmediate(MCInst &mcInst, uint64_t immediate,
case TYPE_REL8:
isBranch = true;
pcrel = insn.startLocation + insn.immediateOffset + insn.immediateSize;
// fall through to sign extend the immediate if needed.
case TYPE_MOFFS8:
if(immediate & 0x80)
immediate |= ~(0xffull);
break;
case TYPE_MOFFS16:
if(immediate & 0x8000)
immediate |= ~(0xffffull);
break;
case TYPE_REL32:
case TYPE_REL64:
isBranch = true;
pcrel = insn.startLocation + insn.immediateOffset + insn.immediateSize;
// fall through to sign extend the immediate if needed.
case TYPE_MOFFS32:
if(immediate & 0x80000000)
immediate |= ~(0xffffffffull);
break;
case TYPE_MOFFS64:
default:
// operand is 64 bits wide. Do nothing.
break;