]> git.sur5r.net Git - cc65/commitdiff
Don't generate inlined codes for integers shifts. If necessary the optimizer
authoruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 14 Aug 2009 22:17:47 +0000 (22:17 +0000)
committeruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 14 Aug 2009 22:17:47 +0000 (22:17 +0000)
can do that.

git-svn-id: svn://svn.cc65.org/cc65/trunk@4007 b7a2c559-68d2-44c3-8de9-860c34a00d81

src/cc65/codegen.c

index e236ce8a5c1196dba49a4a16e810122062d82e97..18b1f319e82d0f61444302e7064073a4666f66f2 100644 (file)
@@ -1437,20 +1437,11 @@ void g_scale (unsigned flags, long val)
                    /* FALLTHROUGH */
 
                case CF_INT:
-                    if (IS_Get (&CodeSizeFactor) >= (p2+1)*130) {
-                       AddCodeLine ("stx tmp1");
-                       while (p2--) {
-                           AddCodeLine ("asl a");
-                           AddCodeLine ("rol tmp1");
-                       }
-                       AddCodeLine ("ldx tmp1");
-                   } else {
-                       if (flags & CF_UNSIGNED) {
-                           AddCodeLine ("jsr shlax%d", p2);
-                       } else {
-                           AddCodeLine ("jsr aslax%d", p2);
-                       }
-                   }
+                    if (flags & CF_UNSIGNED) {
+                        AddCodeLine ("jsr shlax%d", p2);
+                    } else {
+                        AddCodeLine ("jsr aslax%d", p2);
+                    }
                    break;
 
                case CF_LONG:
@@ -1499,28 +1490,9 @@ void g_scale (unsigned flags, long val)
 
                 case CF_INT:
                     if (flags & CF_UNSIGNED) {
-                        if (IS_Get (&CodeSizeFactor) >= (p2+1)*130) {
-                            AddCodeLine ("stx tmp1");
-                            while (p2--) {
-                               AddCodeLine ("lsr tmp1");
-                                AddCodeLine ("ror a");
-                            }
-                            AddCodeLine ("ldx tmp1");
-                        } else {
-                            AddCodeLine ("jsr lsrax%d", p2);
-                        }
+                        AddCodeLine ("jsr lsrax%d", p2);
                     } else {
-                        if (IS_Get (&CodeSizeFactor) >= (p2+1)*150) {
-                            AddCodeLine ("stx tmp1");
-                            while (p2--) {
-                               AddCodeLine ("cpx #$80");
-                               AddCodeLine ("ror tmp1");
-                               AddCodeLine ("ror a");
-                            }
-                            AddCodeLine ("ldx tmp1");
-                        } else {
-                            AddCodeLine ("jsr asrax%d", p2);
-                       }
+                        AddCodeLine ("jsr asrax%d", p2);
                     }
                     break;
 
@@ -2992,7 +2964,7 @@ void g_asr (unsigned flags, unsigned long val)
                     }
                     return;
                 } else if (val == 8 && (flags & CF_UNSIGNED)) {
-                    AddCodeLine ("txa");
+                    AddCodeLine ("txa");  
                     AddCodeLine ("ldx sreg");
                     AddCodeLine ("ldy sreg+1");
                     AddCodeLine ("sty sreg");
@@ -3059,20 +3031,11 @@ void g_asl (unsigned flags, unsigned long val)
                     /* Done */
                     return;
                 } else if (val >= 1 && val <= 4) {
-                    if (IS_Get (&CodeSizeFactor) >= (long) (val+1)*130) {
-                       AddCodeLine ("stx tmp1");
-                       while (val--) {
-                           AddCodeLine ("asl a");
-                           AddCodeLine ("rol tmp1");
-                       }
-                       AddCodeLine ("ldx tmp1");
-                   } else {
-                       if (flags & CF_UNSIGNED) {
-                           AddCodeLine ("jsr shlax%ld", val);
-                       } else {
-                           AddCodeLine ("jsr aslax%ld", val);
-                       }
-                   }
+                    if (flags & CF_UNSIGNED) {
+                        AddCodeLine ("jsr shlax%ld", val);
+                    } else {
+                        AddCodeLine ("jsr aslax%ld", val);
+                    }
                     return;
                 }
                 break;