[PATCH] D15369: [mips] Make symbols an acceptable branch target when expanding compare-to-immediate-and-branch macros.
Daniel Sanders via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 9 02:02:34 PST 2015
dsanders created this revision.
dsanders added subscribers: seanbruno, dim, vkalintiris, llvm-commits.
Herald added a subscriber: dsanders.
http://reviews.llvm.org/D15369
Files:
lib/Target/Mips/AsmParser/MipsAsmParser.cpp
test/MC/Mips/mips-expansions.s
test/MC/Mips/mips64-expansions.s
Index: test/MC/Mips/mips64-expansions.s
===================================================================
--- test/MC/Mips/mips64-expansions.s
+++ 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]
Index: test/MC/Mips/mips-expansions.s
===================================================================
--- test/MC/Mips/mips-expansions.s
+++ 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
Index: lib/Target/Mips/AsmParser/MipsAsmParser.cpp
===================================================================
--- lib/Target/Mips/AsmParser/MipsAsmParser.cpp
+++ lib/Target/Mips/AsmParser/MipsAsmParser.cpp
@@ -2513,7 +2513,6 @@
assert(ImmOp.isImm() && "expected immediate operand kind");
const MCOperand &MemOffsetOp = Inst.getOperand(2);
- assert(MemOffsetOp.isImm() && "expected immediate operand kind");
unsigned OpCode = 0;
switch(Inst.getOpcode()) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15369.42276.patch
Type: text/x-patch
Size: 2263 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151209/dc5373cc/attachment.bin>
More information about the llvm-commits
mailing list