optabs.c (expand_unop): Widen clz properly when clz is done via libcall.
authorKazu Hirata <kazu@cs.umass.edu>
Sun, 9 Feb 2003 04:25:16 +0000 (04:25 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Sun, 9 Feb 2003 04:25:16 +0000 (04:25 +0000)
* optabs.c (expand_unop): Widen clz properly when clz is done
via libcall.

From-SVN: r62595

gcc/ChangeLog
gcc/optabs.c

index 6541d71..91d46e4 100644 (file)
@@ -1,5 +1,10 @@
 2003-02-08  Kazu Hirata  <kazu@cs.umass.edu>
 
+       * optabs.c (expand_unop): Widen clz properly when clz is done
+       via libcall.
+
+2003-02-08  Kazu Hirata  <kazu@cs.umass.edu>
+
        * config/h8300/clzsi2.c: Replace "GNU CC" with "GCC".
        * config/h8300/crti.asm: Likewise.
        * config/h8300/crtn.asm: Likewise.
index 6fcdb1d..226b199 100644 (file)
@@ -2722,6 +2722,14 @@ expand_unop (mode, unoptab, op0, target, unsignedp)
              temp = expand_unop (wider_mode, unoptab, xop0, NULL_RTX,
                                  unsignedp);
 
+             /* If we are generating clz using wider mode, adjust the
+                result.  */
+             if (unoptab == clz_optab && temp != 0)
+               temp = expand_binop (wider_mode, sub_optab, temp,
+                                    GEN_INT (GET_MODE_BITSIZE (wider_mode)
+                                             - GET_MODE_BITSIZE (mode)),
+                                    target, true, OPTAB_DIRECT);
+
              if (temp)
                {
                  if (class != MODE_INT)