This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/54272] [SH] Add support for addv / subv instructions
- From: "olegendo at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 16 Aug 2012 20:34:53 +0000
- Subject: [Bug target/54272] [SH] Add support for addv / subv instructions
- Auto-submitted: auto-generated
- References: <bug-54272-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54272
Oleg Endo <olegendo at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2012-08-16
Ever Confirmed|0 |1
--- Comment #5 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-08-16 20:34:53 UTC ---
Regarding saturating arithmetic, I took the function FIXED_SSADD from
libgcc/fixed-bit.c and substituted FIXED_C_TYPE with int.
int test_01 (int a, int b)
{
int c;
int x, y, z;
x = a;
y = b;
z = x + y;
if ((((x ^ y) >> 31) & 1) == 0)
{
if (((z ^ x) >> 31) & 1)
{
z = 1;
z = z << 31;
if (x >= 0)
z--;
}
}
c = z;
return c;
}
compiled with -O2 -m4 -ml:
div0s r4,r5
mov r4,r0
bt/s .L4
add r5,r0
div0s r0,r4
bt/s .L6
cmp/pz r4
.L4:
rts
nop
.align 1
.L6:
mov.l .L7,r0
movt r1
rts
sub r1,r0
.L8:
.align 2
.L7:
.long -2147483648
In this case combine can successfully match the div0s sign comparison patterns
that I added in PR 52933. However, after matching those, it does not try to
combine the patterns any further (probably because of the conditional
branches). I guess this would be a job for an optimization at the GIMPLE level.