Skip to content

Commit

Permalink
Post process ADC/SBB and use a shorter encoding if they use a sign ex…
Browse files Browse the repository at this point in the history
…tended immediate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177243 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
topperc committed Mar 18, 2013
1 parent 4bef961 commit 8ee1c1c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/Target/X86/AsmParser/X86AsmParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1801,6 +1801,12 @@ processInstruction(MCInst &Inst,
case X86::SUB16i16: return convert16i16to16ri8(Inst, X86::SUB16ri8);
case X86::SUB32i32: return convert32i32to32ri8(Inst, X86::SUB32ri8);
case X86::SUB64i32: return convert64i32to64ri8(Inst, X86::SUB64ri8);
case X86::ADC16i16: return convert16i16to16ri8(Inst, X86::ADC16ri8);
case X86::ADC32i32: return convert32i32to32ri8(Inst, X86::ADC32ri8);
case X86::ADC64i32: return convert64i32to64ri8(Inst, X86::ADC64ri8);
case X86::SBB16i16: return convert16i16to16ri8(Inst, X86::SBB16ri8);
case X86::SBB32i32: return convert32i32to32ri8(Inst, X86::SBB32ri8);
case X86::SBB64i32: return convert64i32to64ri8(Inst, X86::SBB64ri8);
}
}

Expand Down
14 changes: 14 additions & 0 deletions test/MC/X86/intel-syntax-encoding.s
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@
// CHECK: encoding: [0x48,0x83,0xc0,0xf4]
add rax, -12

// CHECK: encoding: [0x66,0x83,0xd0,0xf4]
adc ax, -12
// CHECK: encoding: [0x83,0xd0,0xf4]
adc eax, -12
// CHECK: encoding: [0x48,0x83,0xd0,0xf4]
adc rax, -12

// CHECK: encoding: [0x66,0x83,0xd8,0xf4]
sbb ax, -12
// CHECK: encoding: [0x83,0xd8,0xf4]
sbb eax, -12
// CHECK: encoding: [0x48,0x83,0xd8,0xf4]
sbb rax, -12

// CHECK: encoding: [0x66,0x83,0xf8,0xf4]
cmp ax, -12
// CHECK: encoding: [0x83,0xf8,0xf4]
Expand Down

0 comments on commit 8ee1c1c

Please sign in to comment.