[llvm] r235990 - [mips] [IAS] Do not generate redundant ORi in createLShiftOri.
Toma Tabacu
toma.tabacu at imgtec.com
Tue Apr 28 07:06:35 PDT 2015
Author: tomatabacu
Date: Tue Apr 28 09:06:35 2015
New Revision: 235990
URL: http://llvm.org/viewvc/llvm-project?rev=235990&view=rev
Log:
[mips] [IAS] Do not generate redundant ORi in createLShiftOri.
Summary: If the immediate is 0, the ORi is pointless.
Reviewers: dsanders
Reviewed By: dsanders
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D8969
Modified:
llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
llvm/trunk/test/MC/Mips/mips-expansions.s
llvm/trunk/test/MC/Mips/mips64-expansions.s
Modified: llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp?rev=235990&r1=235989&r2=235990&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp Tue Apr 28 09:06:35 2015
@@ -1645,6 +1645,10 @@ void createLShiftOri(MCOperand Operand,
Instructions.push_back(tmpInst);
tmpInst.clear();
}
+ // There's no need for an ORi if the immediate is 0.
+ if (Operand.isImm() && Operand.getImm() == 0)
+ return;
+
tmpInst.setOpcode(Mips::ORi);
tmpInst.addOperand(MCOperand::CreateReg(RegNo));
tmpInst.addOperand(MCOperand::CreateReg(RegNo));
Modified: llvm/trunk/test/MC/Mips/mips-expansions.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/mips-expansions.s?rev=235990&r1=235989&r2=235990&view=diff
==============================================================================
--- llvm/trunk/test/MC/Mips/mips-expansions.s (original)
+++ llvm/trunk/test/MC/Mips/mips-expansions.s Tue Apr 28 09:06:35 2015
@@ -4,11 +4,13 @@
#------------------------------------------------------------------------------
# Load immediate instructions
#------------------------------------------------------------------------------
-# CHECK: ori $5, $zero, 123 # encoding: [0x7b,0x00,0x05,0x34]
-# CHECK: addiu $6, $zero, -2345 # encoding: [0xd7,0xf6,0x06,0x24]
-# CHECK: lui $7, 1 # encoding: [0x01,0x00,0x07,0x3c]
-# CHECK: ori $7, $7, 2 # encoding: [0x02,0x00,0xe7,0x34]
-# CHECK: addiu $8, $zero, -8 # encoding: [0xf8,0xff,0x08,0x24]
+# CHECK: ori $5, $zero, 123 # encoding: [0x7b,0x00,0x05,0x34]
+# CHECK: addiu $6, $zero, -2345 # encoding: [0xd7,0xf6,0x06,0x24]
+# CHECK: lui $7, 1 # encoding: [0x01,0x00,0x07,0x3c]
+# CHECK: ori $7, $7, 2 # encoding: [0x02,0x00,0xe7,0x34]
+# CHECK: addiu $8, $zero, -8 # encoding: [0xf8,0xff,0x08,0x24]
+# CHECK: lui $9, 1 # encoding: [0x01,0x00,0x09,0x3c]
+# CHECK-NOT: ori $9, $9, 0 # encoding: [0x00,0x00,0x29,0x35]
# CHECK: addiu $4, $zero, 20 # encoding: [0x14,0x00,0x04,0x24]
# CHECK: lui $7, 1 # encoding: [0x01,0x00,0x07,0x3c]
@@ -70,6 +72,7 @@
li $6,-2345
li $7,65538
li $8, ~7
+ li $9, 0x10000
la $a0, 20
la $7,65538
Modified: llvm/trunk/test/MC/Mips/mips64-expansions.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/mips64-expansions.s?rev=235990&r1=235989&r2=235990&view=diff
==============================================================================
--- llvm/trunk/test/MC/Mips/mips64-expansions.s (original)
+++ llvm/trunk/test/MC/Mips/mips64-expansions.s Tue Apr 28 09:06:35 2015
@@ -52,25 +52,25 @@
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 28609 # encoding: [0xc1,0x6f,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
-# CHECK: ori $12, $12, 0 # encoding: [0x00,0x00,0x8c,0x35]
+# CHECK-NOT: ori $12, $12, 0 # encoding: [0x00,0x00,0x8c,0x35]
# CHECK: lui $12, 355 # encoding: [0x63,0x01,0x0c,0x3c]
# CHECK: ori $12, $12, 17784 # encoding: [0x78,0x45,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 23946 # encoding: [0x8a,0x5d,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
-# CHECK: ori $12, $12, 0 # encoding: [0x00,0x00,0x8c,0x35]
+# CHECK-NOT: ori $12, $12, 0 # encoding: [0x00,0x00,0x8c,0x35]
# CHECK: lui $12, 3552 # encoding: [0xe0,0x0d,0x0c,0x3c]
# CHECK: ori $12, $12, 46771 # encoding: [0xb3,0xb6,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 42852 # encoding: [0x64,0xa7,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
-# CHECK: ori $12, $12, 0 # encoding: [0x00,0x00,0x8c,0x35]
+# CHECK-NOT: ori $12, $12, 0 # encoding: [0x00,0x00,0x8c,0x35]
# CHECK: lui $12, 35527 # encoding: [0xc7,0x8a,0x0c,0x3c]
# CHECK: ori $12, $12, 8964 # encoding: [0x04,0x23,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 35304 # encoding: [0xe8,0x89,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
-# CHECK: ori $12, $12, 0 # encoding: [0x00,0x00,0x8c,0x35]
+# CHECK-NOT: ori $12, $12, 0 # encoding: [0x00,0x00,0x8c,0x35]
# CHECK: addiu $12, $zero, -1 # encoding: [0xff,0xff,0x0c,0x24]
# CHECK: addiu $12, $zero, -10 # encoding: [0xf6,0xff,0x0c,0x24]
# CHECK: addiu $12, $zero, -100 # encoding: [0x9c,0xff,0x0c,0x24]
@@ -147,25 +147,25 @@
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 36927 # encoding: [0x3f,0x90,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
-# CHECK: ori $12, $12, 0 # encoding: [0x00,0x00,0x8c,0x35]
+# CHECK-NOT: ori $12, $12, 0 # encoding: [0x00,0x00,0x8c,0x35]
# CHECK: lui $12, 65180 # encoding: [0x9c,0xfe,0x0c,0x3c]
# CHECK: ori $12, $12, 47751 # encoding: [0x87,0xba,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 41590 # encoding: [0x76,0xa2,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
-# CHECK: ori $12, $12, 0 # encoding: [0x00,0x00,0x8c,0x35]
+# CHECK-NOT: ori $12, $12, 0 # encoding: [0x00,0x00,0x8c,0x35]
# CHECK: lui $12, 61983 # encoding: [0x1f,0xf2,0x0c,0x3c]
# CHECK: ori $12, $12, 18764 # encoding: [0x4c,0x49,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 22684 # encoding: [0x9c,0x58,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
-# CHECK: ori $12, $12, 0 # encoding: [0x00,0x00,0x8c,0x35]
+# CHECK-NOT: ori $12, $12, 0 # encoding: [0x00,0x00,0x8c,0x35]
# CHECK: lui $12, 30008 # encoding: [0x38,0x75,0x0c,0x3c]
# CHECK: ori $12, $12, 56571 # encoding: [0xfb,0xdc,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
# CHECK: ori $12, $12, 30232 # encoding: [0x18,0x76,0x8c,0x35]
# CHECK: dsll $12, $12, 16 # encoding: [0x38,0x64,0x0c,0x00]
-# CHECK: ori $12, $12, 0 # encoding: [0x00,0x00,0x8c,0x35]
+# CHECK-NOT: ori $12, $12, 0 # encoding: [0x00,0x00,0x8c,0x35]
dli $t0, 1
dli $t0, 10
More information about the llvm-commits
mailing list