removed a useless experiment
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 21 Dec 2001 09:20:35 +0000 (09:20 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 21 Dec 2001 09:20:35 +0000 (09:20 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1722 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCast.c

index 0152f09f1b40eabf5936dd18de2273ad94f26e27..26f59d09957b9cb66d39ae3c9e8ed3a8456d7620 100644 (file)
@@ -3951,63 +3951,6 @@ optimizeCompare (ast * root)
   vright = (root->right->type == EX_VALUE ?
            root->right->opval.val : NULL);
 
-  //#define EXPERIMENTAL
-#ifdef EXPERIMENTAL
-  /* if left is unsigned and right is literal */
-  if (vleft && vright && 
-      IS_UNSIGNED(vleft->etype) &&
-      IS_LITERAL(vright->etype)) {
-    double dval=floatFromVal(vright);
-    int op=root->opval.op;
-
-    fprintf (stderr,"op: '");
-    switch (op) {
-    case LE_OP: fprintf (stderr, "<= '"); break;
-    case EQ_OP: fprintf (stderr, "== '"); break;
-    case GE_OP: fprintf (stderr, ">= '"); break;
-    default: fprintf (stderr, "%c '", op); break;
-    }
-    fprintf (stderr, "%f\n", dval);
-
-    switch (op)
-      {
-      case EQ_OP:
-      case LE_OP:
-      case '<':
-       if (dval<0 || (op=='<' && dval==0)) {
-         // unsigned is never < 0
-         werror (W_IF_NEVER_TRUE);
-         optExpr = newAst_VALUE (constVal("0"));
-         return decorateType (optExpr);
-       }
-       if (dval==0) {
-         if (op==LE_OP) {
-           // change this into a cheaper EQ_OP
-           fprintf (stderr, "warning *** changed '<=' to '==' because of unsigned\n");
-           root->opval.op=EQ_OP;
-           return root;
-         }
-       }
-       break;
-      case GE_OP:
-      case '>':
-       if (dval>0 || (op==GE_OP && dval==0)) {
-         // unsigned is never < 0
-         werror (W_IF_ALWAYS_TRUE);
-         optExpr = newAst_VALUE (constVal("1"));
-         return decorateType (optExpr);
-       }
-       if (dval==0) {
-         if (op=='>') {
-           // change this into a cheaper reversed EQ_OP
-           fprintf (stderr, "warning *** changed '>' to '!=' because of unsigned\n");
-           root->opval.op=EQ_OP;
-         }
-       }
-      }
-  }
-#endif
-
   /* if left is a BITVAR in BITSPACE */
   /* and right is a LITERAL then opt- */
   /* imize else do nothing       */