Commit 0bbadf8b by Segher Boessenkool Committed by Segher Boessenkool

rs6000: Use set_attr_alternative in some places

Some code is much neater if it uses set_attr_alternative than if it
does everything by hand.  Change some patterns to use this shorthand.


	* config/rs6000/rs6000.md (*movcc_internal1): Use set_attr_alternative.
	(*call_indirect_nonlocal_sysv<mode>): Ditto.
	(*call_value_indirect_nonlocal_sysv<mode>): Ditto.
	(*sibcall_nonlocal_sysv<mode>): Ditto.
	(*sibcall_value_nonlocal_sysv<mode>): Ditto.
	(<bd>_<mode>): Ditto.
	(<bd>tf_<mode>): Ditto.

From-SVN: r264588
parent 07a38de7
2018-09-25 Segher Boessenkool <segher@kernel.crashing.org> 2018-09-25 Segher Boessenkool <segher@kernel.crashing.org>
* config/rs6000/rs6000.md (*movcc_internal1): Use set_attr_alternative.
(*call_indirect_nonlocal_sysv<mode>): Ditto.
(*call_value_indirect_nonlocal_sysv<mode>): Ditto.
(*sibcall_nonlocal_sysv<mode>): Ditto.
(*sibcall_value_nonlocal_sysv<mode>): Ditto.
(<bd>_<mode>): Ditto.
(<bd>tf_<mode>): Ditto.
2018-09-25 Segher Boessenkool <segher@kernel.crashing.org>
* config/rs6000/altivec.md (*altivec_mov<mode>): Write the output * config/rs6000/altivec.md (*altivec_mov<mode>): Write the output
control string as a list of templates instead of as C code. control string as a list of templates instead of as C code.
(*altivec_movti): Ditto. (*altivec_movti): Ditto.
......
...@@ -7050,25 +7050,21 @@ ...@@ -7050,25 +7050,21 @@
mt%0 %1 mt%0 %1
lwz%U1%X1 %0,%1 lwz%U1%X1 %0,%1
stw%U0%X0 %1,%0" stw%U0%X0 %1,%0"
[(set (attr "type") [(set_attr_alternative "type"
(cond [(eq_attr "alternative" "0,3") [(const_string "cr_logical")
(const_string "cr_logical") (const_string "mtcr")
(eq_attr "alternative" "1,2")
(const_string "mtcr") (const_string "mtcr")
(eq_attr "alternative" "6,7") (const_string "cr_logical")
(if_then_else (match_test "TARGET_MFCRF")
(const_string "mfcrf") (const_string "mfcr"))
(if_then_else (match_test "TARGET_MFCRF")
(const_string "mfcrf") (const_string "mfcr"))
(const_string "integer")
(const_string "integer") (const_string "integer")
(eq_attr "alternative" "8")
(const_string "mfjmpr") (const_string "mfjmpr")
(eq_attr "alternative" "9")
(const_string "mtjmpr") (const_string "mtjmpr")
(eq_attr "alternative" "10")
(const_string "load") (const_string "load")
(eq_attr "alternative" "11") (const_string "store")])
(const_string "store")
(match_test "TARGET_MFCRF")
(const_string "mfcrf")
]
(const_string "mfcr")))
(set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4")]) (set_attr "length" "4,4,12,4,4,8,4,4,4,4,4,4")])
;; For floating-point, we normally deal with the floating-point registers ;; For floating-point, we normally deal with the floating-point registers
...@@ -10431,22 +10427,17 @@ ...@@ -10431,22 +10427,17 @@
return "crset 2\;beq%T0l-"; return "crset 2\;beq%T0l-";
} }
[(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg") [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
(set (attr "length") (set_attr_alternative "length"
(cond [(and (eq (symbol_ref "which_alternative") (const_int 0)) [(if_then_else (eq (symbol_ref "rs6000_speculate_indirect_jumps")
(eq (symbol_ref "rs6000_speculate_indirect_jumps") (const_int 0))
(const_int 0)))
(const_string "8")
(and (eq (symbol_ref "which_alternative") (const_int 2))
(ne (symbol_ref "rs6000_speculate_indirect_jumps")
(const_int 0)))
(const_string "8") (const_string "8")
(and (eq (symbol_ref "which_alternative") (const_int 2)) (const_string "4"))
(eq (symbol_ref "rs6000_speculate_indirect_jumps") (const_string "4")
(const_int 0))) (if_then_else (eq (symbol_ref "rs6000_speculate_indirect_jumps")
(const_int 0))
(const_string "12") (const_string "12")
(eq (symbol_ref "which_alternative") (const_int 3)) (const_string "8"))
(const_string "8")] (const_string "8")])])
(const_string "4")))])
(define_insn_and_split "*call_nonlocal_sysv<mode>" (define_insn_and_split "*call_nonlocal_sysv<mode>"
[(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s")) [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
...@@ -10538,22 +10529,17 @@ ...@@ -10538,22 +10529,17 @@
return "crset 2\;beq%T1l-"; return "crset 2\;beq%T1l-";
} }
[(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg") [(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
(set (attr "length") (set_attr_alternative "length"
(cond [(and (eq (symbol_ref "which_alternative") (const_int 0)) [(if_then_else (eq (symbol_ref "rs6000_speculate_indirect_jumps")
(eq (symbol_ref "rs6000_speculate_indirect_jumps") (const_int 0))
(const_int 0)))
(const_string "8")
(and (eq (symbol_ref "which_alternative") (const_int 2))
(ne (symbol_ref "rs6000_speculate_indirect_jumps")
(const_int 0)))
(const_string "8") (const_string "8")
(and (eq (symbol_ref "which_alternative") (const_int 2)) (const_string "4"))
(eq (symbol_ref "rs6000_speculate_indirect_jumps") (const_string "4")
(const_int 0))) (if_then_else (eq (symbol_ref "rs6000_speculate_indirect_jumps")
(const_int 0))
(const_string "12") (const_string "12")
(eq (symbol_ref "which_alternative") (const_int 3)) (const_string "8"))
(const_string "8")] (const_string "8")])])
(const_string "4")))])
(define_insn_and_split "*call_value_nonlocal_sysv<mode>" (define_insn_and_split "*call_value_nonlocal_sysv<mode>"
[(set (match_operand 0 "" "") [(set (match_operand 0 "" "")
...@@ -10947,22 +10933,17 @@ ...@@ -10947,22 +10933,17 @@
return "b %z0"; return "b %z0";
} }
[(set_attr "type" "branch") [(set_attr "type" "branch")
(set (attr "length") (set_attr_alternative "length"
(cond [(eq (symbol_ref "which_alternative") (const_int 1)) [(const_string "4")
(const_string "8") (const_string "8")
(and (eq (symbol_ref "which_alternative") (const_int 2)) (if_then_else (eq (symbol_ref "rs6000_speculate_indirect_jumps")
(eq (symbol_ref "rs6000_speculate_indirect_jumps") (const_int 0))
(const_int 0)))
(const_string "12") (const_string "12")
(and (eq (symbol_ref "which_alternative") (const_int 3)) (const_string "4"))
(ne (symbol_ref "rs6000_speculate_indirect_jumps") (if_then_else (eq (symbol_ref "rs6000_speculate_indirect_jumps")
(const_int 0))) (const_int 0))
(const_string "8") (const_string "16")
(and (eq (symbol_ref "which_alternative") (const_int 3)) (const_string "8"))])])
(eq (symbol_ref "rs6000_speculate_indirect_jumps")
(const_int 0)))
(const_string "16")]
(const_string "4")))])
(define_insn "*sibcall_value_nonlocal_sysv<mode>" (define_insn "*sibcall_value_nonlocal_sysv<mode>"
[(set (match_operand 0 "" "") [(set (match_operand 0 "" "")
...@@ -10997,22 +10978,17 @@ ...@@ -10997,22 +10978,17 @@
return "b %z1"; return "b %z1";
} }
[(set_attr "type" "branch") [(set_attr "type" "branch")
(set (attr "length") (set_attr_alternative "length"
(cond [(eq (symbol_ref "which_alternative") (const_int 1)) [(const_string "4")
(const_string "8") (const_string "8")
(and (eq (symbol_ref "which_alternative") (const_int 2)) (if_then_else (eq (symbol_ref "rs6000_speculate_indirect_jumps")
(eq (symbol_ref "rs6000_speculate_indirect_jumps") (const_int 0))
(const_int 0)))
(const_string "12") (const_string "12")
(and (eq (symbol_ref "which_alternative") (const_int 3)) (const_string "4"))
(ne (symbol_ref "rs6000_speculate_indirect_jumps") (if_then_else (eq (symbol_ref "rs6000_speculate_indirect_jumps")
(const_int 0))) (const_int 0))
(const_string "8") (const_string "16")
(and (eq (symbol_ref "which_alternative") (const_int 3)) (const_string "8"))])])
(eq (symbol_ref "rs6000_speculate_indirect_jumps")
(const_int 0)))
(const_string "16")]
(const_string "4")))])
;; AIX ABI sibling call patterns. ;; AIX ABI sibling call patterns.
...@@ -12645,17 +12621,16 @@ ...@@ -12645,17 +12621,16 @@
return "<bd_neg> $+8\;b %l0"; return "<bd_neg> $+8\;b %l0";
} }
[(set_attr "type" "branch") [(set_attr "type" "branch")
(set (attr "length") (set_attr_alternative "length"
(cond [(eq (symbol_ref "which_alternative") (const_int 0)) [(if_then_else (and (ge (minus (match_dup 0) (pc))
(if_then_else (and (ge (minus (match_dup 0) (pc))
(const_int -32768)) (const_int -32768))
(lt (minus (match_dup 0) (pc)) (lt (minus (match_dup 0) (pc))
(const_int 32764))) (const_int 32764)))
(const_int 4) (const_int 4)
(const_int 8)) (const_int 8))
(eq (symbol_ref "which_alternative") (const_int 1)) (const_string "16")
(const_int 16)] (const_string "20")
(const_int 20)))]) (const_string "20")])])
;; Now the splitter if we could not allocate the CTR register ;; Now the splitter if we could not allocate the CTR register
(define_split (define_split
...@@ -12734,17 +12709,16 @@ ...@@ -12734,17 +12709,16 @@
} }
} }
[(set_attr "type" "branch") [(set_attr "type" "branch")
(set (attr "length") (set_attr_alternative "length"
(cond [(eq (symbol_ref "which_alternative") (const_int 0)) [(if_then_else (and (ge (minus (match_dup 0) (pc))
(if_then_else (and (ge (minus (match_dup 0) (pc))
(const_int -32768)) (const_int -32768))
(lt (minus (match_dup 0) (pc)) (lt (minus (match_dup 0) (pc))
(const_int 32764))) (const_int 32764)))
(const_int 4) (const_int 4)
(const_int 8)) (const_int 8))
(eq (symbol_ref "which_alternative") (const_int 1)) (const_string "16")
(const_int 16)] (const_string "20")
(const_int 20)))]) (const_string "20")])])
;; Now the splitter if we could not allocate the CTR register ;; Now the splitter if we could not allocate the CTR register
(define_split (define_split
......
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