Commit 237b301e by Richard Sandiford Committed by Richard Sandiford

mips.md (P): New mode macro.

	* config/mips/mips.md (P): New mode macro.
	(*xgot_hi[sd]i, *xgot_lo[sd]i, *got_disp[sd]i, *got_page[sd]i)
	(*load_got[sd]i, *low[sd]i, *low[sd]i_mips16): Redefine using :P.
	Add mode attributes.

From-SVN: r86416
parent 017901f4
2004-08-23 Richard Sandiford <rsandifo@redhat.com> 2004-08-23 Richard Sandiford <rsandifo@redhat.com>
* config/mips/mips.md (P): New mode macro.
(*xgot_hi[sd]i, *xgot_lo[sd]i, *got_disp[sd]i, *got_page[sd]i)
(*load_got[sd]i, *low[sd]i, *low[sd]i_mips16): Redefine using :P.
Add mode attributes.
2004-08-23 Richard Sandiford <rsandifo@redhat.com>
* config/mips/mips.md (UNSPEC_[LS][WD][LR]): Delete in favor of... * config/mips/mips.md (UNSPEC_[LS][WD][LR]): Delete in favor of...
(UNSPEC_{LOAD,STORE}_{LEFT,RIGHT}): ...these new constants. Shuffle (UNSPEC_{LOAD,STORE}_{LEFT,RIGHT}): ...these new constants. Shuffle
later constants to cover the gap. later constants to cover the gap.
......
...@@ -289,6 +289,10 @@ ...@@ -289,6 +289,10 @@
;; from the same template. ;; from the same template.
(define_mode_macro GPR [SI (DI "TARGET_64BIT")]) (define_mode_macro GPR [SI (DI "TARGET_64BIT")])
;; This mode macro allows :P to be used for patterns that operate on
;; pointer-sized quantities. Exactly one of the two alternatives will match.
(define_mode_macro P [(SI "Pmode == SImode") (DI "Pmode == DImode")])
;; In GPR templates, a string like "<d>subu" will expand to "subu" in the ;; In GPR templates, a string like "<d>subu" will expand to "subu" in the
;; 32-bit version and "dsubu" in the 64-bit version. ;; 32-bit version and "dsubu" in the 64-bit version.
(define_mode_attr d [(SI "") (DI "d")]) (define_mode_attr d [(SI "") (DI "d")])
...@@ -3309,183 +3313,105 @@ beq\t%2,%.,1b\;\ ...@@ -3309,183 +3313,105 @@ beq\t%2,%.,1b\;\
;; Insns to fetch a global symbol from a big GOT. ;; Insns to fetch a global symbol from a big GOT.
(define_insn_and_split "*xgot_hisi" (define_insn_and_split "*xgot_hi<mode>"
[(set (match_operand:SI 0 "register_operand" "=d") [(set (match_operand:P 0 "register_operand" "=d")
(high:SI (match_operand:SI 1 "global_got_operand" "")))] (high:P (match_operand:P 1 "global_got_operand" "")))]
"TARGET_EXPLICIT_RELOCS && TARGET_XGOT"
"#"
"&& reload_completed"
[(set (match_dup 0) (high:SI (match_dup 2)))
(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 3)))]
{
operands[2] = mips_unspec_address (operands[1], SYMBOL_GOTOFF_GLOBAL);
operands[3] = pic_offset_table_rtx;
}
[(set_attr "got" "xgot_high")])
(define_insn_and_split "*xgot_losi"
[(set (match_operand:SI 0 "register_operand" "=d")
(lo_sum:SI (match_operand:SI 1 "register_operand" "d")
(match_operand:SI 2 "global_got_operand" "")))]
"TARGET_EXPLICIT_RELOCS && TARGET_XGOT"
"#"
"&& reload_completed"
[(set (match_dup 0)
(unspec:SI [(match_dup 1) (match_dup 3)] UNSPEC_LOAD_GOT))]
{ operands[3] = mips_unspec_address (operands[2], SYMBOL_GOTOFF_GLOBAL); }
[(set_attr "got" "load")])
(define_insn_and_split "*xgot_hidi"
[(set (match_operand:DI 0 "register_operand" "=d")
(high:DI (match_operand:DI 1 "global_got_operand" "")))]
"TARGET_EXPLICIT_RELOCS && TARGET_XGOT" "TARGET_EXPLICIT_RELOCS && TARGET_XGOT"
"#" "#"
"&& reload_completed" "&& reload_completed"
[(set (match_dup 0) (high:DI (match_dup 2))) [(set (match_dup 0) (high:P (match_dup 2)))
(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))] (set (match_dup 0) (plus:P (match_dup 0) (match_dup 3)))]
{ {
operands[2] = mips_unspec_address (operands[1], SYMBOL_GOTOFF_GLOBAL); operands[2] = mips_unspec_address (operands[1], SYMBOL_GOTOFF_GLOBAL);
operands[3] = pic_offset_table_rtx; operands[3] = pic_offset_table_rtx;
} }
[(set_attr "got" "xgot_high")]) [(set_attr "got" "xgot_high")
(set_attr "mode" "<MODE>")])
(define_insn_and_split "*xgot_lodi" (define_insn_and_split "*xgot_lo<mode>"
[(set (match_operand:DI 0 "register_operand" "=d") [(set (match_operand:P 0 "register_operand" "=d")
(lo_sum:DI (match_operand:DI 1 "register_operand" "d") (lo_sum:P (match_operand:P 1 "register_operand" "d")
(match_operand:DI 2 "global_got_operand" "")))] (match_operand:P 2 "global_got_operand" "")))]
"TARGET_EXPLICIT_RELOCS && TARGET_XGOT" "TARGET_EXPLICIT_RELOCS && TARGET_XGOT"
"#" "#"
"&& reload_completed" "&& reload_completed"
[(set (match_dup 0) [(set (match_dup 0)
(unspec:DI [(match_dup 1) (match_dup 3)] UNSPEC_LOAD_GOT))] (unspec:P [(match_dup 1) (match_dup 3)] UNSPEC_LOAD_GOT))]
{ operands[3] = mips_unspec_address (operands[2], SYMBOL_GOTOFF_GLOBAL); } { operands[3] = mips_unspec_address (operands[2], SYMBOL_GOTOFF_GLOBAL); }
[(set_attr "got" "load")]) [(set_attr "got" "load")
(set_attr "mode" "<MODE>")])
;; Insns to fetch a global symbol from a normal GOT. ;; Insns to fetch a global symbol from a normal GOT.
(define_insn_and_split "*got_dispsi" (define_insn_and_split "*got_disp<mode>"
[(set (match_operand:SI 0 "register_operand" "=d") [(set (match_operand:P 0 "register_operand" "=d")
(match_operand:SI 1 "global_got_operand" ""))] (match_operand:P 1 "global_got_operand" ""))]
"TARGET_EXPLICIT_RELOCS && !TARGET_XGOT"
"#"
"&& reload_completed"
[(set (match_dup 0)
(unspec:SI [(match_dup 2) (match_dup 3)] UNSPEC_LOAD_GOT))]
{
operands[2] = pic_offset_table_rtx;
operands[3] = mips_unspec_address (operands[1], SYMBOL_GOTOFF_GLOBAL);
}
[(set_attr "got" "load")])
(define_insn_and_split "*got_dispdi"
[(set (match_operand:DI 0 "register_operand" "=d")
(match_operand:DI 1 "global_got_operand" ""))]
"TARGET_EXPLICIT_RELOCS && !TARGET_XGOT" "TARGET_EXPLICIT_RELOCS && !TARGET_XGOT"
"#" "#"
"&& reload_completed" "&& reload_completed"
[(set (match_dup 0) [(set (match_dup 0)
(unspec:DI [(match_dup 2) (match_dup 3)] UNSPEC_LOAD_GOT))] (unspec:P [(match_dup 2) (match_dup 3)] UNSPEC_LOAD_GOT))]
{ {
operands[2] = pic_offset_table_rtx; operands[2] = pic_offset_table_rtx;
operands[3] = mips_unspec_address (operands[1], SYMBOL_GOTOFF_GLOBAL); operands[3] = mips_unspec_address (operands[1], SYMBOL_GOTOFF_GLOBAL);
} }
[(set_attr "got" "load")]) [(set_attr "got" "load")
(set_attr "mode" "<MODE>")])
;; Insns for loading the high part of a local symbol. ;; Insns for loading the high part of a local symbol.
(define_insn_and_split "*got_pagesi" (define_insn_and_split "*got_page<mode>"
[(set (match_operand:SI 0 "register_operand" "=d") [(set (match_operand:P 0 "register_operand" "=d")
(high:SI (match_operand:SI 1 "local_got_operand" "")))] (high:P (match_operand:P 1 "local_got_operand" "")))]
"TARGET_EXPLICIT_RELOCS" "TARGET_EXPLICIT_RELOCS"
"#" "#"
"&& reload_completed" "&& reload_completed"
[(set (match_dup 0) [(set (match_dup 0)
(unspec:SI [(match_dup 2) (match_dup 3)] UNSPEC_LOAD_GOT))] (unspec:P [(match_dup 2) (match_dup 3)] UNSPEC_LOAD_GOT))]
{ {
operands[2] = pic_offset_table_rtx; operands[2] = pic_offset_table_rtx;
operands[3] = mips_unspec_address (operands[1], SYMBOL_GOTOFF_PAGE); operands[3] = mips_unspec_address (operands[1], SYMBOL_GOTOFF_PAGE);
} }
[(set_attr "got" "load")]) [(set_attr "got" "load")
(set_attr "mode" "<MODE>")])
(define_insn_and_split "*got_pagedi"
[(set (match_operand:DI 0 "register_operand" "=d")
(high:DI (match_operand:DI 1 "local_got_operand" "")))]
"TARGET_EXPLICIT_RELOCS"
"#"
"&& reload_completed"
[(set (match_dup 0)
(unspec:DI [(match_dup 2) (match_dup 3)] UNSPEC_LOAD_GOT))]
{
operands[2] = pic_offset_table_rtx;
operands[3] = mips_unspec_address (operands[1], SYMBOL_GOTOFF_PAGE);
}
[(set_attr "got" "load")])
;; Lower-level instructions for loading an address from the GOT. ;; Lower-level instructions for loading an address from the GOT.
;; We could use MEMs, but an unspec gives more optimization ;; We could use MEMs, but an unspec gives more optimization
;; opportunities. ;; opportunities.
(define_insn "*load_gotsi" (define_insn "*load_got<mode>"
[(set (match_operand:SI 0 "register_operand" "=d") [(set (match_operand:P 0 "register_operand" "=d")
(unspec:SI [(match_operand:SI 1 "register_operand" "d") (unspec:P [(match_operand:P 1 "register_operand" "d")
(match_operand:SI 2 "immediate_operand" "")] (match_operand:P 2 "immediate_operand" "")]
UNSPEC_LOAD_GOT))] UNSPEC_LOAD_GOT))]
"TARGET_ABICALLS"
"lw\t%0,%R2(%1)"
[(set_attr "type" "load")
(set_attr "length" "4")])
(define_insn "*load_gotdi"
[(set (match_operand:DI 0 "register_operand" "=d")
(unspec:DI [(match_operand:DI 1 "register_operand" "d")
(match_operand:DI 2 "immediate_operand" "")]
UNSPEC_LOAD_GOT))]
"TARGET_ABICALLS" "TARGET_ABICALLS"
"ld\t%0,%R2(%1)" "<load>\t%0,%R2(%1)"
[(set_attr "type" "load") [(set_attr "type" "load")
(set_attr "mode" "<MODE>")
(set_attr "length" "4")]) (set_attr "length" "4")])
;; Instructions for adding the low 16 bits of an address to a register. ;; Instructions for adding the low 16 bits of an address to a register.
;; Operand 2 is the address: print_operand works out which relocation ;; Operand 2 is the address: print_operand works out which relocation
;; should be applied. ;; should be applied.
(define_insn "*lowsi" (define_insn "*low<mode>"
[(set (match_operand:SI 0 "register_operand" "=d") [(set (match_operand:P 0 "register_operand" "=d")
(lo_sum:SI (match_operand:SI 1 "register_operand" "d") (lo_sum:P (match_operand:P 1 "register_operand" "d")
(match_operand:SI 2 "immediate_operand" "")))] (match_operand:P 2 "immediate_operand" "")))]
"!TARGET_MIPS16" "!TARGET_MIPS16"
"addiu\t%0,%1,%R2" "<d>addiu\t%0,%1,%R2"
[(set_attr "type" "arith") [(set_attr "type" "arith")
(set_attr "mode" "SI")]) (set_attr "mode" "<MODE>")])
(define_insn "*lowdi"
[(set (match_operand:DI 0 "register_operand" "=d")
(lo_sum:DI (match_operand:DI 1 "register_operand" "d")
(match_operand:DI 2 "immediate_operand" "")))]
"!TARGET_MIPS16 && TARGET_64BIT"
"daddiu\t%0,%1,%R2"
[(set_attr "type" "arith")
(set_attr "mode" "DI")])
(define_insn "*lowsi_mips16" (define_insn "*low<mode>_mips16"
[(set (match_operand:SI 0 "register_operand" "=d") [(set (match_operand:P 0 "register_operand" "=d")
(lo_sum:SI (match_operand:SI 1 "register_operand" "0") (lo_sum:P (match_operand:P 1 "register_operand" "0")
(match_operand:SI 2 "immediate_operand" "")))] (match_operand:P 2 "immediate_operand" "")))]
"TARGET_MIPS16" "TARGET_MIPS16"
"addiu\t%0,%R2" "<d>addiu\t%0,%R2"
[(set_attr "type" "arith") [(set_attr "type" "arith")
(set_attr "mode" "SI") (set_attr "mode" "<MODE>")
(set_attr "length" "8")]) (set_attr "length" "8")])
(define_insn "*lowdi_mips16"
[(set (match_operand:DI 0 "register_operand" "=d")
(lo_sum:DI (match_operand:DI 1 "register_operand" "0")
(match_operand:DI 2 "immediate_operand" "")))]
"TARGET_MIPS16 && TARGET_64BIT"
"daddiu\t%0,%R2"
[(set_attr "type" "arith")
(set_attr "mode" "DI")
(set_attr "length" "8")])
;; 64-bit integer moves ;; 64-bit integer moves
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment