llvm.org GIT mirror llvm / 01c9989
[X86] Disassembler support for move to/from %rax with a 32-bit memory offset is REX.W and AdSize prefix are both present. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225099 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 4 years ago
7 changed file(s) with 48 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
314314 }
315315 bool isMemOffs32_32() const {
316316 return isMemOffs() && Mem.ModeSize == 32 && (!Mem.Size || Mem.Size == 32);
317 }
318 bool isMemOffs32_64() const {
319 return isMemOffs() && Mem.ModeSize == 32 && (!Mem.Size || Mem.Size == 64);
317320 }
318321 bool isMemOffs64_8() const {
319322 return isMemOffs() && Mem.ModeSize == 64 && (!Mem.Size || Mem.Size == 8);
9292 "operands change width") \
9393 ENUM_ENTRY(IC_64BIT_REXW, 5, "requires a REX.W prefix, so operands "\
9494 "change width; overrides IC_OPSIZE") \
95 ENUM_ENTRY(IC_64BIT_REXW_ADSIZE, 6, "requires a REX.W prefix and 0x67 " \
96 "prefix") \
9597 ENUM_ENTRY(IC_64BIT_OPSIZE, 3, "Just as meaningful as IC_OPSIZE") \
9698 ENUM_ENTRY(IC_64BIT_ADSIZE, 3, "Just as meaningful as IC_ADSIZE") \
9799 ENUM_ENTRY(IC_64BIT_OPSIZE_ADSIZE, 4, "Just as meaningful as IC_OPSIZE/" \
492492 let Name = "MemOffs32_32";
493493 let RenderMethod = "addMemOffsOperands";
494494 let SuperClasses = [X86Mem32AsmOperand];
495 }
496 def X86MemOffs32_64AsmOperand : AsmOperandClass {
497 let Name = "MemOffs32_64";
498 let RenderMethod = "addMemOffsOperands";
499 let SuperClasses = [X86Mem64AsmOperand];
495500 }
496501 def X86MemOffs64_8AsmOperand : AsmOperandClass {
497502 let Name = "MemOffs64_8";
570575 let ParserMatchClass = X86MemOffs32_32AsmOperand;
571576 let MIOperandInfo = (ops i64imm, i8imm);
572577 let PrintMethod = "printMemOffs32"; }
578 def offset32_64 : Operand {
579 let ParserMatchClass = X86MemOffs32_64AsmOperand;
580 let MIOperandInfo = (ops i64imm, i8imm);
581 let PrintMethod = "printMemOffs64"; }
573582 def offset64_8 : Operand {
574583 let ParserMatchClass = X86MemOffs64_8AsmOperand;
575584 let MIOperandInfo = (ops i64imm, i8imm);
13171326 def MOV32ao32 : Ii32<0xA1, RawFrmMemOffs, (outs), (ins offset32_32:$src),
13181327 "mov{l}\t{$src, %eax|eax, $src}", [], IIC_MOV_MEM>,
13191328 OpSize32, AdSize32;
1329 let Defs = [RAX] in
1330 def MOV64ao32 : RIi32<0xA1, RawFrmMemOffs, (outs), (ins offset32_64:$src),
1331 "mov{q}\t{$src, %rax|rax, $src}", [], IIC_MOV_MEM>,
1332 AdSize32;
13201333
13211334 let Defs = [AL] in
13221335 def MOV8ao16 : Ii16<0xA0, RawFrmMemOffs, (outs), (ins offset16_8:$src),
13421355 def MOV32o32a : Ii32<0xA3, RawFrmMemOffs, (outs offset32_32:$dst), (ins),
13431356 "mov{l}\t{%eax, $dst|$dst, eax}", [], IIC_MOV_MEM>,
13441357 OpSize32, AdSize32;
1358 let Uses = [RAX] in
1359 def MOV64o32a : RIi32<0xA3, RawFrmMemOffs, (outs offset32_64:$dst), (ins),
1360 "mov{q}\t{%rax, $dst|$dst, rax}", [], IIC_MOV_MEM>,
1361 AdSize32;
13451362
13461363 let Uses = [AL] in
13471364 def MOV8o16a : Ii16<0xA2, RawFrmMemOffs, (outs offset16_8:$dst), (ins),
77 0x64 0x48 0x8b 0x3c 0x25 0x00 0x03 0x00 0x00
88
99 # CHECK: rep
10 # CHECK-NEXT: stosq
10 # CHECK-NEXT: stosq %rax, %es:(%rdi)
1111 0xf3 0x48 0xab
1212
1313 # CHECK: rep
14 # CHECK-NEXT: stosl
14 # CHECK-NEXT: stosq %rax, %es:(%edi)
1515 0xf3 0x67 0x48 0xab
1616
1717 # CHECK: movl 32(%rbp), %eax
264264
265265 # CHECK: $0, 305419896(%rbp)
266266 0x80 0x84 0x25 0x78 0x56 0x34 0x12 0x00
267
268 # CHECK: movabsq 6510615555426900570, %rax
269 0x48 0xa1 0x5a 0x5a 0x5a 0x5a 0x5a 0x5a 0x5a 0x5a
270
271 # CHECK: movq 1515870810, %rax
272 0x67, 0x48 0xa1 0x5a 0x5a 0x5a 0x5a
273
274 # CHECK: movabsq %rax, 6510615555426900570
275 0x48 0xa3 0x5a 0x5a 0x5a 0x5a 0x5a 0x5a 0x5a 0x5a
276
277 # CHECK: movq %rax, 1515870810
278 0x67, 0x48 0xa3 0x5a 0x5a 0x5a 0x5a
113113 case IC_64BIT_REXW:
114114 return(inheritsFrom(child, IC_64BIT_REXW_XS) ||
115115 inheritsFrom(child, IC_64BIT_REXW_XD) ||
116 inheritsFrom(child, IC_64BIT_REXW_OPSIZE));
116 inheritsFrom(child, IC_64BIT_REXW_OPSIZE) ||
117 (!AdSize64 && inheritsFrom(child, IC_64BIT_REXW_ADSIZE)));
117118 case IC_64BIT_OPSIZE:
118119 return inheritsFrom(child, IC_64BIT_REXW_OPSIZE) ||
119 (!AdSize64 && inheritsFrom(child, IC_64BIT_OPSIZE_ADSIZE));
120 (!AdSize64 && inheritsFrom(child, IC_64BIT_OPSIZE_ADSIZE)) ||
121 (!AdSize64 && inheritsFrom(child, IC_64BIT_REXW_ADSIZE));
120122 case IC_64BIT_XD:
121123 return(inheritsFrom(child, IC_64BIT_REXW_XD));
122124 case IC_64BIT_XS:
127129 case IC_64BIT_REXW_XD:
128130 case IC_64BIT_REXW_XS:
129131 case IC_64BIT_REXW_OPSIZE:
132 case IC_64BIT_REXW_ADSIZE:
130133 return false;
131134 case IC_VEX:
132135 return (VEX_LIG && inheritsFrom(child, IC_VEX_L_W)) ||
719722 else if ((index & ATTR_64BIT) && (index & ATTR_REXW) &&
720723 (index & ATTR_OPSIZE))
721724 o << "IC_64BIT_REXW_OPSIZE";
725 else if ((index & ATTR_64BIT) && (index & ATTR_REXW) &&
726 (index & ATTR_ADSIZE))
727 o << "IC_64BIT_REXW_ADSIZE";
722728 else if ((index & ATTR_64BIT) && (index & ATTR_XD) && (index & ATTR_OPSIZE))
723729 o << "IC_64BIT_XD_OPSIZE";
724730 else if ((index & ATTR_64BIT) && (index & ATTR_XS) && (index & ATTR_OPSIZE))
407407 } else if (Is64Bit || HasREX_WPrefix || AdSize == X86Local::AdSize64) {
408408 if (HasREX_WPrefix && (OpSize == X86Local::OpSize16 || OpPrefix == X86Local::PD))
409409 insnContext = IC_64BIT_REXW_OPSIZE;
410 else if (HasREX_WPrefix && AdSize == X86Local::AdSize32)
411 insnContext = IC_64BIT_REXW_ADSIZE;
410412 else if (OpSize == X86Local::OpSize16 && OpPrefix == X86Local::XD)
411413 insnContext = IC_64BIT_XD_OPSIZE;
412414 else if (OpSize == X86Local::OpSize16 && OpPrefix == X86Local::XS)
983985 TYPE("offset32_8", TYPE_MOFFS8)
984986 TYPE("offset32_16", TYPE_MOFFS16)
985987 TYPE("offset32_32", TYPE_MOFFS32)
988 TYPE("offset32_64", TYPE_MOFFS64)
986989 TYPE("offset64_8", TYPE_MOFFS8)
987990 TYPE("offset64_16", TYPE_MOFFS16)
988991 TYPE("offset64_32", TYPE_MOFFS32)
12181221 ENCODING("offset32_8", ENCODING_Ia)
12191222 ENCODING("offset32_16", ENCODING_Ia)
12201223 ENCODING("offset32_32", ENCODING_Ia)
1224 ENCODING("offset32_64", ENCODING_Ia)
12211225 ENCODING("offset64_8", ENCODING_Ia)
12221226 ENCODING("offset64_16", ENCODING_Ia)
12231227 ENCODING("offset64_32", ENCODING_Ia)