summaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2006-12-21 04:35:05 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2006-12-21 04:35:05 +0000
commitf28bdbe8146354159c0e41f8f7ff91870a700fb0 (patch)
treea5b050ff53d642560fe932ca38025f8052b40f6b /gcc/simplify-rtx.c
parent45aa7bcc28818c54b0c8859ec0b1cdb26a65637c (diff)
downloadgcc-f28bdbe8146354159c0e41f8f7ff91870a700fb0.tar.gz
* simplify-rtx.c (simplify_subreg): Use the correct mode when
determining whether a SUBREG of a CONCAT refers to the first or second component. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120101 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 149ee6b652e..2199c634b83 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -4648,13 +4648,22 @@ simplify_subreg (enum machine_mode outermode, rtx op,
of real and imaginary part. */
if (GET_CODE (op) == CONCAT)
{
- unsigned int inner_size, final_offset;
+ unsigned int part_size, final_offset;
rtx part, res;
- inner_size = GET_MODE_UNIT_SIZE (innermode);
- part = byte < inner_size ? XEXP (op, 0) : XEXP (op, 1);
- final_offset = byte % inner_size;
- if (final_offset + GET_MODE_SIZE (outermode) > inner_size)
+ part_size = GET_MODE_UNIT_SIZE (GET_MODE (XEXP (op, 0)));
+ if (byte < part_size)
+ {
+ part = XEXP (op, 0);
+ final_offset = byte;
+ }
+ else
+ {
+ part = XEXP (op, 1);
+ final_offset = byte - part_size;
+ }
+
+ if (final_offset + GET_MODE_SIZE (outermode) > part_size)
return NULL_RTX;
res = simplify_subreg (outermode, part, GET_MODE (part), final_offset);