From f266c4a6123b86ddb2399d2cc23ab5df02430582 Mon Sep 17 00:00:00 2001 From: johanknol Date: Fri, 21 Dec 2001 09:20:35 +0000 Subject: [PATCH] removed a useless experiment git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1722 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/SDCCast.c | 57 --------------------------------------------------- 1 file changed, 57 deletions(-) diff --git a/src/SDCCast.c b/src/SDCCast.c index 0152f09f..26f59d09 100644 --- a/src/SDCCast.c +++ b/src/SDCCast.c @@ -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 */ -- 2.30.2