https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66112

--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to ktkachov from comment #12)
> r223115 caused a code quality regression that I'm seeing on aarch64 with PR
> 68381.
> 
> We have
> int
> foo (unsigned short x, unsigned short y)
> {
>   int r;
>   if (__builtin_mul_overflow (x, y, &r))
>     __builtin_abort ();
>   return r;
> }
> 
> and before the commit we used to generate:
> foo:
>       uxth    x0, w0
>       uxth    x1, w1
>       mul     x0, x0, x1
>       cmp     x0, x0, sxtw
>       bne     .L9
>       ret
> .L9:
>       stp     x29, x30, [sp, -16]!
>       add     x29, sp, 0
>       bl      abort
> 
> but after r223115 at -O3 on an aarch64 toolchain we generate:
>  foo:
>       uxth    w0, w0
>       uxth    w1, w1
>       stp     x29, x30, [sp, -16]!
>       umull   x0, w0, w1
>       add     x29, sp, 0
>       tbnz    w0, #31, .L6
>       mov     w2, 0
>       cbnz    w2, .L6
>       ldp     x29, x30, [sp], 16
>       ret
> .L6:
>       bl      abort

You really should consider adding {u,}{add,sub,mul}v4<mode> and/or negv3<mode>
expanders if you have some better sequences you can generate over the generic
ones on some target.

Reply via email to