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

--- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Uroš Bizjak from comment #3)
> (In reply to Andrew Pinski from comment #2)
> 
> > Someone will have to debug ifcvt.cc to see why it fails on x86_64 but works
> > on aarch64.  Note there are some new changes to ifcvt.cc in review which
> > might improve this, though I am not sure.
> 
> x86_64 targetm.noce_conversion_profitable_p returns false for:

Actually, the cost function goes to default_noce_conversion_profitable_p,
where:

(gdb) p cost
$1 = 16
(gdb) p if_info->original_cost 
$2 = 8
(gdb) p if_info->max_seq_cost 
$3 = 0

For some reason, max_seq_cost remains zero, while on aarch64:

(gdb) p cost
$2 = 12
(gdb) p if_info->original_cost
$3 = 8
(gdb) p if_info->max_seq_cost
$4 = 12

So, x86_64 returns false from the default cost function:

  /* When compiling for size, we can make a reasonably accurately guess
     at the size growth.  When compiling for speed, use the maximum.  */
  return speed_p && cost <= if_info->max_seq_cost;

Reply via email to