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 05:00 PM, H.J. Lu wrote:
On Tue, Jan 5, 2010 at 7:55 AM, Paolo Bonzini<bonzini@gnu.org> wrote:
I see no other way to fixup the underflow. Some comments below:

You can always subtract (or XOR) the sign bit to turn an unsigned value to the corresponding signed value. The attached patch (on top of the code before H.J.'s patch) fixes the C testcase in the PR, but I didn't test it further and I don't have time unfortunately.

What is the the corresponding signed value of unsigned 0x8000000?

0 of course. For example


0x7FFFFFFF ltu 0x80000000 ltu 0x80000001

becomes after flipping the sign bit

0xFFFFFFFF < 0x00000000 < 0x00000001

which is just -1 < 0 < 1.

Paolo


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