[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp

Nate Begeman natebegeman at mac.com
Thu Nov 4 11:43:29 PST 2004



Changes in directory llvm/lib/Target/PowerPC:

PPC32ISelSimple.cpp updated: 1.99 -> 1.100
---
Log message:

Thanks to sabre for pointing out that we were incorrectly codegen'ing 
int test(int x) { return 32768 - x; }

Fixed by teaching the function that checks a constant's validity to be used
as an immediate argument about subtract-from instructions.


---
Diffs of the changes:  (+4 -1)

Index: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp
diff -u llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.99 llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.100
--- llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.99	Mon Oct 25 22:48:25 2004
+++ llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp	Thu Nov  4 13:43:18 2004
@@ -536,8 +536,11 @@
     else
       return false;
   }
+
+  // Treat subfic like addi for the purposes of constant validation
+  if (Opcode == 5) Opcode = 0;
       
-  // ADDI, Compare, and non-indexed Load take SIMM
+  // addi, subfic, compare, and non-indexed load take SIMM
   bool cond1 = (Opcode < 2)
     && ((int32_t)CI->getRawValue() <= 32767)
     && ((int32_t)CI->getRawValue() >= -32768);






More information about the llvm-commits mailing list