diff mbox

, PR 78192, Fix PowerPC ISA 3.0 xxextractaw/vextractu{b,h} on little endian

Message ID 20161103222211.GA13965@ibm-tiger.the-meissners.org
State New
Headers show

Commit Message

Michael Meissner Nov. 3, 2016, 10:22 p.m. UTC
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  <meissner@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.

Comments

Segher Boessenkool Nov. 3, 2016, 11:19 p.m. UTC | #1
On Thu, Nov 03, 2016 at 06:22:11PM -0400, Michael Meissner wrote:
> 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?

Certainly!  Thanks for the fix.  One nit, see below.


Segher


> 2016-11-03  Michael Meissner  <meissner@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.

Three "n"s in endianness (another instance in the patch itself).
diff mbox

Patch

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)