Commit 82979abd by Markus Trippelsdorf Committed by Markus Trippelsdorf

Fix PR78556 - left shift of negative values

Running bootstrap-ubsan on ppc64le shows many instances of e.g.:
 config/rs6000/rs6000.c:6217:36: runtime error: left shift of negative value -12301

        PR target/78556
	* config/rs6000/rs6000.c (vspltis_constant): Add casts to avoid
	left shifting of negative values.

From-SVN: r242928
parent 80cf1b8b
2016-11-28 Markus Trippelsdorf <markus@trippelsdorf.de>
PR target/78556
* config/rs6000/rs6000.c (vspltis_constant): Add casts to avoid
left shifting of negative values.
2016-11-28 Jakub Jelinek <jakub@redhat.com> 2016-11-28 Jakub Jelinek <jakub@redhat.com>
PR fortran/78298 PR fortran/78298
...@@ -6214,7 +6214,9 @@ vspltis_constant (rtx op, unsigned step, unsigned copies) ...@@ -6214,7 +6214,9 @@ vspltis_constant (rtx op, unsigned step, unsigned copies)
bitsize /= 2; bitsize /= 2;
small_val = splat_val >> bitsize; small_val = splat_val >> bitsize;
mask >>= bitsize; mask >>= bitsize;
if (splat_val != ((small_val << bitsize) | (small_val & mask))) if (splat_val != ((HOST_WIDE_INT)
((unsigned HOST_WIDE_INT) small_val << bitsize)
| (small_val & mask)))
return false; return false;
splat_val = small_val; splat_val = small_val;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment