Aaron has been running tests on the simulator, and some of the tests fails on little endian systems. The failing tests do int extracts from a V4SImode vector. In looking at the code, the vector index was adjusted when the low level extract instruction was created, and then adjusted again within the insn. This patch removes the second adjustment.
I have done bootstraps and make check on both big endian and little endian power8 systems with no regressions. I have verrified that the tests now pass in the simulator for both little and big endian targets. Can I install this patch on the trunk? 2016-11-03 Michael Meissner <meiss...@linux.vnet.ibm.com> PR target/78192 * config/rs6000/vsx.md (vsx_extract_<mode>_di): The element number has already been adjusted for endianess, so don't adjust it any further. -- Michael Meissner, IBM IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA email: meiss...@linux.vnet.ibm.com, phone: +1 (978) 899-4797
Index: gcc/config/rs6000/vsx.md =================================================================== --- gcc/config/rs6000/vsx.md (revision 241828) +++ gcc/config/rs6000/vsx.md (working copy) @@ -2586,11 +2586,10 @@ (define_insn "vsx_extract_<mode>_di" (parallel [(match_operand:QI 2 "<VSX_EXTRACT_PREDICATE>" "n")]))))] "VECTOR_MEM_VSX_P (<MODE>mode) && TARGET_VEXTRACTUB" { - int element = INTVAL (operands[2]); + /* Note, the element number has already been adjusted for endianess, so we + don't have to adjust it here. */ int unit_size = GET_MODE_UNIT_SIZE (<MODE>mode); - int offset = ((VECTOR_ELT_ORDER_BIG) - ? unit_size * element - : unit_size * (GET_MODE_NUNITS (<MODE>mode) - 1 - element)); + HOST_WIDE_INT offset = unit_size * INTVAL (operands[2]); operands[2] = GEN_INT (offset); if (unit_size == 4)