Patchwork [PowerPC] rs6000_expand_vector_init selects wrong field for splat in LE mode

login
register
mail settings
Submitter William J. Schmidt
Date July 22, 2013, 5:12 p.m.
Message ID <1374513162.3633.86.camel@gnopaine>
Download mbox | patch
Permalink /patch/260767/
State New
Headers show

Comments

William J. Schmidt - July 22, 2013, 5:12 p.m.
In little-endian mode, the field selected for use in a vector splat is
numbered differently than in big-endian mode.  This patch corrects the
code generated for little-endian.  This addresses 45 test failures when
running the test-suite in little-endian mode.

Bootstrapped and tested on powerpc64-unknown-linux-gnu with no new
regressions.  Ok for trunk?

Patch by Anton Blanchard.

Thanks,
Bill


2013-07-22  Bill Schmidt  <wschmidt@vnet.linux.ibm.com>
	    for Anton Blanchard <anton@au1.ibm.com>

	* config/rs6000/rs6000.c (rs6000_expand_vector_init): Fix
	endianness when selecting field to splat.
David Edelsohn - July 22, 2013, 9:52 p.m.
On Mon, Jul 22, 2013 at 1:12 PM, Bill Schmidt
<wschmidt@linux.vnet.ibm.com> wrote:
> In little-endian mode, the field selected for use in a vector splat is
> numbered differently than in big-endian mode.  This patch corrects the
> code generated for little-endian.  This addresses 45 test failures when
> running the test-suite in little-endian mode.
>
> Bootstrapped and tested on powerpc64-unknown-linux-gnu with no new
> regressions.  Ok for trunk?
>
> Patch by Anton Blanchard.
>
> Thanks,
> Bill
>
>
> 2013-07-22  Bill Schmidt  <wschmidt@vnet.linux.ibm.com>
>             for Anton Blanchard <anton@au1.ibm.com>
>
>         * config/rs6000/rs6000.c (rs6000_expand_vector_init): Fix
>         endianness when selecting field to splat.

Okay.

But please either only list Anton in the ChangeLog or list both you
and Anton, but not "for Anton".

Thanks, David

Patch

Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	(revision 201131)
+++ gcc/config/rs6000/rs6000.c	(working copy)
@@ -5177,6 +5177,7 @@  rs6000_expand_vector_init (rtx target, rtx vals)
      of 64-bit items is not supported on Altivec.  */
   if (all_same && GET_MODE_SIZE (inner_mode) <= 4)
     {
+      rtx field;
       mem = assign_stack_temp (mode, GET_MODE_SIZE (inner_mode));
       emit_move_insn (adjust_address_nv (mem, inner_mode, 0),
 		      XVECEXP (vals, 0, 0));
@@ -5187,9 +5188,11 @@  rs6000_expand_vector_init (rtx target, rtx vals)
 					      gen_rtx_SET (VOIDmode,
 							   target, mem),
 					      x)));
+      field = (BYTES_BIG_ENDIAN ? const0_rtx
+	       : GEN_INT (GET_MODE_NUNITS (mode) - 1));
       x = gen_rtx_VEC_SELECT (inner_mode, target,
 			      gen_rtx_PARALLEL (VOIDmode,
-						gen_rtvec (1, const0_rtx)));
+						gen_rtvec (1, field)));
       emit_insn (gen_rtx_SET (VOIDmode, target,
 			      gen_rtx_VEC_DUPLICATE (mode, x)));
       return;