summaryrefslogtreecommitdiff
path: root/gcc/config/nios2/nios2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/nios2/nios2.c')
-rw-r--r--gcc/config/nios2/nios2.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/config/nios2/nios2.c b/gcc/config/nios2/nios2.c
index 848cc51353..7b6b389989 100644
--- a/gcc/config/nios2/nios2.c
+++ b/gcc/config/nios2/nios2.c
@@ -1894,15 +1894,15 @@ nios2_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
Which will be output as '%tls_le(var+48)(r23)' in assembly. */
if (GET_CODE (x) == PLUS
- && GET_CODE (XEXP (x, 0)) == REG
&& GET_CODE (XEXP (x, 1)) == CONST)
{
- rtx unspec, offset, reg = XEXP (x, 0);
+ rtx unspec, offset;
split_const (XEXP (x, 1), &unspec, &offset);
if (GET_CODE (unspec) == UNSPEC
&& !nios2_large_offset_p (XINT (unspec, 1))
&& offset != const0_rtx)
{
+ rtx reg = force_reg (Pmode, XEXP (x, 0));
unspec = copy_rtx (unspec);
XVECEXP (unspec, 0, 0)
= plus_constant (Pmode, XVECEXP (unspec, 0, 0), INTVAL (offset));