Commit a25efea0 by Thomas Preud'homme Committed by Thomas Preud'homme

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
parent 02ff56e6
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> 2014-11-10 Bernd Schmidt <bernds@codesourcery.com>
* config/nvptx/nvptx.c: New file. * config/nvptx/nvptx.c: New file.
...@@ -2164,6 +2164,18 @@ expand_shift_1 (enum tree_code code, machine_mode mode, rtx shifted, ...@@ -2164,6 +2164,18 @@ expand_shift_1 (enum tree_code code, machine_mode mode, rtx shifted,
code = left ? LROTATE_EXPR : RROTATE_EXPR; 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) if (op1 == const0_rtx)
return shifted; return shifted;
......
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