diff options
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/optabs.c | 8 |
2 files changed, 13 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6541d7125b8..91d46e4b458 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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. diff --git a/gcc/optabs.c b/gcc/optabs.c index 6fcdb1d9611..226b199daa0 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -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) |