This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] rtx_costs vs. const_int


Hi Alan,

On Mon, Jun 15, 2015 at 12:03:47PM +0930, Alan Modra wrote:
> This patch changes the targetm.rtx_costs interface to pass a mode
> parameter, and removes a redundant parameter.  The reason for the
> change is that powerpc and other backends need the mode that a
> const_int is used in to properly determine the cost.  For instance,
> (set (reg) (ior (reg) (const_int))) where const_int is 0xff..ffff0000
> can be implemented in one instruction on powerpc if the regs and
> constant are SImode, but not when DImode.

Nice :-)

> Some backends work around this problem by calculating the cost of the
> entire expression under the IOR, which allows the mode of the
> const_int to be inferred.

Yeah, I do this in my series to improve the PowerPC rotate-and-mask
instructions.  Some of the time you really have to look at a bigger
part of the pattern, but your patch should help here.

> sub-rtx's in rtx_cost are
> summed in order rather than reverse order so that the mode from an
> earlier operand can be used for a later operand lacking a mode.  This
> is for ZERO_EXTEND and similar codes where the sub-rtx mode is
> different to the outer mode.  Canonicalization puts const_int operands
> after other operands.

Not always; only for commutative operations, or operations that can be
swapped (like comparisons).  As a counterexample, see PowerPC subfic
(imm - reg).

> The testing showed some pre-existing bugs..
> 
> arc-elf dies on attempting to assemble first libgcc file, due to gas
> not understanding the options being passed by gcc.  Apparently no one
> cared enough to push gas changes upstream.

You need to configure it with --with-cpu.  Not that that makes any
sense :-)

> ia64-linux, m68k-linux, tilegx-linux and tilepro-linux have
> dependencies on include files, not solved by -Dinhibit_libc, so die
> building libgcc.  Can be solved by hand, but annoying.

Very annoying yes.  Have patches for all; will send.

> s390x-linux doesn't build as a cross-compiler.  undefined reference to
> `s390_host_detect_local_cpu(int, char const**)'

This is recent, maybe already fixed?


Segher


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]