h8300.c (shift_alg_si): Use special code for 15-bit logical shifts and 31-bit logical...
authorKazu Hirata <kazu@hxi.com>
Mon, 12 Nov 2001 20:02:32 +0000 (20:02 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Mon, 12 Nov 2001 20:02:32 +0000 (20:02 +0000)
* config/h8300/h8300.c (shift_alg_si): Use special code for
15-bit logical shifts and 31-bit logical shifts.
(get_shift_alg): Generate special code for 15-bit and 31-bit
logical shifts.

From-SVN: r46965

gcc/ChangeLog
gcc/config/h8300/h8300.c

index 49a9004038e4d85b5145380aecc2fd70be88952d..91e86f25a5b83ae3ac9f37c7eeee69cee00c3464 100644 (file)
@@ -1,3 +1,10 @@
+2001-11-12  Kazu Hirata  <kazu@hxi.com>
+
+       * config/h8300/h8300.c (shift_alg_si): Use special code for
+       15-bit logical shifts and 31-bit logical shifts.
+       (get_shift_alg): Generate special code for 15-bit and 31-bit
+       logical shifts.
+
 2001-11-12  Kazu Hirata  <kazu@hxi.com>
 
        * config/h8300/h8300.c (shift_alg_qi): Use rotations when
index 29559bbb83941f4780a216feaa82840f02c45835..e31ddfa0367898fa61b7e9d4f449c3185bdb9b9e 100644 (file)
@@ -2252,13 +2252,13 @@ static const enum shift_alg shift_alg_si[3][3][32] = {
     /* 16   17   18   19   20   21   22   23  */
     /* 24   25   26   27   28   29   30   31  */
     { INL, INL, INL, INL, INL, LOP, LOP, LOP,
-      SPC, LOP, LOP, LOP, LOP, LOP, LOP, LOP,
+      SPC, LOP, LOP, LOP, LOP, LOP, LOP, SPC,
       SPC, SPC, SPC, SPC, LOP, LOP, LOP, LOP,
-      SPC, LOP, LOP, LOP, ROT, ROT, ROT, ROT }, /* SHIFT_ASHIFT   */
+      SPC, LOP, LOP, LOP, ROT, ROT, ROT, SPC }, /* SHIFT_ASHIFT   */
     { INL, INL, INL, INL, INL, LOP, LOP, LOP,
-      SPC, LOP, LOP, LOP, LOP, LOP, LOP, LOP,
+      SPC, LOP, LOP, LOP, LOP, LOP, LOP, SPC,
       SPC, SPC, SPC, SPC, LOP, LOP, LOP, LOP,
-      SPC, LOP, LOP, LOP, ROT, ROT, ROT, ROT }, /* SHIFT_LSHIFTRT */
+      SPC, LOP, LOP, LOP, ROT, ROT, ROT, SPC }, /* SHIFT_LSHIFTRT */
     { INL, INL, INL, INL, INL, LOP, LOP, LOP,
       SPC, LOP, LOP, LOP, LOP, LOP, LOP, LOP,
       SPC, SPC, SPC, SPC, LOP, LOP, LOP, LOP,
@@ -2271,13 +2271,13 @@ static const enum shift_alg shift_alg_si[3][3][32] = {
     /* 16   17   18   19   20   21   22   23  */
     /* 24   25   26   27   28   29   30   31  */
     { INL, INL, INL, INL, INL, INL, INL, INL,
-      INL, INL, INL, LOP, LOP, LOP, LOP, LOP,
+      INL, INL, INL, LOP, LOP, LOP, LOP, SPC,
       SPC, SPC, SPC, SPC, SPC, SPC, LOP, LOP,
-      SPC, LOP, LOP, LOP, ROT, ROT, ROT, ROT }, /* SHIFT_ASHIFT   */
+      SPC, LOP, LOP, LOP, ROT, ROT, ROT, SPC }, /* SHIFT_ASHIFT   */
     { INL, INL, INL, INL, INL, INL, INL, INL,
-      INL, INL, INL, LOP, LOP, LOP, LOP, LOP,
+      INL, INL, INL, LOP, LOP, LOP, LOP, SPC,
       SPC, SPC, SPC, SPC, SPC, SPC, LOP, LOP,
-      SPC, LOP, LOP, LOP, ROT, ROT, ROT, ROT }, /* SHIFT_LSHIFTRT */
+      SPC, LOP, LOP, LOP, ROT, ROT, ROT, SPC }, /* SHIFT_LSHIFTRT */
     { INL, INL, INL, INL, INL, INL, INL, INL,
       INL, INL, INL, LOP, LOP, LOP, LOP, LOP,
       SPC, SPC, SPC, SPC, SPC, SPC, LOP, LOP,
@@ -2514,6 +2514,18 @@ get_shift_alg (shift_type, shift_mode, count, info)
              goto end;
            }
        }
