1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[AArch64] Handle aliases of conditional branches without b.pred form.

llvm-svn: 201091
This commit is contained in:
Chad Rosier 2014-02-10 15:43:11 +00:00
parent d01574e188
commit a434e7ab2c
2 changed files with 76 additions and 3 deletions

View File

@ -2240,15 +2240,36 @@ validateInstruction(MCInst &Inst,
bool AArch64AsmParser::ParseInstruction(ParseInstructionInfo &Info,
StringRef Name, SMLoc NameLoc,
SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
size_t CondCodePos = Name.find('.');
StringRef PatchedName = StringSwitch<StringRef>(Name.lower())
.Case("beq", "b.eq")
.Case("bne", "b.ne")
.Case("bhs", "b.hs")
.Case("bcs", "b.cs")
.Case("blo", "b.lo")
.Case("bcc", "b.cc")
.Case("bmi", "b.mi")
.Case("bpl", "b.pl")
.Case("bvs", "b.vs")
.Case("bvc", "b.vc")
.Case("bhi", "b.hi")
.Case("bls", "b.ls")
.Case("bge", "b.ge")
.Case("blt", "b.lt")
.Case("bgt", "b.gt")
.Case("ble", "b.le")
.Case("bal", "b.al")
.Case("bnv", "b.nv")
.Default(Name);
StringRef Mnemonic = Name.substr(0, CondCodePos);
size_t CondCodePos = PatchedName.find('.');
StringRef Mnemonic = PatchedName.substr(0, CondCodePos);
Operands.push_back(AArch64Operand::CreateToken(Mnemonic, NameLoc));
if (CondCodePos != StringRef::npos) {
// We have a condition code
SMLoc S = SMLoc::getFromPointer(NameLoc.getPointer() + CondCodePos + 1);
StringRef CondStr = Name.substr(CondCodePos + 1, StringRef::npos);
StringRef CondStr = PatchedName.substr(CondCodePos + 1, StringRef::npos);
A64CC::CondCodes Code;
Code = A64StringToCondCode(CondStr);

View File

@ -1192,6 +1192,58 @@ _func:
// CHECK: b.le lbl // encoding: [0x0d'A',A,A,0x54'A']
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
// CHECK: b.al lbl // encoding: [0x0e'A',A,A,0x54'A']
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
beq lbl
bne lbl
bcs lbl
bhs lbl
blo lbl
bcc lbl
bmi lbl
bpl lbl
bvs lbl
bvc lbl
bhi lbl
bls lbl
bge lbl
blt lbl
bgt lbl
ble lbl
bal lbl
// CHECK: b.eq lbl // encoding: [A,A,A,0x54'A']
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
// CHECK: b.ne lbl // encoding: [0x01'A',A,A,0x54'A']
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
// CHECK: b.hs lbl // encoding: [0x02'A',A,A,0x54'A']
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
// CHECK: b.hs lbl // encoding: [0x02'A',A,A,0x54'A']
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
// CHECK: b.lo lbl // encoding: [0x03'A',A,A,0x54'A']
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
// CHECK: b.lo lbl // encoding: [0x03'A',A,A,0x54'A']
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
// CHECK: b.mi lbl // encoding: [0x04'A',A,A,0x54'A']
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
// CHECK: b.pl lbl // encoding: [0x05'A',A,A,0x54'A']
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
// CHECK: b.vs lbl // encoding: [0x06'A',A,A,0x54'A']
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
// CHECK: b.vc lbl // encoding: [0x07'A',A,A,0x54'A']
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
// CHECK: b.hi lbl // encoding: [0x08'A',A,A,0x54'A']
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
// CHECK: b.ls lbl // encoding: [0x09'A',A,A,0x54'A']
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
// CHECK: b.ge lbl // encoding: [0x0a'A',A,A,0x54'A']
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
// CHECK: b.lt lbl // encoding: [0x0b'A',A,A,0x54'A']
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
// CHECK: b.gt lbl // encoding: [0x0c'A',A,A,0x54'A']
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
// CHECK: b.le lbl // encoding: [0x0d'A',A,A,0x54'A']
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
// CHECK: b.al lbl // encoding: [0x0e'A',A,A,0x54'A']
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
b.eq #0