diff mbox series

rs6000: Properly handle LE index munging in vec_shr (PR94710)

Message ID 1171154585e18e99a21ef0f44009d9f9b5461890.1587753197.git.segher@kernel.crashing.org
State New
Headers show
Series rs6000: Properly handle LE index munging in vec_shr (PR94710) | expand

Commit Message

Segher Boessenkool April 24, 2020, 6:40 p.m. UTC
The PR shows the compiler crashing with -mvsx -mlittle -O0.  This turns
out to be caused by a failure to make of the higher bits in an index
endian conversion.

Tested on powerpc64-linux {-m32,-m64} and on powerpc64le-linux.

Committing to trunk.

(This will need backports).


Segher


2020-04-24  Segher Boessenkool  <segher@kernel.crashing.org>

	PR target/94710
	* config/rs6000/vector.md (vec_shr_<mode> for VEC_L): Correct little
	endian byteshift_val calculation.
---
 gcc/config/rs6000/vector.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/gcc/config/rs6000/vector.md b/gcc/config/rs6000/vector.md
index 5bc8f80..662521e 100644
--- a/gcc/config/rs6000/vector.md
+++ b/gcc/config/rs6000/vector.md
@@ -1426,7 +1426,8 @@  (define_expand "vec_shr_<mode>"
   emit_move_insn (zero_reg, CONST0_RTX (<MODE>mode));
   if (!BYTES_BIG_ENDIAN)
     {
-      byteshift_val = 16 - byteshift_val;
+      /* Note, byteshift_val can be 0!  */
+      byteshift_val = -byteshift_val & 15;
       op1 = zero_reg;
       op2 = operands[1];
     }