aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2004-12-02 14:23:08 -0800
committerRichard Henderson <rth@gcc.gnu.org>2004-12-02 14:23:08 -0800
commitddf4e03f488ea3936ddc87e97f3e8a4cde9dcf9e (patch)
tree34661c965cd2f7f4836dd21e2abf24265c20627b /gcc/expr.c
parent0cb4334ee9bae97eb674ffd6bb26088fe7f25865 (diff)
downloadgcc-ddf4e03f488ea3936ddc87e97f3e8a4cde9dcf9e.zip
gcc-ddf4e03f488ea3936ddc87e97f3e8a4cde9dcf9e.tar.gz
gcc-ddf4e03f488ea3936ddc87e97f3e8a4cde9dcf9e.tar.bz2
expr.c (write_complex_part): Use simplify_gen_subreg when the submode is at least as large as a word.
* expr.c (write_complex_part): Use simplify_gen_subreg when the submode is at least as large as a word. (read_complex_part): Likewise. From-SVN: r91664
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c40
1 files changed, 34 insertions, 6 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index f16f82f..ec25713 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -2580,16 +2580,32 @@ clear_storage_libcall_fn (int for_call)
static void
write_complex_part (rtx cplx, rtx val, bool imag_p)
{
+ enum machine_mode cmode;
+ enum machine_mode imode;
+ unsigned ibitsize;
+
if (GET_CODE (cplx) == CONCAT)
- emit_move_insn (XEXP (cplx, imag_p), val);
- else
{
- enum machine_mode cmode = GET_MODE (cplx);
- enum machine_mode imode = GET_MODE_INNER (cmode);
- unsigned ibitsize = GET_MODE_BITSIZE (imode);
+ emit_move_insn (XEXP (cplx, imag_p), val);
+ return;
+ }
- store_bit_field (cplx, ibitsize, imag_p ? ibitsize : 0, imode, val);
+ cmode = GET_MODE (cplx);
+ imode = GET_MODE_INNER (cmode);
+ ibitsize = GET_MODE_BITSIZE (imode);
+
+ /* If the sub-object is at least word sized, then we know that subregging
+ will work. This special case is important, since store_bit_field
+ wants to operate on integer modes, and there's rarely an OImode to
+ correspond to TCmode. */
+ if (ibitsize >= BITS_PER_WORD)
+ {
+ rtx part = simplify_gen_subreg (imode, cplx, cmode,
+ imag_p ? GET_MODE_SIZE (imode) : 0);
+ emit_move_insn (part, val);
}
+ else
+ store_bit_field (cplx, ibitsize, imag_p ? ibitsize : 0, imode, val);
}
/* Extract one of the components of the complex value CPLX. Extract the
@@ -2620,6 +2636,18 @@ read_complex_part (rtx cplx, bool imag_p)
}
}
+ /* If the sub-object is at least word sized, then we know that subregging
+ will work. This special case is important, since extract_bit_field
+ wants to operate on integer modes, and there's rarely an OImode to
+ correspond to TCmode. */
+ if (ibitsize >= BITS_PER_WORD)
+ {
+ rtx ret = simplify_gen_subreg (imode, cplx, cmode,
+ imag_p ? GET_MODE_SIZE (imode) : 0);
+ gcc_assert (ret != NULL);
+ return ret;
+ }
+
return extract_bit_field (cplx, ibitsize, imag_p ? ibitsize : 0,
true, NULL_RTX, imode, imode);
}