llvm.org GIT mirror llvm / 74423e3
ARM assemly parsing and validation of IT instruction. "Although a Thumb2 instruction, the IT mnemonic shall be permitted in ARM mode, and the condition verified to match the condition code(s) on the following instruction(s)." PR11853 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148969 91177308-0d34-0410-b5e6-96231b3b80d8 Jim Grosbach 7 years ago
3 changed file(s) with 25 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
51785178 // "neg" is and alias for "rsb rd, rn, #0"
51795179 def : ARMInstAlias<"neg${s}${p} $Rd, $Rm",
51805180 (RSBri GPR:$Rd, GPR:$Rm, 0, pred:$p, cc_out:$s)>;
5181
5182 // 'it' blocks in ARM mode just validate the predicates. The IT itself
5183 // is discarded.
5184 def ITasm : ARMAsmPseudo<"it$mask $cc", (ins it_pred:$cc, it_mask:$mask)>;
50795079 const MCInstrDesc &MCID = getInstDesc(Inst.getOpcode());
50805080 SMLoc Loc = Operands[0]->getStartLoc();
50815081 // Check the IT block state first.
5082 // NOTE: In Thumb mode, the BKPT instruction has the interesting property of
5083 // being allowed in IT blocks, but not being predicable. It just always
5082 // NOTE: BKPT instruction has the interesting property of being
5083 // allowed in IT blocks, but not being predicable. It just always
50845084 // executes.
5085 if (inITBlock() && Inst.getOpcode() != ARM::tBKPT) {
5085 if (inITBlock() && Inst.getOpcode() != ARM::tBKPT &&
5086 Inst.getOpcode() != ARM::BKPT) {
50865087 unsigned bit = 1;
50875088 if (ITState.FirstCond)
50885089 ITState.FirstCond = false;
70477048 }
70487049 return false;
70497050 }
7051 case ARM::ITasm:
70507052 case ARM::t2IT: {
70517053 // The mask bits for all but the first condition are represented as
70527054 // the low bit of the condition code value implies 't'. We currently
71537155 // block.
71547156 forwardITPosition();
71557157
7158 // ITasm is an ARM mode pseudo-instruction that just sets the ITblock and
7159 // doesn't actually encode.
7160 if (Inst.getOpcode() == ARM::ITasm)
7161 return false;
7162
71567163 Out.EmitInstruction(Inst);
71577164 return false;
71587165 case Match_MissingFeature:
0 @ RUN: llvm-mc -triple=armv7-apple-darwin -show-encoding < %s | FileCheck %s
1 .syntax unified
2 .globl _func
3
4 _func:
5 @ CHECK: _func:
6 it eq
7 moveq r2, r3
8 @ 'it' is parsed but not encoded.
9 @ CHECK-NOT: it
10 @ CHECK: moveq r2, r3 @ encoding: [0x03,0x20,0xa0,0x01]