This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [PATCH, FT32] initial support
- From: James Bowman <james dot bowman at ftdichip dot com>
- To: Paolo Bonzini <bonzini at gnu dot org>, Andrew Pinski <pinskia at gmail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 4 Feb 2015 02:26:19 +0000
- Subject: RE: [PATCH, FT32] initial support
- Authentication-results: sourceware.org; auth=none
- References: <CA9BBF0458F83C4F9051448B941B57D117152C33 at glaexch1> <CA+=Sn1mQwV22HfYrX2fC-RuhS0-e+u+wZ8NZoH33CFnmsGOmtQ at mail dot gmail dot com>,<54D0DEE1 dot 80501 at gnu dot org>
> optabs.c's expand_abs_nojump already knows this trick:
>
> /* If this machine has expensive jumps, we can do integer absolute
> value of X as (((signed) x >> (W-1)) ^ x) - ((signed) x >> (W-1)),
> where W is the width of MODE. */
>
> So if you define BRANCH_COST to be 2 or more there should be no need for
> this pattern at all.
Yes, I just confirmed this. With no abssi2 pattern, this:
int side;
int foo(int x)
{
side = x >> 31;
return abs(x);
}
does indeed produce:
foo:
ashr.l $r1,$r0,31
sta.l side,$r1
xor.l $r0,$r1,$r0
sub.l $r0,$r0,$r1
return
Thanks.
--
James Bowman
FTDI Open Source Liaison