aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSegher Boessenkool <segher@kernel.crashing.org>2018-09-26 01:42:28 +0200
committerSegher Boessenkool <segher@gcc.gnu.org>2018-09-26 01:42:28 +0200
commit0bbadf8bc35fb4d4d4206d1d8164695cec45c1c2 (patch)
tree0bbdf4830c58d3222a0e29e41d744f8c15bd5630 /gcc
parent07a38de7ceed3080f6f95912624d7e01ae352b6d (diff)
downloadgcc-0bbadf8bc35fb4d4d4206d1d8164695cec45c1c2.zip
gcc-0bbadf8bc35fb4d4d4206d1d8164695cec45c1c2.tar.gz
gcc-0bbadf8bc35fb4d4d4206d1d8164695cec45c1c2.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/config/rs6000/rs6000.md184
2 files changed, 89 insertions, 105 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 54d9ecf..1b25c3e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,15 @@
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
control string as a list of templates instead of as C code.
(*altivec_movti): Ditto.
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 4ce24d5..bcabf4d 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -7050,25 +7050,21 @@
mt%0 %1
lwz%U1%X1 %0,%1
stw%U0%X0 %1,%0"
- [(set (attr "type")
- (cond [(eq_attr "alternative" "0,3")
- (const_string "cr_logical")
- (eq_attr "alternative" "1,2")
- (const_string "mtcr")
- (eq_attr "alternative" "6,7")
- (const_string "integer")
- (eq_attr "alternative" "8")
- (const_string "mfjmpr")
- (eq_attr "alternative" "9")
- (const_string "mtjmpr")
- (eq_attr "alternative" "10")
- (const_string "load")
- (eq_attr "alternative" "11")
- (const_string "store")
- (match_test "TARGET_MFCRF")
- (const_string "mfcrf")
- ]
- (const_string "mfcr")))
+ [(set_attr_alternative "type"
+ [(const_string "cr_logical")
+ (const_string "mtcr")
+ (const_string "mtcr")
+ (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 "mfjmpr")
+ (const_string "mtjmpr")
+ (const_string "load")
+ (const_string "store")])
(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
@@ -10431,22 +10427,17 @@
return "crset 2\;beq%T0l-";
}
[(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
- (set (attr "length")
- (cond [(and (eq (symbol_ref "which_alternative") (const_int 0))
- (eq (symbol_ref "rs6000_speculate_indirect_jumps")
- (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")
- (and (eq (symbol_ref "which_alternative") (const_int 2))
- (eq (symbol_ref "rs6000_speculate_indirect_jumps")
- (const_int 0)))
- (const_string "12")
- (eq (symbol_ref "which_alternative") (const_int 3))
- (const_string "8")]
- (const_string "4")))])
+ (set_attr_alternative "length"
+ [(if_then_else (eq (symbol_ref "rs6000_speculate_indirect_jumps")
+ (const_int 0))
+ (const_string "8")
+ (const_string "4"))
+ (const_string "4")
+ (if_then_else (eq (symbol_ref "rs6000_speculate_indirect_jumps")
+ (const_int 0))
+ (const_string "12")
+ (const_string "8"))
+ (const_string "8")])])
(define_insn_and_split "*call_nonlocal_sysv<mode>"
[(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
@@ -10538,22 +10529,17 @@
return "crset 2\;beq%T1l-";
}
[(set_attr "type" "jmpreg,jmpreg,jmpreg,jmpreg")
- (set (attr "length")
- (cond [(and (eq (symbol_ref "which_alternative") (const_int 0))
- (eq (symbol_ref "rs6000_speculate_indirect_jumps")
- (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")
- (and (eq (symbol_ref "which_alternative") (const_int 2))
- (eq (symbol_ref "rs6000_speculate_indirect_jumps")
- (const_int 0)))
- (const_string "12")
- (eq (symbol_ref "which_alternative") (const_int 3))
- (const_string "8")]
- (const_string "4")))])
+ (set_attr_alternative "length"
+ [(if_then_else (eq (symbol_ref "rs6000_speculate_indirect_jumps")
+ (const_int 0))
+ (const_string "8")
+ (const_string "4"))
+ (const_string "4")
+ (if_then_else (eq (symbol_ref "rs6000_speculate_indirect_jumps")
+ (const_int 0))
+ (const_string "12")
+ (const_string "8"))
+ (const_string "8")])])
(define_insn_and_split "*call_value_nonlocal_sysv<mode>"
[(set (match_operand 0 "" "")
@@ -10947,22 +10933,17 @@
return "b %z0";
}
[(set_attr "type" "branch")
- (set (attr "length")
- (cond [(eq (symbol_ref "which_alternative") (const_int 1))
- (const_string "8")
- (and (eq (symbol_ref "which_alternative") (const_int 2))
- (eq (symbol_ref "rs6000_speculate_indirect_jumps")
- (const_int 0)))
- (const_string "12")
- (and (eq (symbol_ref "which_alternative") (const_int 3))
- (ne (symbol_ref "rs6000_speculate_indirect_jumps")
- (const_int 0)))
- (const_string "8")
- (and (eq (symbol_ref "which_alternative") (const_int 3))
- (eq (symbol_ref "rs6000_speculate_indirect_jumps")
- (const_int 0)))
- (const_string "16")]
- (const_string "4")))])
+ (set_attr_alternative "length"
+ [(const_string "4")
+ (const_string "8")
+ (if_then_else (eq (symbol_ref "rs6000_speculate_indirect_jumps")
+ (const_int 0))
+ (const_string "12")
+ (const_string "4"))
+ (if_then_else (eq (symbol_ref "rs6000_speculate_indirect_jumps")
+ (const_int 0))
+ (const_string "16")
+ (const_string "8"))])])
(define_insn "*sibcall_value_nonlocal_sysv<mode>"
[(set (match_operand 0 "" "")
@@ -10997,22 +10978,17 @@
return "b %z1";
}
[(set_attr "type" "branch")
- (set (attr "length")
- (cond [(eq (symbol_ref "which_alternative") (const_int 1))
- (const_string "8")
- (and (eq (symbol_ref "which_alternative") (const_int 2))
- (eq (symbol_ref "rs6000_speculate_indirect_jumps")
- (const_int 0)))
- (const_string "12")
- (and (eq (symbol_ref "which_alternative") (const_int 3))
- (ne (symbol_ref "rs6000_speculate_indirect_jumps")
- (const_int 0)))
- (const_string "8")
- (and (eq (symbol_ref "which_alternative") (const_int 3))
- (eq (symbol_ref "rs6000_speculate_indirect_jumps")
- (const_int 0)))
- (const_string "16")]
- (const_string "4")))])
+ (set_attr_alternative "length"
+ [(const_string "4")
+ (const_string "8")
+ (if_then_else (eq (symbol_ref "rs6000_speculate_indirect_jumps")
+ (const_int 0))
+ (const_string "12")
+ (const_string "4"))
+ (if_then_else (eq (symbol_ref "rs6000_speculate_indirect_jumps")
+ (const_int 0))
+ (const_string "16")
+ (const_string "8"))])])
;; AIX ABI sibling call patterns.
@@ -12645,17 +12621,16 @@
return "<bd_neg> $+8\;b %l0";
}
[(set_attr "type" "branch")
- (set (attr "length")
- (cond [(eq (symbol_ref "which_alternative") (const_int 0))
- (if_then_else (and (ge (minus (match_dup 0) (pc))
- (const_int -32768))
- (lt (minus (match_dup 0) (pc))
- (const_int 32764)))
- (const_int 4)
- (const_int 8))
- (eq (symbol_ref "which_alternative") (const_int 1))
- (const_int 16)]
- (const_int 20)))])
+ (set_attr_alternative "length"
+ [(if_then_else (and (ge (minus (match_dup 0) (pc))
+ (const_int -32768))
+ (lt (minus (match_dup 0) (pc))
+ (const_int 32764)))
+ (const_int 4)
+ (const_int 8))
+ (const_string "16")
+ (const_string "20")
+ (const_string "20")])])
;; Now the splitter if we could not allocate the CTR register
(define_split
@@ -12734,17 +12709,16 @@
}
}
[(set_attr "type" "branch")
- (set (attr "length")
- (cond [(eq (symbol_ref "which_alternative") (const_int 0))
- (if_then_else (and (ge (minus (match_dup 0) (pc))
- (const_int -32768))
- (lt (minus (match_dup 0) (pc))
- (const_int 32764)))
- (const_int 4)
- (const_int 8))
- (eq (symbol_ref "which_alternative") (const_int 1))
- (const_int 16)]
- (const_int 20)))])
+ (set_attr_alternative "length"
+ [(if_then_else (and (ge (minus (match_dup 0) (pc))
+ (const_int -32768))
+ (lt (minus (match_dup 0) (pc))
+ (const_int 32764)))
+ (const_int 4)
+ (const_int 8))
+ (const_string "16")
+ (const_string "20")
+ (const_string "20")])])
;; Now the splitter if we could not allocate the CTR register
(define_split