summaryrefslogtreecommitdiff
path: root/gcc/expmed.c
diff options
context:
space:
mode:
authorAdam Nemet <anemet@caviumnetworks.com>2008-11-18 02:08:24 +0000
committerAdam Nemet <nemet@gcc.gnu.org>2008-11-18 02:08:24 +0000
commita990abffbfc5ee94b38f986f266cd5c365c0c045 (patch)
tree5a743df1e9e72a72b5cbac89bebae2c44dd3bd74 /gcc/expmed.c
parentda8f5862ce62b97b095d833ea31a82f3848f79fa (diff)
downloadgcc-a990abffbfc5ee94b38f986f266cd5c365c0c045.tar.gz
expmed.c (extract_bit_field_1): Also use a temporary and convert_extracted_bit_field when...
* expmed.c (extract_bit_field_1): Also use a temporary and convert_extracted_bit_field when the conversion from ext_mode to the target mode requires explicit truncation. testsuite/ * gcc.c-torture/execute/20081117-1.c: New test. From-SVN: r141960
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r--gcc/expmed.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 0c7e611e188..70a0d18bcb5 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -1533,7 +1533,13 @@ extract_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
if (GET_MODE (xtarget) != ext_mode)
{
- if (REG_P (xtarget))
+ /* Don't use LHS paradoxical subreg if explicit truncation is needed
+ between the mode of the extraction (word_mode) and the target
+ mode. Instead, create a temporary and use convert_move to set
+ the target. */
+ if (REG_P (xtarget)
+ && TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (GET_MODE (xtarget)),
+ GET_MODE_BITSIZE (ext_mode)))
{
xtarget = gen_lowpart (ext_mode, xtarget);
if (GET_MODE_SIZE (ext_mode)