summaryrefslogtreecommitdiff
path: root/gcc/expmed.c
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2013-06-04 07:41:18 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2013-06-04 07:41:18 +0000
commit8744b4c5b5a838296875f5a4d5f2274048305388 (patch)
tree187f2f0be4d237ebc45c7825079b5c251948b0c1 /gcc/expmed.c
parentd3769f59c0ee782e5f6b2e9b3e2735c648c33801 (diff)
downloadgcc-8744b4c5b5a838296875f5a4d5f2274048305388.tar.gz
* expmed.c (extract_bit_field_1): In the larger-than-a-word case, factor
out the processing order as in store_bit_field_1. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@199637 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r--gcc/expmed.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c
index daadd3def5d..79f3424961d 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -1486,6 +1486,7 @@ extract_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
This is because the most significant word is the one which may
be less than full. */
+ unsigned int backwards = WORDS_BIG_ENDIAN;
unsigned int nwords = (bitsize + (BITS_PER_WORD - 1)) / BITS_PER_WORD;
unsigned int i;
rtx last;
@@ -1503,13 +1504,14 @@ extract_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
if I is 1, use the next to lowest word; and so on. */
/* Word number in TARGET to use. */
unsigned int wordnum
- = (WORDS_BIG_ENDIAN
+ = (backwards
? GET_MODE_SIZE (GET_MODE (target)) / UNITS_PER_WORD - i - 1
: i);
/* Offset from start of field in OP0. */
- unsigned int bit_offset = (WORDS_BIG_ENDIAN
- ? MAX (0, ((int) bitsize - ((int) i + 1)
- * (int) BITS_PER_WORD))
+ unsigned int bit_offset = (backwards
+ ? MAX ((int) bitsize - ((int) i + 1)
+ * BITS_PER_WORD,
+ 0)
: (int) i * BITS_PER_WORD);
rtx target_part = operand_subword (target, wordnum, 1, VOIDmode);
rtx result_part
@@ -1541,7 +1543,7 @@ extract_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
for (i = nwords; i < total_words; i++)
emit_move_insn
(operand_subword (target,
- WORDS_BIG_ENDIAN ? total_words - i - 1 : i,
+ backwards ? total_words - i - 1 : i,
1, VOIDmode),
const0_rtx);
}