aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/rs6000/rs6000.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/rs6000/rs6000.c')
-rw-r--r--gcc/config/rs6000/rs6000.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 78d87db6b5a..921f2eab7b0 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -7957,7 +7957,9 @@ toc_relative_expr_p (const_rtx op, bool strict, const_rtx *tocrel_base_ret,
*tocrel_offset_ret = tocrel_offset;
return (GET_CODE (tocrel_base) == UNSPEC
- && XINT (tocrel_base, 1) == UNSPEC_TOCREL);
+ && XINT (tocrel_base, 1) == UNSPEC_TOCREL
+ && REG_P (XVECEXP (tocrel_base, 0, 1))
+ && REGNO (XVECEXP (tocrel_base, 0, 1)) == TOC_REGISTER);
}
/* Return true if X is a constant pool address, and also for cmodel=medium