[Bug target/62631] gcc.dg/tree-ssa/ivopts-lt-2.c FAILs
ebotcazou at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Feb 4 11:45:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62631
--- Comment #16 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> The cost of expression "p + ((sizetype)(99 - i_6(D)) + 1) * 4" computed
> using normal +/-/* operators on sparc64 is 18, but the cost is 32 if it is
> computed as "p + ((sizetype)(99 - i_6(D)) + 1) << 2", which is returned by
> get_shiftadd_cost.
How do you get the first number exactly? Note that the costs of shiftadd is
completely skewed (by a factor of 3) because expmed.c computes it as a multadd
instead of a shiftadd:
Breakpoint 2, init_expmed_one_mode (all=0x7fffffffd540, mode=QImode, speed=1)
at /home/eric/svn/gcc/gcc/expmed.c:219
219 set_shiftadd_cost (speed, mode, m, set_src_cost (all->shift_add,
speed));
(gdb) p debug_rtx(all->shift_add)
(plus:QI (mult:QI (reg:QI 109 [0])
(const_int 2 [0x2]))
(reg:QI 109 [0]))
but this should ensure that the costs are roughly the same for the expressions.
> From the assembly code, it seems the computation is expensive on sparc64, I
> may skip the test for these architectures if no other solutions.
The hitch is that the code generated for 32-bit SPARC (where the test passes)
is the optimal one and is also valid for 64-bit SPARC.
More information about the Gcc-bugs
mailing list