diff --git a/lib/Target/ARM/ARMInstrThumb2.td b/lib/Target/ARM/ARMInstrThumb2.td index 869eec37a6b..cf1268c49d3 100644 --- a/lib/Target/ARM/ARMInstrThumb2.td +++ b/lib/Target/ARM/ARMInstrThumb2.td @@ -532,7 +532,27 @@ multiclass T2I_bin_irs opcod, string opc, multiclass T2I_bin_w_irs opcod, string opc, InstrItinClass iii, InstrItinClass iir, InstrItinClass iis, PatFrag opnode, string baseOpc, bit Commutable = 0> : - T2I_bin_irs; + T2I_bin_irs { + // Assembler aliases w/o the ".w" suffix. + def : t2InstAlias(!strconcat(baseOpc, "rr")) rGPR:$Rd, rGPR:$Rn, + rGPR:$Rm, pred:$p, + cc_out:$s)>; + def : t2InstAlias(!strconcat(baseOpc, "rs")) rGPR:$Rd, rGPR:$Rn, + t2_so_reg:$shift, pred:$p, + cc_out:$s)>; + + // and with the optional destination operand, too. + def : t2InstAlias(!strconcat(baseOpc, "rr")) rGPR:$Rdn, rGPR:$Rdn, + rGPR:$Rm, pred:$p, + cc_out:$s)>; + def : t2InstAlias(!strconcat(baseOpc, "rs")) rGPR:$Rdn, rGPR:$Rdn, + t2_so_reg:$shift, pred:$p, + cc_out:$s)>; +} /// T2I_rbin_is - Same as T2I_bin_irs except the order of operands are /// reversed. The 'rr' form is only defined for the disassembler; for codegen diff --git a/test/MC/ARM/basic-thumb2-instructions.s b/test/MC/ARM/basic-thumb2-instructions.s index 17ac3c61299..4ecb7fbee33 100644 --- a/test/MC/ARM/basic-thumb2-instructions.s +++ b/test/MC/ARM/basic-thumb2-instructions.s @@ -120,6 +120,23 @@ _func: @ CHECK: and r1, r1, #255 @ encoding: [0x01,0xf0,0xff,0x01] @ CHECK: and r1, r1, #255 @ encoding: [0x01,0xf0,0xff,0x01] + +@------------------------------------------------------------------------------ +@ AND (register) +@------------------------------------------------------------------------------ + and r4, r9, r8 + and r1, r4, r8, asr #3 + ands r2, r1, r7, lsl #1 + ands.w r4, r5, r2, lsr #20 + and.w r9, r12, r1, ror #17 + +@ CHECK: and.w r4, r9, r8 @ encoding: [0x09,0xea,0x08,0x04] +@ CHECK: and.w r1, r4, r8, asr #3 @ encoding: [0x04,0xea,0xe8,0x01] +@ CHECK: ands.w r2, r1, r7, lsl #1 @ encoding: [0x11,0xea,0x47,0x02] +@ CHECK: ands.w r4, r5, r2, lsr #20 @ encoding: [0x15,0xea,0x12,0x54] +@ CHECK: and.w r9, r12, r1, ror #17 @ encoding: [0x0c,0xea,0x71,0x49] + + @------------------------------------------------------------------------------ @ B @------------------------------------------------------------------------------