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

Nate Begeman natebegeman at mac.com
Wed Oct 6 04:03:40 PDT 2004



Changes in directory llvm/lib/Target/PowerPC:

PPC32ISelSimple.cpp updated: 1.86 -> 1.87
---
Log message:

Turning on fsel code gen now that we can do so would be good.

---
Diffs of the changes:  (+10 -11)

Index: llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp
diff -u llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.86 llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.87
--- llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp:1.86	Wed Oct  6 04:53:04 2004
+++ llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp	Wed Oct  6 06:03:30 2004
@@ -32,8 +32,6 @@
 using namespace llvm;
 
 namespace {
-  Statistic<> NumFSEL("ppc-codegen", "Number of fsel emitted");
-
   /// TypeClass - Used by the PowerPC backend to group LLVM types by their basic
   /// PPC Representation.
   ///
@@ -1291,7 +1289,6 @@
   if (SetCondInst *SCI = canFoldSetCCIntoBranchOrSelect(Cond)) {
     // We successfully folded the setcc into the select instruction.
     unsigned OpNum = getSetCCNumber(SCI->getOpcode());
-    /*
     if (OpNum >= 2 && OpNum <= 5) {
       unsigned SetCondClass = getClassB(SCI->getOperand(0)->getType());
       if ((SetCondClass == cFP32 || SetCondClass == cFP64) &&
@@ -1365,11 +1362,9 @@
             break;
           }
         }
-        ++NumFSEL;
         return;
       }
     }
-    */
     OpNum = EmitComparison(OpNum, SCI->getOperand(0),SCI->getOperand(1),MBB,IP);
     Opcode = getPPCOpcodeForSetCCNumber(SCI->getOpcode());
   } else {
@@ -2631,7 +2626,7 @@
 
 /// LoadNeedsSignExtend - On PowerPC, there is no load byte with sign extend.
 /// Therefore, if this is a byte load and the destination type is signed, we
-/// would normall need to also emit a sign extend instruction after the load.
+/// would normally need to also emit a sign extend instruction after the load.
 /// However, store instructions don't care whether a signed type was sign
 /// extended across a whole register.  Also, a SetCC instruction will emit its
 /// own sign extension to force the value into the appropriate range, so we
@@ -2640,11 +2635,15 @@
 static bool LoadNeedsSignExtend(LoadInst &LI) {
   if (cByte == getClassB(LI.getType()) && LI.getType()->isSigned()) {
     bool AllUsesAreStoresOrSetCC = true;
-    for (Value::use_iterator I = LI.use_begin(), E = LI.use_end(); I != E; ++I)
-      if (!isa<StoreInst>(*I) && !isa<SetCondInst>(*I)) {
-        AllUsesAreStoresOrSetCC = false;
-        break;
-      }
+    for (Value::use_iterator I = LI.use_begin(), E = LI.use_end(); I != E; ++I){
+      if (isa<SetCondInst(*I))
+        continue;
+      if (StoreInst *SI = dyn_cast<StoreInst>(*I) && 
+          cByte == getClassB(SI->getType()))
+        continue;
+      AllUsesAreStoresOrSetCC = false;
+      break;
+    }
     if (!AllUsesAreStoresOrSetCC)
       return true;
   }






More information about the llvm-commits mailing list