1 ;; PowerPC paired single and double hummer description
3 ;; Free Software Foundation, Inc.
4 ;; Contributed by David Edelsohn <edelsohn@gnu.org> and Revital Eres
7 ;; This file is part of GCC.
9 ;; GCC is free software; you can redistribute it and/or modify it
10 ;; under the terms of the GNU General Public License as published
11 ;; by the Free Software Foundation; either version 2, or (at your
12 ;; option) any later version.
14 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
15 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 ;; License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GCC; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
22 ;; MA 02110-1301, USA.
25 (define_insn "negv2sf2"
26 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
27 (neg:V2SF (match_operand:V2SF 1 "gpc_reg_operand" "f")))]
30 [(set_attr "type" "fp")])
32 (define_insn "sqrtv2sf2"
33 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
34 (sqrt:V2SF (match_operand:V2SF 1 "gpc_reg_operand" "f")))]
37 [(set_attr "type" "fp")])
39 (define_insn "absv2sf2"
40 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
41 (abs:V2SF (match_operand:V2SF 1 "gpc_reg_operand" "f")))]
44 [(set_attr "type" "fp")])
46 (define_insn "nabsv2sf2"
47 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
48 (neg:V2SF (abs:V2SF (match_operand:V2SF 1 "gpc_reg_operand" "f"))))]
51 [(set_attr "type" "fp")])
53 (define_insn "addv2sf3"
54 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
55 (plus:V2SF (match_operand:V2SF 1 "gpc_reg_operand" "%f")
56 (match_operand:V2SF 2 "gpc_reg_operand" "f")))]
59 [(set_attr "type" "fp")])
61 (define_insn "subv2sf3"
62 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
63 (minus:V2SF (match_operand:V2SF 1 "gpc_reg_operand" "f")
64 (match_operand:V2SF 2 "gpc_reg_operand" "f")))]
67 [(set_attr "type" "fp")])
69 (define_insn "mulv2sf3"
70 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
71 (mult:V2SF (match_operand:V2SF 1 "gpc_reg_operand" "%f")
72 (match_operand:V2SF 2 "gpc_reg_operand" "f")))]
75 [(set_attr "type" "fp")])
77 (define_insn "resv2sf2"
78 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
79 (unspec:V2SF [(match_operand:V2SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
80 "TARGET_PAIRED_FLOAT && flag_finite_math_only"
82 [(set_attr "type" "fp")])
84 (define_insn "divv2sf3"
85 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
86 (div:V2SF (match_operand:V2SF 1 "gpc_reg_operand" "f")
87 (match_operand:V2SF 2 "gpc_reg_operand" "f")))]
90 [(set_attr "type" "sdiv")])
92 (define_insn "paired_madds0"
93 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
95 (plus:SF (mult:SF (vec_select:SF (match_operand:V2SF 1 "gpc_reg_operand" "f")
96 (parallel [(const_int 0)]))
97 (vec_select:SF (match_operand:V2SF 2 "gpc_reg_operand" "f")
98 (parallel [(const_int 0)])))
99 (vec_select:SF (match_operand:V2SF 3 "gpc_reg_operand" "f")
100 (parallel [(const_int 0)])))
101 (plus:SF (mult:SF (vec_select:SF (match_dup 1)
102 (parallel [(const_int 1)]))
103 (vec_select:SF (match_dup 2)
104 (parallel [(const_int 0)])))
105 (vec_select:SF (match_dup 3)
106 (parallel [(const_int 1)])))))]
107 "TARGET_PAIRED_FLOAT && TARGET_FUSED_MADD"
108 "ps_madds0 %0,%1,%2,%3"
109 [(set_attr "type" "fp")])
111 (define_insn "paired_madds1"
112 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
114 (plus:SF (mult:SF (vec_select:SF (match_operand:V2SF 1 "gpc_reg_operand" "f")
115 (parallel [(const_int 0)]))
116 (vec_select:SF (match_operand:V2SF 2 "gpc_reg_operand" "f")
117 (parallel [(const_int 1)])))
118 (vec_select:SF (match_operand:V2SF 3 "gpc_reg_operand" "f")
119 (parallel [(const_int 0)])))
120 (plus:SF (mult:SF (vec_select:SF (match_dup 1)
121 (parallel [(const_int 1)]))
122 (vec_select:SF (match_dup 2)
123 (parallel [(const_int 1)])))
124 (vec_select:SF (match_dup 3)
125 (parallel [(const_int 1)])))))]
126 "TARGET_PAIRED_FLOAT && TARGET_FUSED_MADD"
127 "ps_madds1 %0,%1,%2,%3"
128 [(set_attr "type" "fp")])
130 (define_insn "paired_madd"
131 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
132 (plus:V2SF (mult:V2SF (match_operand:V2SF 1 "gpc_reg_operand" "%f")
133 (match_operand:V2SF 2 "gpc_reg_operand" "f"))
134 (match_operand:V2SF 3 "gpc_reg_operand" "f")))]
135 "TARGET_PAIRED_FLOAT && TARGET_FUSED_MADD"
136 "ps_madd %0,%1,%2,%3"
137 [(set_attr "type" "fp")])
139 (define_insn "paired_msub"
140 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
141 (minus:V2SF (mult:V2SF (match_operand:V2SF 1 "gpc_reg_operand" "%f")
142 (match_operand:V2SF 2 "gpc_reg_operand" "f"))
143 (match_operand:V2SF 3 "gpc_reg_operand" "f")))]
144 "TARGET_PAIRED_FLOAT && TARGET_FUSED_MADD"
145 "ps_msub %0,%1,%2,%3"
146 [(set_attr "type" "fp")])
148 (define_insn "paired_nmadd"
149 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
150 (neg:V2SF (plus:V2SF (mult:V2SF (match_operand:V2SF 1 "gpc_reg_operand" "%f")
151 (match_operand:V2SF 2 "gpc_reg_operand" "f"))
152 (match_operand:V2SF 3 "gpc_reg_operand" "f"))))]
153 "TARGET_PAIRED_FLOAT && TARGET_FUSED_MADD
154 && HONOR_SIGNED_ZEROS (SFmode)"
155 "ps_nmadd %0,%1,%2,%3"
156 [(set_attr "type" "fp")])
158 (define_insn "paired_nmsub"
159 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
160 (neg:V2SF (minus:V2SF (mult:V2SF (match_operand:V2SF 1 "gpc_reg_operand" "%f")
161 (match_operand:V2SF 2 "gpc_reg_operand" "f"))
162 (match_operand:V2SF 3 "gpc_reg_operand" "f"))))]
163 "TARGET_PAIRED_FLOAT && TARGET_FUSED_MADD
164 && HONOR_SIGNED_ZEROS (DFmode)"
165 "ps_nmsub %0,%1,%2,%3"
166 [(set_attr "type" "dmul")])
168 (define_insn "selv2sf4"
169 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
171 (if_then_else:SF (ge (vec_select:SF (match_operand:V2SF 1 "gpc_reg_operand" "f")
172 (parallel [(const_int 0)]))
173 (match_operand:SF 4 "zero_fp_constant" "F"))
174 (vec_select:SF (match_operand:V2SF 2 "gpc_reg_operand" "f")
175 (parallel [(const_int 0)]))
176 (vec_select:SF (match_operand:V2SF 3 "gpc_reg_operand" "f")
177 (parallel [(const_int 0)])))
178 (if_then_else:SF (ge (vec_select:SF (match_dup 1)
179 (parallel [(const_int 1)]))
181 (vec_select:SF (match_dup 2)
182 (parallel [(const_int 1)]))
183 (vec_select:SF (match_dup 3)
184 (parallel [(const_int 1)])))))]
186 "TARGET_PAIRED_FLOAT"
188 [(set_attr "type" "fp")])
190 (define_insn "*movv2sf_paired"
191 [(set (match_operand:V2SF 0 "nonimmediate_operand" "=Z,f,f,o,r,r,v")
192 (match_operand:V2SF 1 "input_operand" "f,Z,f,r,o,r,W"))]
194 && (register_operand (operands[0], V2SFmode)
195 || register_operand (operands[1], V2SFmode))"
197 switch (which_alternative)
199 case 0: return "psq_stx %1,%y0,0,0";
200 case 1: return "psq_lx %0,%y1,0,0";
201 case 2: return "ps_mr %0,%1";
205 case 6: return output_vec_const_move (operands);
206 default: gcc_unreachable ();
209 [(set_attr "type" "fpstore,fpload,fp,*,*,*,*")])
211 (define_insn "paired_stx"
212 [(set (match_operand:V2SF 0 "memory_operand" "=Z")
213 (match_operand:V2SF 1 "gpc_reg_operand" "f"))]
214 "TARGET_PAIRED_FLOAT"
216 [(set_attr "type" "fpstore")])
218 (define_insn "paired_lx"
219 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
220 (match_operand:V2SF 1 "memory_operand" "Z"))]
221 "TARGET_PAIRED_FLOAT"
223 [(set_attr "type" "fpload")])
227 [(set (match_operand:V2SF 0 "nonimmediate_operand" "")
228 (match_operand:V2SF 1 "input_operand" ""))]
229 "TARGET_PAIRED_FLOAT && reload_completed
230 && gpr_or_gpr_p (operands[0], operands[1])"
233 rs6000_split_multireg_move (operands[0], operands[1]); DONE;
236 (define_insn "paired_cmpu0"
237 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
238 (compare:CCFP (vec_select:SF
239 (match_operand:V2SF 1 "gpc_reg_operand" "f")
240 (parallel [(const_int 0)]))
242 (match_operand:V2SF 2 "gpc_reg_operand" "f")
243 (parallel [(const_int 0)]))))]
244 "TARGET_PAIRED_FLOAT"
246 [(set_attr "type" "fpcompare")])
248 (define_insn "paired_cmpu1"
249 [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
250 (compare:CCFP (vec_select:SF
251 (match_operand:V2SF 1 "gpc_reg_operand" "f")
252 (parallel [(const_int 1)]))
254 (match_operand:V2SF 2 "gpc_reg_operand" "f")
255 (parallel [(const_int 1)]))))]
256 "TARGET_PAIRED_FLOAT"
258 [(set_attr "type" "fpcompare")])
260 (define_insn "paired_merge00"
261 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
263 (vec_select:SF (match_operand:V2SF 1 "gpc_reg_operand" "f")
264 (parallel [(const_int 0)]))
265 (vec_select:SF (match_operand:V2SF 2 "gpc_reg_operand" "f")
266 (parallel [(const_int 0)]))))]
267 "TARGET_PAIRED_FLOAT"
268 "ps_merge00 %0, %1, %2"
269 [(set_attr "type" "fp")])
271 (define_insn "paired_merge01"
272 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
274 (vec_select:SF (match_operand:V2SF 1 "gpc_reg_operand" "f")
275 (parallel [(const_int 0)]))
276 (vec_select:SF (match_operand:V2SF 2 "gpc_reg_operand" "f")
277 (parallel [(const_int 1)]))))]
278 "TARGET_PAIRED_FLOAT"
279 "ps_merge01 %0, %1, %2"
280 [(set_attr "type" "fp")])
282 (define_insn "paired_merge10"
283 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
285 (vec_select:SF (match_operand:V2SF 1 "gpc_reg_operand" "f")
286 (parallel [(const_int 1)]))
287 (vec_select:SF (match_operand:V2SF 2 "gpc_reg_operand" "f")
288 (parallel [(const_int 0)]))))]
289 "TARGET_PAIRED_FLOAT"
290 "ps_merge10 %0, %1, %2"
291 [(set_attr "type" "fp")])
293 (define_insn "paired_merge11"
294 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
296 (vec_select:SF (match_operand:V2SF 1 "gpc_reg_operand" "f")
297 (parallel [(const_int 1)]))
298 (vec_select:SF (match_operand:V2SF 2 "gpc_reg_operand" "f")
299 (parallel [(const_int 1)]))))]
300 "TARGET_PAIRED_FLOAT"
301 "ps_merge11 %0, %1, %2"
302 [(set_attr "type" "fp")])
304 (define_insn "paired_sum0"
305 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
306 (vec_concat:V2SF (plus:SF (vec_select:SF
307 (match_operand:V2SF 1 "gpc_reg_operand" "f")
308 (parallel [(const_int 0)]))
310 (match_operand:V2SF 2 "gpc_reg_operand" "f")
311 (parallel [(const_int 1)])))
313 (match_operand:V2SF 3 "gpc_reg_operand" "f")
314 (parallel [(const_int 1)]))))]
315 "TARGET_PAIRED_FLOAT"
316 "ps_sum0 %0,%1,%2,%3"
317 [(set_attr "type" "fp")])
319 (define_insn "paired_sum1"
320 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
321 (vec_concat:V2SF (vec_select:SF
322 (match_operand:V2SF 2 "gpc_reg_operand" "f")
323 (parallel [(const_int 1)]))
324 (plus:SF (vec_select:SF
325 (match_operand:V2SF 1 "gpc_reg_operand" "f")
326 (parallel [(const_int 0)]))
328 (match_operand:V2SF 3 "gpc_reg_operand" "f")
329 (parallel [(const_int 1)])))))]
330 "TARGET_PAIRED_FLOAT"
331 "ps_sum1 %0,%1,%2,%3"
332 [(set_attr "type" "fp")])
334 (define_insn "paired_muls0"
335 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
336 (mult:V2SF (match_operand:V2SF 2 "gpc_reg_operand" "f")
338 (vec_select:SF (match_operand:V2SF 1 "gpc_reg_operand" "f")
339 (parallel [(const_int 0)])))))]
340 "TARGET_PAIRED_FLOAT"
341 "ps_muls0 %0, %1, %2"
342 [(set_attr "type" "fp")])
345 (define_insn "paired_muls1"
346 [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
347 (mult:V2SF (match_operand:V2SF 2 "gpc_reg_operand" "f")
349 (vec_select:SF (match_operand:V2SF 1 "gpc_reg_operand" "f")
350 (parallel [(const_int 1)])))))]
351 "TARGET_PAIRED_FLOAT"
352 "ps_muls1 %0, %1, %2"
353 [(set_attr "type" "fp")])