[AArch64 costs 14/18] Cost comparisons, flag setting operators and IF_THEN_ELSE

James Greenhalgh james.greenhalgh@arm.com
Wed May 28 22:19:00 GMT 2014


On Wed, May 28, 2014 at 10:51:10PM +0100, Andrew Pinski wrote:
> On Thu, Mar 27, 2014 at 10:33 AM, James Greenhalgh
> <james.greenhalgh@arm.com> wrote:
> > Hi,
> >
> > Next, comparisons, flag setting operations and IF_THEN_ELSE.
> >
> > Tested on aarch64-none-elf.
> >
> > Ok for stage 1?
> 
> This broke building the Linux kernel.
> A simple testcase:
> unsigned grab_cache_page_write_begin(unsigned flags, unsigned capabilities)
> {
>   unsigned gfp_mask;
>   unsigned gfp_notmask = 0;
>   gfp_mask = flags & ((1 << 25) - 1);
>   if (!(capabilities & 0x00000001))
>     gfp_mask |= 0x1000000u;
>   return (gfp_mask & ~gfp_notmask);
> }
> 
> ---- CUT ----
> The problem is combine creates the following RTL:
> (if_then_else:SI (reg:SI 78 [ D.2578 ])
>     (const_int 0 [0])
>     (const_int 16777216 [0x1000000]))
> 
> Which the code you added does not handle.  I am going to fix this but
> I need to re-factor this code.  I am going to place the code for
> IF_THEN_ELSE in its own function also since it is getting too large
> for my taste.

Ugh, sorry for that and confirmed locally. Refactoring this is very sensible.

Thanks for working on the fix.
James

> 
> Thanks,
> Andrew Pinski
> 
> >
> > Thanks,
> > James
> >
> > ---
> > 2014-03-27  James Greenhalgh  <james.greenhalgh@arm.com>
> >             Philipp Tomsich  <philipp.tomsich@theobroma-systems.com>
> >
> >         * config/aarch64/aarch64.c (aarch64_rtx_costs): Cost comparison
> >         operators.
> 



More information about the Gcc-patches mailing list