http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48616

Matthias Kretz <kretz at kde dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86_64

--- Comment #3 from Matthias Kretz <kretz at kde dot org> 2011-04-15 12:11:35 
UTC ---
(In reply to comment #1)
> I see no vectorized loop which makes me suspect if-conversion.  Can you
> try if -ftree-loop-if-convert is enough to trigger the failure?

% /opt/gcc-4.6.0/bin/g++ -mxop -O2 -ftree-vectorize xop_miscompile.cpp &&
./a.out
 FAIL: ┍ at /home/mkretz/src/Vc/tests/arithmetics.cpp:259:
 FAIL: │ a[i] (16) == x (8) -> false
 FAIL: ┕ testShift<int_v>
 FAIL: ┍ at /home/mkretz/src/Vc/tests/arithmetics.cpp:259:
 FAIL: │ a[i] (16) == x (8) -> false
 FAIL: ┕ testShift<uint_v>

 Testing done. 0 tests passed. 2 tests failed.

% /opt/gcc-4.6.0/bin/g++ -mxop -O2 -ftree-loop-if-convert xop_miscompile.cpp &&
./a.out
 PASS: testShift<int_v>
 PASS: testShift<uint_v>

 Testing done. 2 tests passed. 0 tests failed.

(In reply to comment #2)
> You also haven't specified your target, whether you compile it as 32-bit or
> 64-bit and where exactly it misbehaves.

target is AMD64 (i.e. Bulldozer/Family 15h)

The failure is in line 1724, or more specifically in lines 1288 and 1290. The
operator>>= seems to get lost, so that the a[i] contain 16 instead of 16>>i.
XOP has an instruction for this shift. For operator<<= (lines 1287 and 1289)
GCC correctly translates the code to vpshad.

Reply via email to