aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/mips
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1994-03-22 16:03:38 -0800
committerJim Wilson <wilson@gcc.gnu.org>1994-03-22 16:03:38 -0800
commit5a5b76a22430ecc643fecf7bde825332524f8f3c (patch)
tree6a8476edc7c4218f0266a429c0111d3d678854f4 /gcc/config/mips
parent5de1e2cef4e8cd750d44a2ca52b550f212d7454e (diff)
downloadgcc-5a5b76a22430ecc643fecf7bde825332524f8f3c.zip
gcc-5a5b76a22430ecc643fecf7bde825332524f8f3c.tar.gz
gcc-5a5b76a22430ecc643fecf7bde825332524f8f3c.tar.bz2
(movsi): Add special handling for constants which are illegal addresses when pic.
(movsi): Add special handling for constants which are illegal addresses when pic. (tablejump_internal1, tablejump_internal2): Emit .cpadd when TARGET_ABICALLS. Adjust length to include .cpadd. From-SVN: r6850
Diffstat (limited to 'gcc/config/mips')
-rw-r--r--gcc/config/mips/mips.md40
1 files changed, 36 insertions, 4 deletions
diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md
index f313eb2..ed7db36 100644
--- a/gcc/config/mips/mips.md
+++ b/gcc/config/mips/mips.md
@@ -2769,6 +2769,20 @@ move\\t%0,%z4\\n\\
""
"
{
+ /* If operands[1] is a constant address illegal for pic, then we need to
+ handle it just like LEGITIMIZE_ADDRESS does. */
+ if (flag_pic && pic_address_needs_scratch (operands[1]))
+ {
+ rtx temp = force_reg (SImode, XEXP (XEXP (operands[1], 0), 0));
+ rtx temp2 = XEXP (XEXP (operands[1], 0), 1);
+
+ if (! SMALL_INT (temp2))
+ temp2 = force_reg (SImode, temp2);
+
+ emit_move_insn (operands[0], gen_rtx (PLUS, SImode, temp, temp2));
+ DONE;
+ }
+
if ((reload_in_progress | reload_completed) == 0
&& !register_operand (operands[0], SImode)
&& !register_operand (operands[1], SImode)
@@ -5350,20 +5364,38 @@ move\\t%0,%z4\\n\\
(match_operand:SI 0 "register_operand" "d"))
(use (label_ref (match_operand 1 "" "")))]
"!TARGET_LONG64"
- "%*j\\t%0"
+ "*
+{
+ /* .cpadd expands to add REG,REG,$gp when pic, and nothing when not pic. */
+ if (TARGET_ABICALLS)
+ output_asm_insn (\".cpadd\\t%0\", operands);
+ return \"%*j\\t%0\";
+}"
[(set_attr "type" "jump")
(set_attr "mode" "none")
- (set_attr "length" "1")])
+ (set (attr "length")
+ (if_then_else (eq_attr "abicalls" "yes")
+ (const_int 2)
+ (const_int 1)))])
(define_insn "tablejump_internal2"
[(set (pc)
(match_operand:DI 0 "register_operand" "d"))
(use (label_ref (match_operand 1 "" "")))]
"TARGET_LONG64"
- "%*j\\t%0"
+ "*
+{
+ /* .cpdadd expands to dadd REG,REG,$gp when pic, and nothing when not pic. */
+ if (TARGET_ABICALLS)
+ output_asm_insn (\".cpdadd\\t%0\", operands);
+ return \"%*j\\t%0\";
+}"
[(set_attr "type" "jump")
(set_attr "mode" "none")
- (set_attr "length" "1")])
+ (set (attr "length")
+ (if_then_else (eq_attr "abicalls" "yes")
+ (const_int 2)
+ (const_int 1)))])
;; Function return, only allow after optimization, so that we can
;; eliminate jumps to jumps if no stack space is used.