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: PR target/42542: Vectorizer produces incorrect results on max of signed intergers


On 01/05/2010 08:47 PM, H.J. Lu wrote:

Subtracting 0x80000000 from a number in the range 0 to 0xFFFFFFFF will
produce a result in the range -0x80000000 to 0x7FFFFFFF which is exactly
two's complement. ïXOR just happens to give the same result.

It's a very well known trick IMNSHO. ïPlease provide a counterexample if
you think there is one.
I don't have one. 0x8000000 was all that worried me.

H.J., can you please revert your patch and fix the PR with Paolo's proposed
solution?

Here is the patch. OK for trunk?

2010-01-05 Paolo Bonzini <bonzinI@gnu.rg> H.J. Lu <hongjiu.lu@intel.com> PR target/42542 * config/i386/i386.c (ix86_expand_int_vcond): Convert GTU to GT for V4SI and V2DI by subtracting (-(INT MAX) - 1) from both operands to make them signed. * config/i386/sse.md (umaxv4si3): Revert the last change. (umin<mode>3): Likewise. (uminv8hi3): Removed. (uminv4si3): Likewise. gcc/testsuite/ 2010-01-05 H.J. Lu <hongjiu.lu@intel.com> * gcc.target/i386/pr42542-1.c (res): Make it 8 elements.

This is OK for mainline and release branches after a couple of days without problems.


I guess that ia64 maintainer wants to apply the same fix to ia64, as noted by Paolo.

Thanks,
Uros.



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