Provide Thumb2 encodings for bitfield instructions.

llvm-svn: 119551
This commit is contained in:
Owen Anderson 2010-11-17 20:35:29 +00:00
parent a585073323
commit c7750780fc
2 changed files with 40 additions and 13 deletions

View File

@ -1989,10 +1989,30 @@ defm t2BIC : T2I_bin_w_irs<0b0001, "bic",
IIC_iBITi, IIC_iBITr, IIC_iBITsi, IIC_iBITi, IIC_iBITr, IIC_iBITsi,
BinOpFrag<(and node:$LHS, (not node:$RHS))>>; BinOpFrag<(and node:$LHS, (not node:$RHS))>>;
let Constraints = "$src = $dst" in class T2BitFI<dag oops, dag iops, InstrItinClass itin,
def t2BFC : T2I<(outs rGPR:$dst), (ins rGPR:$src, bf_inv_mask_imm:$imm), string opc, string asm, list<dag> pattern>
IIC_iUNAsi, "bfc", "\t$dst, $imm", : T2I<oops, iops, itin, opc, asm, pattern> {
[(set rGPR:$dst, (and rGPR:$src, bf_inv_mask_imm:$imm))]> { bits<4> Rd;
bits<10> imm;
let Inst{11-8} = Rd{3-0};
let Inst{4-0} = imm{9-5};
let Inst{14-12} = imm{4-2};
let Inst{7-6} = imm{1-0};
}
class T2TwoRegBitFI<dag oops, dag iops, InstrItinClass itin,
string opc, string asm, list<dag> pattern>
: T2BitFI<oops, iops, itin, opc, asm, pattern> {
bits<4> Rn;
let Inst{3-0} = Rn{3-0};
}
let Constraints = "$src = $Rd" in
def t2BFC : T2BitFI<(outs rGPR:$Rd), (ins rGPR:$src, bf_inv_mask_imm:$imm),
IIC_iUNAsi, "bfc", "\t$Rd, $imm",
[(set rGPR:$Rd, (and rGPR:$src, bf_inv_mask_imm:$imm))]> {
let Inst{31-27} = 0b11110; let Inst{31-27} = 0b11110;
let Inst{25} = 1; let Inst{25} = 1;
let Inst{24-20} = 0b10110; let Inst{24-20} = 0b10110;
@ -2000,16 +2020,17 @@ def t2BFC : T2I<(outs rGPR:$dst), (ins rGPR:$src, bf_inv_mask_imm:$imm),
let Inst{15} = 0; let Inst{15} = 0;
} }
def t2SBFX: T2I<(outs rGPR:$dst), (ins rGPR:$src, imm0_31:$lsb, imm0_31:$width), def t2SBFX: T2TwoRegBitFI<
IIC_iUNAsi, "sbfx", "\t$dst, $src, $lsb, $width", []> { (outs rGPR:$Rd), (ins rGPR:$Rn, bf_inv_mask_imm:$imm),
IIC_iUNAsi, "sbfx", "\t$Rd, $Rn, $imm", []> {
let Inst{31-27} = 0b11110; let Inst{31-27} = 0b11110;
let Inst{25} = 1; let Inst{25} = 1;
let Inst{24-20} = 0b10100; let Inst{24-20} = 0b10100;
let Inst{15} = 0; let Inst{15} = 0;
} }
def t2UBFX: T2I<(outs rGPR:$dst), (ins rGPR:$src, imm0_31:$lsb, imm0_31:$width), def t2UBFX: T2I<(outs rGPR:$Rd), (ins rGPR:$Rn, bf_inv_mask_imm:$imm),
IIC_iUNAsi, "ubfx", "\t$dst, $src, $lsb, $width", []> { IIC_iUNAsi, "ubfx", "\t$Rd, $Rn, $imm", []> {
let Inst{31-27} = 0b11110; let Inst{31-27} = 0b11110;
let Inst{25} = 1; let Inst{25} = 1;
let Inst{24-20} = 0b11100; let Inst{24-20} = 0b11100;
@ -2017,11 +2038,11 @@ def t2UBFX: T2I<(outs rGPR:$dst), (ins rGPR:$src, imm0_31:$lsb, imm0_31:$width),
} }
// A8.6.18 BFI - Bitfield insert (Encoding T1) // A8.6.18 BFI - Bitfield insert (Encoding T1)
let Constraints = "$src = $dst" in let Constraints = "$src = $Rd" in
def t2BFI : T2I<(outs rGPR:$dst), def t2BFI : T2BitFI<(outs rGPR:$Rd),
(ins rGPR:$src, rGPR:$val, bf_inv_mask_imm:$imm), (ins rGPR:$src, rGPR:$Rn, bf_inv_mask_imm:$imm),
IIC_iBITi, "bfi", "\t$dst, $val, $imm", IIC_iBITi, "bfi", "\t$Rd, $Rn, $imm",
[(set rGPR:$dst, (ARMbfi rGPR:$src, rGPR:$val, [(set rGPR:$Rd, (ARMbfi rGPR:$src, rGPR:$Rn,
bf_inv_mask_imm:$imm))]> { bf_inv_mask_imm:$imm))]> {
let Inst{31-27} = 0b11110; let Inst{31-27} = 0b11110;
let Inst{25} = 1; let Inst{25} = 1;

View File

@ -52,3 +52,9 @@
@ CHECK: rrx r0, r0 @ encoding: [0x30,0x00,0x4f,0xea] @ CHECK: rrx r0, r0 @ encoding: [0x30,0x00,0x4f,0xea]
rrx r0, r0 rrx r0, r0
@ CHECK: bfc r0, #4, #20 @ encoding: [0x17,0x10,0x6f,0xf3]
bfc r0, #4, #20
@ CHECK: bfc r0, #0, #23 @ encoding: [0x16,0x00,0x6f,0xf3]
bfc r0, #0, #23
@ CHECK: bfc r0, #12, #20 @ encoding: [0x1f,0x30,0x6f,0xf3]
bfc r0, #12, #20