diff options
author | Thomas Preud'homme <thomas.preudhomme@arm.com> | 2014-11-10 17:18:23 +0000 |
---|---|---|
committer | Thomas Preud'homme <thopre01@gcc.gnu.org> | 2014-11-10 17:18:23 +0000 |
commit | a25efea0868cef17064a71d76a2fd7d209adc6b3 (patch) | |
tree | 226ebbd4f9da3be46dbca04c4c51e6b2f770d812 /gcc | |
parent | 02ff56e68a381d449723b6d4c19189a08bb66484 (diff) | |
download | gcc-a25efea0868cef17064a71d76a2fd7d209adc6b3.zip gcc-a25efea0868cef17064a71d76a2fd7d209adc6b3.tar.gz gcc-a25efea0868cef17064a71d76a2fd7d209adc6b3.tar.bz2 |
expmed.c (expand_shift_1): Expand 8 bit rotate of 16 bit value to bswaphi if available.
2014-11-10 Thomas Preud'homme <thomas.preudhomme@arm.com>
* expmed.c (expand_shift_1): Expand 8 bit rotate of 16 bit value to
bswaphi if available.
From-SVN: r217302
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/expmed.c | 12 |
2 files changed, 17 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c170e69..4b70b62 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-11-10 Thomas Preud'homme <thomas.preudhomme@arm.com> + + * expmed.c (expand_shift_1): Expand 8 bit rotate of 16 bit value to + bswaphi if available. + 2014-11-10 Bernd Schmidt <bernds@codesourcery.com> * config/nvptx/nvptx.c: New file. diff --git a/gcc/expmed.c b/gcc/expmed.c index af14b99..b099dc2 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -2164,6 +2164,18 @@ expand_shift_1 (enum tree_code code, machine_mode mode, rtx shifted, code = left ? LROTATE_EXPR : RROTATE_EXPR; } + /* Rotation of 16bit values by 8 bits is effectively equivalent to a bswaphi. + Note that this is not the case for bigger values. For instance a rotation + of 0x01020304 by 16 bits gives 0x03040102 which is different from + 0x04030201 (bswapsi). */ + if (rotate + && CONST_INT_P (op1) + && INTVAL (op1) == BITS_PER_UNIT + && GET_MODE_SIZE (scalar_mode) == 2 + && optab_handler (bswap_optab, HImode) != CODE_FOR_nothing) + return expand_unop (HImode, bswap_optab, shifted, NULL_RTX, + unsignedp); + if (op1 == const0_rtx) return shifted; |