diff options
author | Andrew Stubbs <ams@codesourcery.com> | 2018-09-27 11:15:48 +0000 |
---|---|---|
committer | Andrew Stubbs <ams@gcc.gnu.org> | 2018-09-27 11:15:48 +0000 |
commit | 19ef5a8fd5710a197ddeaafc2c69ff77217fece5 (patch) | |
tree | 7255ef04d5405b07935f7164c33e01a7d2af6cba | |
parent | 90e79377a542e63b5cded9c72064b11e7833cce4 (diff) | |
download | gcc-19ef5a8fd5710a197ddeaafc2c69ff77217fece5.zip gcc-19ef5a8fd5710a197ddeaafc2c69ff77217fece5.tar.gz gcc-19ef5a8fd5710a197ddeaafc2c69ff77217fece5.tar.bz2 |
[pr82089] Don't sign-extend SFV 1 in BImode
This is an update of the patch posted to PR82089 long ago. We ran into the
same bug on GCN, so we need this fixed as part of this series.
2018-09-27 Andrew Stubbs <ams@codesourcery.com>
Tom de Vries <tom@codesourcery.com>
PR 82089
gcc/
* expmed.c (emit_cstore): Fix handling of result_mode == BImode and
STORE_FLAG_VALUE == 1.
Co-Authored-By: Tom de Vries <tom@codesourcery.com>
From-SVN: r264666
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/expmed.c | 11 |
2 files changed, 15 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8691d52..4606d9d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2018-09-27 Andrew Stubbs <ams@codesourcery.com> + Tom de Vries <tom@codesourcery.com> + + PR 82089 + + * expmed.c (emit_cstore): Fix handling of result_mode == BImode and + STORE_FLAG_VALUE == 1. + 2018-09-27 Andreas Krebbel <krebbel@linux.ibm.com> * config/s390/s390.md (PPA_TX_ABORT, PPA_OOO_BARRIER): New diff --git a/gcc/expmed.c b/gcc/expmed.c index 29ce10b..444d6a8 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -5464,11 +5464,14 @@ emit_cstore (rtx target, enum insn_code icode, enum rtx_code code, If STORE_FLAG_VALUE does not have the sign bit set when interpreted in MODE, we can do this conversion as unsigned, which is usually more efficient. */ - if (GET_MODE_SIZE (int_target_mode) > GET_MODE_SIZE (result_mode)) + if (GET_MODE_PRECISION (int_target_mode) > GET_MODE_PRECISION (result_mode)) { - convert_move (target, subtarget, - val_signbit_known_clear_p (result_mode, - STORE_FLAG_VALUE)); + gcc_assert (GET_MODE_PRECISION (result_mode) != 1 + || STORE_FLAG_VALUE == 1 || STORE_FLAG_VALUE == -1); + + bool unsignedp = (STORE_FLAG_VALUE >= 0); + convert_move (target, subtarget, unsignedp); + op0 = target; result_mode = int_target_mode; } |