[PATCH] Fix InstCombine vector bitcasts for big-endian
rsandifo at linux.vnet.ibm.com
Thu Aug 8 02:04:07 PDT 2013
MultiSource/Benchmarks/mediabench/gsm/toast started failing on z after
SLP was enabled by default. I think this was just tripping over a latent
endianness bug in the way that integer-to-vector bitcasts are handled by
InstCombine. All the current logic assumes that the lsb of an integer
corresponds to vector element 0, whereas for big-endian it's the other way
around: the msb is in the first element and the lsb is in the last element.
One fix would be to handle the endianness difference every time we
calculate an index, but that looked horrible. Another would have been
to assume little-endian ordering until a paricular point, and then
switch to big-endian (e.g. when assigning to Elements), but that
seemed error-prone. So in the end I thought it'd be better to pass
around a shift amount instead of a vector index, since shift amounts
don't depend on endianness.
For tests I copied the remaining @test* functions from bitcast.ll to
bitcast-bigendian.ll and adjusted the expected output accordingly.
OK to commit?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 8296 bytes
Desc: not available
More information about the llvm-commits