fix and cleanup constmul code a bit, this fixes mediabench/toast and
authorDuraid Madina <duraid@octopus.com.au>
Mon, 9 May 2005 13:18:34 +0000 (13:18 +0000)
committerDuraid Madina <duraid@octopus.com.au>
Mon, 9 May 2005 13:18:34 +0000 (13:18 +0000)
probably a couple of other tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21814 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/IA64/IA64ISelPattern.cpp

index 7722ac21df757f680be02de2670a5f1e4e5b70f8..30520ed289c1f137e3e640af9ddffb5d68c0b2c4 100644 (file)
@@ -680,11 +680,11 @@ unsigned lefevre(const std::string inString,
   }
 
   for(unsigned i=0; i<u.length(); i++) {
-    if(u.c_str()[i]=='P' || u.c_str()[i]=='N')
+    if(u[i]=='P' || u[i]=='N')
       u.replace(i, 1, "0");
-    if(u.c_str()[i]=='p')
+    if(u[i]=='p')
       u.replace(i, 1, "P");
-    if(u.c_str()[i]=='n')
+    if(u[i]=='n')
       u.replace(i, 1, "N");
   }
 
@@ -694,21 +694,18 @@ unsigned lefevre(const std::string inString,
   } else
     f=false;
   
-  bool hit=true;
-  for(unsigned i=0; i<u.length(); i++) {
-    if(u[i]!='0')
-      if(u[i]!='N') {
-       hit=false;
-       break;
-      }
-  }
+  int pos=0;
+  while(u[pos]=='0')
+    pos++;
+
+  bool hit=(u[pos]=='N');
 
   int g=0;
   if(hit) {
     g=1;
     for(unsigned p=0; p<u.length(); p++) {
-      bool isP=(u.c_str()[p]=='P');
-      bool isN=(u.c_str()[p]=='N');
+      bool isP=(u[p]=='P');
+      bool isN=(u[p]=='N');
 
       if(isP)
        u.replace(p, 1, "N");