rs6000: Properly handle LE index munging in vec_shr (PR94710)
authorSegher Boessenkool <segher@kernel.crashing.org>
Fri, 24 Apr 2020 13:33:14 +0000 (13:33 +0000)
committerSegher Boessenkool <segher@kernel.crashing.org>
Fri, 24 Apr 2020 18:55:32 +0000 (18:55 +0000)
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.

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/ChangeLog
gcc/config/rs6000/vector.md

index 2db3413a9731f574d9ffdb819babb54067ec016a..4b6456e2416eeef9b12344af2cc93bf7dbc800d4 100644 (file)
@@ -1,3 +1,9 @@
+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.
+
 2020-04-24  Andrew Stubbs  <ams@codesourcery.com>
 
        * config/gcn/gcn.md (*mov<mode>_insn): Only split post-reload.
index 5bc8f802504c178ff608b2e6ead76e2349b7d6d3..662521e74fe21692d87faed2e15a396770ce9c7d 100644 (file)
   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];
     }