+      else if (count == 15 && !TARGET_H8300)
+       {
+         switch (shift_type)
+           {
+           case SHIFT_ASHIFT:
+             info->special = "shlr.w\t%e0\n\tmov.w\t%f0,%e0\n\txor.w\t%f0,%f0\n\trotxr.l\t%S0";
+             goto end;
+           case SHIFT_LSHIFTRT:
+             info->special = "shll.w\t%e0\n\tmov.w\t%e0,%f0\n\txor.w\t%e0,%e0\n\trotxl.l\t%S0";
+             goto end;
+           }
+       }
       else if ((TARGET_H8300 && count == 16)
               || (TARGET_H8300H && 16 <= count && count <= 19)
               || (TARGET_H8300S && 16 <= count && count <= 21))
@@ -2559,22 +2571,33 @@ get_shift_alg (shift_type, shift_mode, count, info)
        }
       else if (count == 31)
        {
-         if (shift_type == SHIFT_ASHIFTRT)
+         if (TARGET_H8300)
            {
-             if (TARGET_H8300)
-               info->special = "shll\t%z0\n\tsubx\t%w0,%w0\n\tmov.b\t%w0,%x0\n\tmov.w\t%f0,%e0";
-             else
-               info->special = "shll\t%e0\n\tsubx\t%w0,%w0\n\tmov.b\t%w0,%x0\n\tmov.w\t%f0,%e0";
-             goto end;
+             switch (shift_type)
+               {
+               case SHIFT_ASHIFT:
+                 info->special = "sub.w\t%e0,%e0\n\tshlr\t%w0\n\tmov.w\t%e0,%f0\n\trotxr\t%z0";
+                 goto end;
+               case SHIFT_LSHIFTRT:
+                 info->special = "sub.w\t%f0,%f0\n\tshll\t%z0\n\tmov.w\t%f0,%e0\n\trotxl\t%w0";
+                 goto end;
+               case SHIFT_ASHIFTRT:
+                 info->special = "shll\t%z0\n\tsubx\t%w0,%w0\n\tmov.b\t%w0,%x0\n\tmov.w\t%f0,%e0";
+                 goto end;
+               }
            }
          else
            {
-             if (TARGET_H8300)
+             switch (shift_type)
                {
-                 if (shift_type == SHIFT_ASHIFT)
-                   info->special = "sub.w\t%e0,%e0\n\tshlr\t%w0\n\tmov.w\t%e0,%f0\n\trotxr\t%z0";
-                 else
-                   info->special = "sub.w\t%f0,%f0\n\tshll\t%z0\n\tmov.w\t%f0,%e0\n\trotxl\t%w0";
+               case SHIFT_ASHIFT:
+                 info->special = "shlr.l\t%S0\n\txor.l\t%S0,%S0\n\trotxr.l\t%S0";
+                 goto end;
+               case SHIFT_LSHIFTRT:
+                 info->special = "shll.l\t%S0\n\txor.l\t%S0,%S0\n\trotxl.l\t%S0";
+                 goto end;
+               case SHIFT_ASHIFTRT:
+                 info->special = "shll\t%e0\n\tsubx\t%w0,%w0\n\tmov.b\t%w0,%x0\n\tmov.w\t%f0,%e0";
                  goto end;
                }
            }