diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1994-02-26 18:01:47 -0500 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1994-02-26 18:01:47 -0500 |
commit | 30a4619dbec90c87100950083780dd77334c7c65 (patch) | |
tree | 03738fd595df0048fd63d39f4eaa76981d58ec57 | |
parent | 0b9ccabc3c5e637a794516c9b06bb492c56c77f7 (diff) | |
download | gcc-30a4619dbec90c87100950083780dd77334c7c65.zip gcc-30a4619dbec90c87100950083780dd77334c7c65.tar.gz gcc-30a4619dbec90c87100950083780dd77334c7c65.tar.bz2 |
(movsi): If -mno-sum-in-toc, do addition of symbol + const.
From-SVN: r6635
-rw-r--r-- | gcc/config/rs6000/rs6000.md | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index c1325dd..aa55d33 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -2844,6 +2844,25 @@ if (CONSTANT_P (operands[1]) && GET_CODE (operands[1]) != CONST_INT && ! LEGITIMATE_CONSTANT_POOL_ADDRESS_P (operands[1])) { + /* If we are to limit the number of things we put in the TOC and + this is a symbol plus a constant we can add in one insn, + just put the sumbol in the TOC and add the constant. Don't do + this if reload is in progress. */ + if (GET_CODE (operands[1]) == CONST + && TARGET_NO_SUM_IN_TOC && ! reload_in_progress + && GET_CODE (XEXP (operands[1], 0)) == PLUS + && add_operand (XEXP (XEXP (operands[1], 0), 1), SImode) + && (GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == LABEL_REF + || GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == SYMBOL_REF) + && ! side_effects_p (operands[0])) + { + rtx sym = force_const_mem (SImode, XEXP (XEXP (operands[1], 0), 0)); + rtx other = XEXP (XEXP (operands[1], 0), 1); + + emit_insn (gen_addsi3 (operands[0], force_reg (SImode, sym), other)); + DONE; + } + operands[1] = force_const_mem (SImode, operands[1]); if (! memory_address_p (SImode, XEXP (operands[1], 0)) && ! reload_in_progress) |