diff options
author | Daniel Sanders <daniel.sanders@imgtec.com> | 2016-02-29 11:24:49 +0000 |
---|---|---|
committer | Daniel Sanders <daniel.sanders@imgtec.com> | 2016-02-29 11:24:49 +0000 |
commit | 90f0d0b8e3cb0f1ecfd9e4e0636fe778b7615ef9 (patch) | |
tree | e520c033244575472ce9a2b0eef823215ded4b23 /llvm | |
parent | f5b2a47ac69a91be61a99f16d5b6bbab02e92b77 (diff) | |
download | bcm5719-llvm-90f0d0b8e3cb0f1ecfd9e4e0636fe778b7615ef9.tar.gz bcm5719-llvm-90f0d0b8e3cb0f1ecfd9e4e0636fe778b7615ef9.zip |
[mips] Make symbols an acceptable branch target when expanding compare-to-immediate-and-branch macros.
Reviewers: vkalintiris
Subscribers: llvm-commits, vkalintiris, dim, seanbruno, dsanders
Differential Revision: http://reviews.llvm.org/D15369
llvm-svn: 262213
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp | 3 | ||||
-rw-r--r-- | llvm/test/MC/Mips/mips-expansions.s | 6 | ||||
-rw-r--r-- | llvm/test/MC/Mips/mips64-expansions.s | 11 |
3 files changed, 19 insertions, 1 deletions
diff --git a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp index 5b1b65f37e5..b848a68ad42 100644 --- a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp +++ b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp @@ -2559,7 +2559,8 @@ bool MipsAsmParser::expandBranchImm(MCInst &Inst, SMLoc IDLoc, assert(ImmOp.isImm() && "expected immediate operand kind"); const MCOperand &MemOffsetOp = Inst.getOperand(2); - assert(MemOffsetOp.isImm() && "expected immediate operand kind"); + assert((MemOffsetOp.isImm() || MemOffsetOp.isExpr()) && + "expected immediate or expression operand"); unsigned OpCode = 0; switch(Inst.getOpcode()) { diff --git a/llvm/test/MC/Mips/mips-expansions.s b/llvm/test/MC/Mips/mips-expansions.s index 625b77f2d88..855aefbba5a 100644 --- a/llvm/test/MC/Mips/mips-expansions.s +++ b/llvm/test/MC/Mips/mips-expansions.s @@ -131,6 +131,12 @@ # CHECK-LE: beq $2, $1, 1332 # encoding: [0x4d,0x01,0x41,0x10] # CHECK-LE: nop # encoding: [0x00,0x00,0x00,0x00] + beq $2, 65538, foo +# CHECK-LE: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] +# CHECK-LE: ori $1, $1, 2 # encoding: [0x02,0x00,0x21,0x34] +# CHECK-LE: beq $2, $1, foo # encoding: [A,A,0x41,0x10] +# CHECK-LE: nop # encoding: [0x00,0x00,0x00,0x00] + # Test ULH with immediate operand. ulh_imm: # CHECK-LABEL: ulh_imm: ulh $8, 0 diff --git a/llvm/test/MC/Mips/mips64-expansions.s b/llvm/test/MC/Mips/mips64-expansions.s index 0b56cf50128..f84ee8af9e1 100644 --- a/llvm/test/MC/Mips/mips64-expansions.s +++ b/llvm/test/MC/Mips/mips64-expansions.s @@ -84,6 +84,17 @@ # CHECK: beq $2, $1, 1332 # encoding: [0x4d,0x01,0x41,0x10] # CHECK: nop # encoding: [0x00,0x00,0x00,0x00] +# Test one with a symbol in the third operand. +sym: + bne $2, 0x100010001, sym +# CHECK: addiu $1, $zero, 1 # encoding: [0x01,0x00,0x01,0x24] +# CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00] +# CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34] +# CHECK: dsll $1, $1, 16 # encoding: [0x38,0x0c,0x01,0x00] +# CHECK: ori $1, $1, 1 # encoding: [0x01,0x00,0x21,0x34] +# CHECK: bne $2, $1, sym # encoding: [A,A,0x41,0x14] +# CHECK: nop # encoding: [0x00,0x00,0x00,0x00] + # Test ulhu with 64-bit immediate addresses. ulhu $8, 0x100010001 # CHECK: addiu $1, $zero, 1 # encoding: [0x01,0x00,0x01,0x24] |