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

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
OK, maybe the costing is simply not taking into account that we chose the
simdlen == 1 variant which _does_ exist!  It's the chosen one:

4052        bestn = cgraph_node::get (simd_clone_info[0]);
(gdb) p bestn
$5 = <cgraph_node * 0x7ffff695e440 "cos.simdclone.0"/2>
(gdb) p bestn->simdclone->simdlen 
$6 = {coeffs = {1, 0}}

and it's usable

4077            int target_badness = targetm.simd_clone.usable (n);
4078            if (target_badness < 0)

(returns 0)

But note we do

4073            if (num_calls != 1)
4074              this_badness += exact_log2 (num_calls) * 4096;

which of course is quite bogus since we have 12 calls and exact_log2 will
return -1 here.  Maybe we want ceil_log2 here.

when we try the simdlen == 2 variant that also turns out usable but
the calculates badness is the same so we stick to the simdlen == 1 one.

So - the target should reject this clone or not generate it in the first
place.  And of course the cost thing should be fixed which will likely mask
the issue in the target.

Reply via email to