tilegx: work around vector insn bug in gcc
Commit Message
Chris Metcalf <cmetcalf@mellanox.com> writes:
> Good point. A bug was filed for this a year ago (78117) and I added a
> comment with my small use case, and pushed a tweak to the comment in
> sysdeps/tile/tilegx/string-endian.h referencing the bug.
That bug was filed by me, and is seemingly still open. I got a patch
back in the day from Mellanox which solved the problem for us. I
thought that bug was upstreamed to gcc, but apparently not.
The patch is attached.
commit 2486eee210176ac9bfd2e4bfcb4b18c32245d457
Author: Henrik Grindal Bakken <henribak@cisco.com>
Date: Tue Nov 22 16:36:34 2016 +0100
combine: Patch from Mellanox for tilegx optimization bug
This bug manifests itself by making strstr() fail its tests. This fix
is from Mellanox.
@@ -7213,6 +7213,7 @@ expand_field_assignment (const_rtx x)
else if (GET_CODE (SET_DEST (x)) == SUBREG
/* We need SUBREGs to compute nonzero_bits properly. */
&& nonzero_sign_valid
+ && !VECTOR_MODE_P (GET_MODE (SET_DEST (x)))
&& (((GET_MODE_SIZE (GET_MODE (SET_DEST (x)))
+ (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
== ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (SET_DEST (x))))
@@ -12790,6 +12791,7 @@ record_dead_and_set_regs_1 (rtx dest, const_rtx setter, void *data)
record_value_for_reg (dest, record_dead_insn, SET_SRC (setter));
else if (GET_CODE (setter) == SET
&& GET_CODE (SET_DEST (setter)) == SUBREG
+ && !VECTOR_MODE_P (GET_MODE (SET_DEST (setter)))
&& SUBREG_REG (SET_DEST (setter)) == dest
&& GET_MODE_PRECISION (GET_MODE (dest)) <= BITS_PER_WORD
&& subreg_lowpart_p (SET_DEST (setter)))