Intel 32-bit encodings for copy.i32.
This commit is contained in:
@@ -56,6 +56,11 @@ ebb0:
|
||||
; asm: sarl %cl, %ecx
|
||||
[-,%rcx] v25 = sshr v1, v1 ; bin: d3 f9
|
||||
|
||||
; asm: movl %esi, %ecx
|
||||
[-,%rcx] v26 = copy v2 ; bin: 89 f1
|
||||
; asm: movl %ecx, %esi
|
||||
[-,%rsi] v27 = copy v1 ; bin: 89 ce
|
||||
|
||||
; Integer Register - Immediate 8-bit operations.
|
||||
; The 8-bit immediate is sign-extended.
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ I32.enc(base.band.i32, *r.rr(0x21))
|
||||
I32.enc(base.bor.i32, *r.rr(0x09))
|
||||
I32.enc(base.bxor.i32, *r.rr(0x31))
|
||||
|
||||
I32.enc(base.copy.i32, *r.ur(0x89))
|
||||
|
||||
# Immediate instructions with sign-extended 8-bit and 32-bit immediate.
|
||||
for inst, rrr in [
|
||||
(base.iadd_imm.i32, 0),
|
||||
|
||||
@@ -4,8 +4,8 @@ Intel Encoding recipes.
|
||||
from __future__ import absolute_import
|
||||
from cdsl.isa import EncRecipe
|
||||
from cdsl.predicates import IsSignedInt, IsEqual
|
||||
from base.formats import UnaryImm, Binary, BinaryImm, Store, Load
|
||||
from base.formats import MultiAry, Call, IndirectCall
|
||||
from base.formats import Unary, UnaryImm, Binary, BinaryImm, MultiAry
|
||||
from base.formats import Call, IndirectCall, Store, Load
|
||||
from .registers import GPR, ABCD
|
||||
|
||||
try:
|
||||
@@ -143,6 +143,10 @@ class TailRecipe:
|
||||
# XX /r
|
||||
rr = TailRecipe('rr', Binary, size=1, ins=(GPR, GPR), outs=0)
|
||||
|
||||
# XX /r, but for a unary operator with separate input/output register, like
|
||||
# copies.
|
||||
ur = TailRecipe('ur', Unary, size=1, ins=GPR, outs=GPR)
|
||||
|
||||
# XX /n with one arg in %rcx, for shifts.
|
||||
rc = TailRecipe('rc', Binary, size=1, ins=(GPR, GPR.rcx), outs=0)
|
||||
|
||||
|
||||
@@ -111,6 +111,16 @@ fn recipe_op1rr<CS: CodeSink + ?Sized>(func: &Function, inst: Inst, sink: &mut C
|
||||
}
|
||||
}
|
||||
|
||||
fn recipe_op1ur<CS: CodeSink + ?Sized>(func: &Function, inst: Inst, sink: &mut CS) {
|
||||
if let InstructionData::Unary { arg, .. } = func.dfg[inst] {
|
||||
put_op1(func.encodings[inst].bits(), sink);
|
||||
let res = func.locations[func.dfg.first_result(inst)].unwrap_reg();
|
||||
modrm_rr(res, func.locations[arg].unwrap_reg(), sink);
|
||||
} else {
|
||||
panic!("Expected Unary format: {:?}", func.dfg[inst]);
|
||||
}
|
||||
}
|
||||
|
||||
fn recipe_op1rc<CS: CodeSink + ?Sized>(func: &Function, inst: Inst, sink: &mut CS) {
|
||||
if let InstructionData::Binary { args, .. } = func.dfg[inst] {
|
||||
let bits = func.encodings[inst].bits();
|
||||
|
||||
Reference in New Issue
Block a user