]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/c6x/c6x-mult.md
Update copyright years.
[thirdparty/gcc.git] / gcc / config / c6x / c6x-mult.md
1 ;; -*- buffer-read-only: t -*-
2 ;; Generated automatically from c6x-mult.md.in by genmult.sh
3 ;; Multiplication patterns for TI C6X.
4 ;; This file is processed by genmult.sh to produce two variants of each
5 ;; pattern, a normal one and a real_mult variant for modulo scheduling.
6 ;; Copyright (C) 2010-2020 Free Software Foundation, Inc.
7 ;; Contributed by Bernd Schmidt <bernds@codesourcery.com>
8 ;; Contributed by CodeSourcery.
9 ;;
10 ;; This file is part of GCC.
11 ;;
12 ;; GCC is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 3, or (at your option)
15 ;; any later version.
16 ;;
17 ;; GCC is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
21 ;;
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GCC; see the file COPYING3. If not see
24 ;; <http://www.gnu.org/licenses/>.
25
26 ;; -------------------------------------------------------------------------
27 ;; Miscellaneous insns that execute on the M units
28 ;; -------------------------------------------------------------------------
29
30 (define_insn "rotlsi3"
31 [(set (match_operand:SI 0 "register_operand" "=a,b,a,b")
32 (rotate:SI (match_operand:SI 1 "register_operand" "a,b,?b,?a")
33 (match_operand:SI 2 "reg_or_ucst5_operand" "aIu5,bIu5,aIu5,bIu5")))]
34 "TARGET_INSNS_64"
35 "%|%.\\trotl\\t%$\\t%1, %2, %0"
36 [(set_attr "units" "m")
37 (set_attr "type" "mpy2")
38 (set_attr "cross" "n,n,y,y")])
39
40 (define_insn "bitrevsi2"
41 [(set (match_operand:SI 0 "register_operand" "=a,a,b,b")
42 (unspec:SI [(match_operand:SI 1 "register_operand" "a,?b,b,?a")]
43 UNSPEC_BITREV))]
44 "TARGET_INSNS_64"
45 "%|%.\\tbitr\\t%$\\t%1, %0"
46 [(set_attr "units" "m")
47 (set_attr "type" "mpy2")
48 (set_attr "cross" "n,y,n,y")])
49
50 ;; Vector average.
51
52 (define_insn "avgv2hi3"
53 [(set (match_operand:V2HI 0 "register_operand" "=a,b,a,b")
54 (unspec:V2HI [(match_operand:V2HI 1 "register_operand" "a,b,?b,?a")
55 (match_operand:V2HI 2 "register_operand" "a,b,a,b")] UNSPEC_AVG))]
56 "TARGET_INSNS_64"
57 "%|%.\\tavg2\\t%$\\t%1, %2, %0"
58 [(set_attr "units" "m")
59 (set_attr "type" "mpy2")
60 (set_attr "cross" "n,n,y,y")])
61
62 (define_insn "uavgv4qi3"
63 [(set (match_operand:V4QI 0 "register_operand" "=a,b,a,b")
64 (unspec:V4QI [(match_operand:V4QI 1 "register_operand" "a,b,?b,?a")
65 (match_operand:V4QI 2 "register_operand" "a,b,a,b")] UNSPEC_AVG))]
66 "TARGET_INSNS_64"
67 "%|%.\\tavgu4\\t%$\\t%1, %2, %0"
68 [(set_attr "units" "m")
69 (set_attr "type" "mpy2")
70 (set_attr "cross" "n,n,y,y")])
71
72 ;; -------------------------------------------------------------------------
73 ;; Multiplication
74 ;; -------------------------------------------------------------------------
75
76 (define_insn "mulhi3"
77 [(set (match_operand:HI 0 "register_operand" "=a,b,a,b")
78 (mult:HI (match_operand:HI 1 "register_operand" "a,b,?b,?a")
79 (match_operand:HI 2 "reg_or_scst5_operand" "aIs5,bIs5,aIs5,bIs5")))]
80 ""
81 "%|%.\\tmpy\\t%$\\t%2, %1, %0"
82 [(set_attr "type" "mpy2")
83 (set_attr "units" "m")
84 (set_attr "op_pattern" "sxs")
85 (set_attr "cross" "n,n,y,y")])
86
87 (define_insn "mulhisi3_const"
88 [(set (match_operand:SI 0 "register_operand" "=a,b,ab")
89 (mult:SI (sign_extend:SI
90 (match_operand:HI 1 "register_operand" "a,b,?ab"))
91 (match_operand:HI 2 "scst5_operand" "Is5,Is5,Is5")))]
92 ""
93 "%|%.\\tmpy\\t%$\\t%2, %1, %0"
94 [(set_attr "type" "mpy2")
95 (set_attr "units" "m")
96 (set_attr "cross" "n,n,y")])
97
98 (define_insn "*mulhisi3_insn"
99 [(set (match_operand:SI 0 "register_operand" "=a,b,a,b")
100 (mult:SI (sign_extend:SI
101 (match_operand:HI 1 "register_operand" "%a,b,?a,?b"))
102 (sign_extend:SI
103 (match_operand:HI 2 "reg_or_scst5_operand" "a,b,b,a"))))]
104 ""
105 "%|%.\\tmpy\\t%$\\t%1, %2, %0"
106 [(set_attr "type" "mpy2")
107 (set_attr "units" "m")
108 (set_attr "op_pattern" "ssx")
109 (set_attr "cross" "n,n,y,y")])
110
111 (define_insn "mulhisi3_lh"
112 [(set (match_operand:SI 0 "register_operand" "=a,b,a,b")
113 (mult:SI (sign_extend:SI
114 (match_operand:HI 1 "register_operand" "a,b,?a,?b"))
115 (ashiftrt:SI
116 (match_operand:SI 2 "register_operand" "a,b,b,a")
117 (const_int 16))))]
118 ""
119 "%|%.\\tmpylh\\t%$\\t%1, %2, %0"
120 [(set_attr "type" "mpy2")
121 (set_attr "units" "m")
122 (set_attr "cross" "n,n,y,y")])
123
124 (define_insn "mulhisi3_hl"
125 [(set (match_operand:SI 0 "register_operand" "=a,b,a,b")
126 (mult:SI (ashiftrt:SI
127 (match_operand:SI 1 "register_operand" "a,b,?a,?b")
128 (const_int 16))
129 (sign_extend:SI
130 (match_operand:HI 2 "register_operand" "a,b,b,a"))))]
131 ""
132 "%|%.\\tmpyhl\\t%$\\t%1, %2, %0"
133 [(set_attr "type" "mpy2")
134 (set_attr "units" "m")
135 (set_attr "cross" "n,n,y,y")])
136
137 (define_insn "mulhisi3_hh"
138 [(set (match_operand:SI 0 "register_operand" "=a,b,a,b")
139 (mult:SI (ashiftrt:SI
140 (match_operand:SI 1 "register_operand" "%a,b,?a,?b")
141 (const_int 16))
142 (ashiftrt:SI
143 (match_operand:SI 2 "register_operand" "a,b,b,a")
144 (const_int 16))))]
145 ""
146 "%|%.\\tmpyh\\t%$\\t%1, %2, %0"
147 [(set_attr "type" "mpy2")
148 (set_attr "units" "m")
149 (set_attr "cross" "n,n,y,y")])
150
151 (define_insn "umulhisi3"
152 [(set (match_operand:SI 0 "register_operand" "=a,b,a,b")
153 (mult:SI (zero_extend:SI
154 (match_operand:HI 1 "register_operand" "%a,b,?a,?b"))
155 (zero_extend:SI
156 (match_operand:HI 2 "register_operand" "a,b,b,a"))))]
157 ""
158 "%|%.\\tmpyu\\t%$\\t%1, %2, %0"
159 [(set_attr "type" "mpy2")
160 (set_attr "units" "m")
161 (set_attr "cross" "n,n,y,y")])
162
163 (define_insn "umulhisi3_lh"
164 [(set (match_operand:SI 0 "register_operand" "=a,b,a,b")
165 (mult:SI (zero_extend:SI
166 (match_operand:HI 1 "register_operand" "a,b,?a,?b"))
167 (lshiftrt:SI
168 (match_operand:SI 2 "register_operand" "a,b,b,a")
169 (const_int 16))))]
170 ""
171 "%|%.\\tmpylhu\\t%$\\t%1, %2, %0"
172 [(set_attr "type" "mpy2")
173 (set_attr "units" "m")
174 (set_attr "cross" "n,n,y,y")])
175
176 (define_insn "umulhisi3_hl"
177 [(set (match_operand:SI 0 "register_operand" "=a,b,a,b")
178 (mult:SI (lshiftrt:SI
179 (match_operand:SI 1 "register_operand" "a,b,?a,?b")
180 (const_int 16))
181 (zero_extend:SI
182 (match_operand:HI 2 "register_operand" "a,b,b,a"))))]
183 ""
184 "%|%.\\tmpyhlu\\t%$\\t%1, %2, %0"
185 [(set_attr "type" "mpy2")
186 (set_attr "units" "m")
187 (set_attr "cross" "n,n,y,y")])
188
189 (define_insn "umulhisi3_hh"
190 [(set (match_operand:SI 0 "register_operand" "=a,b,a,b")
191 (mult:SI (lshiftrt:SI
192 (match_operand:SI 1 "register_operand" "%a,b,?a,?b")
193 (const_int 16))
194 (lshiftrt:SI
195 (match_operand:SI 2 "register_operand" "a,b,b,a")
196 (const_int 16))))]
197 ""
198 "%|%.\\tmpyhu\\t%$\\t%1, %2, %0"
199 [(set_attr "type" "mpy2")
200 (set_attr "units" "m")
201 (set_attr "cross" "n,n,y,y")])
202
203 (define_insn "usmulhisi3_const"
204 [(set (match_operand:SI 0 "register_operand" "=a,b,ab")
205 (mult:SI (zero_extend:SI
206 (match_operand:HI 1 "register_operand" "a,b,?ab"))
207 (match_operand:SI 2 "scst5_operand" "Is5,Is5,Is5")))]
208 ""
209 "%|%.\\tmpysu\\t%$\\t%2, %1, %0"
210 [(set_attr "type" "mpy2")
211 (set_attr "units" "m")
212 (set_attr "cross" "n,n,y")])
213
214 (define_insn "*usmulhisi3_insn"
215 [(set (match_operand:SI 0 "register_operand" "=a,b,a,b")
216 (mult:SI (zero_extend:SI
217 (match_operand:HI 1 "register_operand" "a,b,?a,?b"))
218 (sign_extend:SI
219 (match_operand:HI 2 "reg_or_scst5_operand" "aIs5,bIs5,bIs5,aIs5"))))]
220 ""
221 "%|%.\\tmpyus\\t%$\\t%1, %2, %0"
222 [(set_attr "type" "mpy2")
223 (set_attr "units" "m")
224 (set_attr "cross" "n,n,y,y")])
225
226 (define_insn "usmulhisi3_lh"
227 [(set (match_operand:SI 0 "register_operand" "=a,b,a,b")
228 (mult:SI (zero_extend:SI
229 (match_operand:HI 1 "register_operand" "a,b,?a,?b"))
230 (ashiftrt:SI
231 (match_operand:SI 2 "register_operand" "a,b,b,a")
232 (const_int 16))))]
233 ""
234 "%|%.\\tmpyluhs\\t%$\\t%1, %2, %0"
235 [(set_attr "type" "mpy2")
236 (set_attr "units" "m")
237 (set_attr "cross" "n,n,y,y")])
238
239 (define_insn "usmulhisi3_hl"
240 [(set (match_operand:SI 0 "register_operand" "=a,b,a,b")
241 (mult:SI (lshiftrt:SI
242 (match_operand:SI 1 "register_operand" "a,b,?a,?b")
243 (const_int 16))
244 (sign_extend:SI
245 (match_operand:HI 2 "register_operand" "a,b,b,a"))))]
246 ""
247 "%|%.\\tmpyhuls\\t%$\\t%1, %2, %0"
248 [(set_attr "type" "mpy2")
249 (set_attr "units" "m")
250 (set_attr "cross" "n,n,y,y")])
251
252 (define_insn "usmulhisi3_hh"
253 [(set (match_operand:SI 0 "register_operand" "=a,b,a,b")
254 (mult:SI (lshiftrt:SI
255 (match_operand:SI 1 "register_operand" "a,b,?a,?b")
256 (const_int 16))
257 (ashiftrt:SI
258 (match_operand:SI 2 "register_operand" "a,b,b,a")
259 (const_int 16))))]
260 ""
261 "%|%.\\tmpyhus\\t%$\\t%1, %2, %0"
262 [(set_attr "type" "mpy2")
263 (set_attr "units" "m")
264 (set_attr "cross" "n,n,y,y")])
265
266 (define_insn "mulsi3_insn"
267 [(set (match_operand:SI 0 "register_operand" "=a,b,a,b")
268 (mult:SI (match_operand:SI 1 "register_operand" "%a,b,?a,?b")
269 (match_operand:SI 2 "register_operand" "a,b,b,a")))]
270 "TARGET_MPY32"
271 "%|%.\\tmpy32\\t%$\\t%1, %2, %0"
272 [(set_attr "type" "mpy4")
273 (set_attr "units" "m")
274 (set_attr "cross" "n,n,y,y")])
275
276 (define_insn "<u>mulsidi3"
277 [(set (match_operand:DI 0 "register_operand" "=a,b,a,b")
278 (mult:DI (any_ext:DI
279 (match_operand:SI 1 "register_operand" "%a,b,?a,?b"))
280 (any_ext:DI
281 (match_operand:SI 2 "register_operand" "a,b,b,a"))))]
282 "TARGET_MPY32"
283 "%|%.\\tmpy32<u>\\t%$\\t%1, %2, %0"
284 [(set_attr "type" "mpy4")
285 (set_attr "units" "m")
286 (set_attr "cross" "n,n,y,y")])
287
288 (define_insn "usmulsidi3"
289 [(set (match_operand:DI 0 "register_operand" "=a,b,a,b")
290 (mult:DI (zero_extend:DI
291 (match_operand:SI 1 "register_operand" "a,b,?a,?b"))
292 (sign_extend:DI
293 (match_operand:SI 2 "register_operand" "a,b,b,a"))))]
294 "TARGET_MPY32"
295 "%|%.\\tmpy32us\\t%$\\t%1, %2, %0"
296 [(set_attr "type" "mpy4")
297 (set_attr "units" "m")
298 (set_attr "cross" "n,n,y,y")])
299
300 ;; Widening vector multiply and dot product
301
302 (define_insn "mulv2hiv2si3"
303 [(set (match_operand:V2SI 0 "register_operand" "=a,b,a,b")
304 (mult:V2SI
305 (sign_extend:V2SI (match_operand:V2HI 1 "register_operand" "a,b,a,b"))
306 (sign_extend:V2SI (match_operand:V2HI 2 "register_operand" "a,b,?b,?a"))))]
307 "TARGET_INSNS_64"
308 "%|%.\\tmpy2\\t%$\\t%1, %2, %0"
309 [(set_attr "type" "mpy4")
310 (set_attr "units" "m")
311 (set_attr "cross" "n,n,y,y")])
312
313 (define_insn "umulv4qiv4hi3"
314 [(set (match_operand:V4HI 0 "register_operand" "=a,b,a,b")
315 (mult:V4HI
316 (zero_extend:V4HI (match_operand:V4QI 1 "register_operand" "a,b,a,b"))
317 (zero_extend:V4HI (match_operand:V4QI 2 "register_operand" "a,b,?b,?a"))))]
318 "TARGET_INSNS_64"
319 "%|%.\\tmpyu4\\t%$\\t%1, %2, %0"
320 [(set_attr "type" "mpy4")
321 (set_attr "units" "m")
322 (set_attr "cross" "n,n,y,y")])
323
324 (define_insn "usmulv4qiv4hi3"
325 [(set (match_operand:V4HI 0 "register_operand" "=a,b,a,b")
326 (mult:V4HI
327 (zero_extend:V4HI (match_operand:V4QI 1 "register_operand" "a,b,?b,?a"))
328 (sign_extend:V4HI (match_operand:V4QI 2 "register_operand" "a,b,a,b"))))]
329 "TARGET_INSNS_64"
330 "%|%.\\tmpyus4\\t%$\\t%1, %2, %0"
331 [(set_attr "type" "mpy4")
332 (set_attr "units" "m")
333 (set_attr "cross" "n,n,y,y")])
334
335 (define_insn "dotv2hi"
336 [(set (match_operand:SI 0 "register_operand" "=a,b,a,b")
337 (plus:SI
338 (mult:SI
339 (sign_extend:SI
340 (vec_select:HI
341 (match_operand:V2HI 1 "register_operand" "a,b,a,b")
342 (parallel [(const_int 0)])))
343 (sign_extend:SI
344 (vec_select:HI
345 (match_operand:V2HI 2 "register_operand" "a,b,?b,?a")
346 (parallel [(const_int 0)]))))
347 (mult:SI
348 (sign_extend:SI
349 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
350 (sign_extend:SI
351 (vec_select:HI (match_dup 2) (parallel [(const_int 1)]))))))]
352 "TARGET_INSNS_64"
353 "%|%.\\tdotp2\\t%$\\t%1, %2, %0"
354 [(set_attr "type" "mpy4")
355 (set_attr "units" "m")
356 (set_attr "cross" "n,n,y,y")])
357
358 ;; Fractional multiply
359
360 (define_insn "mulv2hqv2sq3"
361 [(set (match_operand:V2SQ 0 "register_operand" "=a,b,a,b")
362 (ss_mult:V2SQ
363 (fract_convert:V2SQ
364 (match_operand:V2HQ 1 "register_operand" "%a,b,?a,?b"))
365 (fract_convert:V2SQ
366 (match_operand:V2HQ 2 "register_operand" "a,b,b,a"))))]
367 ""
368 "%|%.\\tsmpy2\\t%$\\t%1, %2, %0"
369 [(set_attr "type" "mpy4")
370 (set_attr "units" "m")
371 (set_attr "cross" "n,n,y,y")])
372
373 (define_insn "mulhqsq3"
374 [(set (match_operand:SQ 0 "register_operand" "=a,b,a,b")
375 (ss_mult:SQ
376 (fract_convert:SQ
377 (match_operand:HQ 1 "register_operand" "%a,b,?a,?b"))
378 (fract_convert:SQ
379 (match_operand:HQ 2 "register_operand" "a,b,b,a"))))]
380 ""
381 "%|%.\\tsmpy\\t%$\\t%1, %2, %0"
382 [(set_attr "type" "mpy2")
383 (set_attr "units" "m")
384 (set_attr "cross" "n,n,y,y")])
385
386 (define_insn "mulhqsq3_lh"
387 [(set (match_operand:SQ 0 "register_operand" "=a,b,a,b")
388 (ss_mult:SQ
389 (fract_convert:SQ
390 (match_operand:HQ 1 "register_operand" "a,b,?a,?b"))
391 (fract_convert:SQ
392 (truncate:HQ (match_operand:SQ 2 "register_operand" "a,b,b,a")))))]
393 ""
394 "%|%.\\tsmpylh\\t%$\\t%1, %2, %0"
395 [(set_attr "type" "mpy2")
396 (set_attr "units" "m")
397 (set_attr "cross" "n,n,y,y")])
398
399 (define_insn "mulhqsq3_hl"
400 [(set (match_operand:SQ 0 "register_operand" "=a,b,a,b")
401 (ss_mult:SQ
402 (fract_convert:SQ
403 (truncate:HQ (match_operand:SQ 1 "register_operand" "a,b,b,a")))
404 (fract_convert:SQ
405 (match_operand:HQ 2 "register_operand" "a,b,b,a"))))]
406 ""
407 "%|%.\\tsmpyhl\\t%$\\t%1, %2, %0"
408 [(set_attr "type" "mpy2")
409 (set_attr "units" "m")
410 (set_attr "cross" "n,n,y,y")])
411
412 (define_insn "mulhqsq3_hh"
413 [(set (match_operand:SQ 0 "register_operand" "=a,b,a,b")
414 (ss_mult:SQ
415 (fract_convert:SQ
416 (truncate:HQ (match_operand:SQ 1 "register_operand" "a,b,b,a")))
417 (fract_convert:SQ
418 (truncate:HQ (match_operand:SQ 2 "register_operand" "a,b,b,a")))))]
419 ""
420 "%|%.\\tsmpyh\\t%$\\t%1, %2, %0"
421 [(set_attr "type" "mpy2")
422 (set_attr "units" "m")
423 (set_attr "cross" "n,n,y,y")])
424 ;; Multiplication patterns for TI C6X.
425 ;; This file is processed by genmult.sh to produce two variants of each
426 ;; pattern, a normal one and a real_mult variant for modulo scheduling.
427 ;; Copyright (C) 2010-2020 Free Software Foundation, Inc.
428 ;; Contributed by Bernd Schmidt <bernds@codesourcery.com>
429 ;; Contributed by CodeSourcery.
430 ;;
431 ;; This file is part of GCC.
432 ;;
433 ;; GCC is free software; you can redistribute it and/or modify
434 ;; it under the terms of the GNU General Public License as published by
435 ;; the Free Software Foundation; either version 3, or (at your option)
436 ;; any later version.
437 ;;
438 ;; GCC is distributed in the hope that it will be useful,
439 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
440 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
441 ;; GNU General Public License for more details.
442 ;;
443 ;; You should have received a copy of the GNU General Public License
444 ;; along with GCC; see the file COPYING3. If not see
445 ;; <http://www.gnu.org/licenses/>.
446
447 ;; -------------------------------------------------------------------------
448 ;; Miscellaneous insns that execute on the M units
449 ;; -------------------------------------------------------------------------
450
451 (define_insn "rotlsi3_real"
452 [(unspec [(match_operand:SI 0 "const_int_operand" "=JA,JB,JA,JB")
453 (rotate:SI (match_operand:SI 1 "register_operand" "a,b,?b,?a")
454 (match_operand:SI 2 "reg_or_ucst5_operand" "aIu5,bIu5,aIu5,bIu5"))] UNSPEC_REAL_MULT)]
455 "TARGET_INSNS_64"
456 "%|%.\\trotl\\t%$\\t%1, %2, %k0"
457 [(set_attr "units" "m")
458 (set_attr "type" "mpy2")
459 (set_attr "cross" "n,n,y,y")])
460
461 (define_insn "bitrevsi2_real"
462 [(unspec [(match_operand:SI 0 "const_int_operand" "=JA,JA,JB,JB")
463 (unspec:SI [(match_operand:SI 1 "register_operand" "a,?b,b,?a")]
464 UNSPEC_BITREV)] UNSPEC_REAL_MULT)]
465 "TARGET_INSNS_64"
466 "%|%.\\tbitr\\t%$\\t%1, %k0"
467 [(set_attr "units" "m")
468 (set_attr "type" "mpy2")
469 (set_attr "cross" "n,y,n,y")])
470
471 ;; Vector average.
472
473 (define_insn "avgv2hi3_real"
474 [(unspec [(match_operand:SI 0 "const_int_operand" "=JA,JB,JA,JB")
475 (unspec:V2HI [(match_operand:V2HI 1 "register_operand" "a,b,?b,?a")
476 (match_operand:V2HI 2 "register_operand" "a,b,a,b")] UNSPEC_AVG)] UNSPEC_REAL_MULT)]
477 "TARGET_INSNS_64"
478 "%|%.\\tavg2\\t%$\\t%1, %2, %k0"
479 [(set_attr "units" "m")
480 (set_attr "type" "mpy2")
481 (set_attr "cross" "n,n,y,y")])
482
483 (define_insn "uavgv4qi3_real"
484 [(unspec [(match_operand:SI 0 "const_int_operand" "=JA,JB,JA,JB")
485 (unspec:V4QI [(match_operand:V4QI 1 "register_operand" "a,b,?b,?a")
486 (match_operand:V4QI 2 "register_operand" "a,b,a,b")] UNSPEC_AVG)] UNSPEC_REAL_MULT)]
487 "TARGET_INSNS_64"
488 "%|%.\\tavgu4\\t%$\\t%1, %2, %k0"
489 [(set_attr "units" "m")
490 (set_attr "type" "mpy2")
491 (set_attr "cross" "n,n,y,y")])
492
493 ;; -------------------------------------------------------------------------
494 ;; Multiplication
495 ;; -------------------------------------------------------------------------
496
497 (define_insn "mulhi3_real"
498 [(unspec [(match_operand:HI 0 "const_int_operand" "=JA,JB,JA,JB")
499 (mult:HI (match_operand:HI 1 "register_operand" "a,b,?b,?a")
500 (match_operand:HI 2 "reg_or_scst5_operand" "aIs5,bIs5,aIs5,bIs5"))] UNSPEC_REAL_MULT)]
501 ""
502 "%|%.\\tmpy\\t%$\\t%2, %1, %k0"
503 [(set_attr "type" "mpy2")
504 (set_attr "units" "m")
505 (set_attr "op_pattern" "sxs")
506 (set_attr "cross" "n,n,y,y")])
507
508 (define_insn "mulhisi3_const_real"
509 [(unspec [(match_operand:SI 0 "const_int_operand" "=JA,JB,JAJB")
510 (mult:SI (sign_extend:SI
511 (match_operand:HI 1 "register_operand" "a,b,?ab"))
512 (match_operand:HI 2 "scst5_operand" "Is5,Is5,Is5"))] UNSPEC_REAL_MULT)]
513 ""
514 "%|%.\\tmpy\\t%$\\t%2, %1, %k0"
515 [(set_attr "type" "mpy2")
516 (set_attr "units" "m")
517 (set_attr "cross" "n,n,y")])
518
519 (define_insn "*mulhisi3_insn_real"
520 [(unspec [(match_operand:SI 0 "const_int_operand" "=JA,JB,JA,JB")
521 (mult:SI (sign_extend:SI
522 (match_operand:HI 1 "register_operand" "%a,b,?a,?b"))
523 (sign_extend:SI
524 (match_operand:HI 2 "reg_or_scst5_operand" "a,b,b,a")))] UNSPEC_REAL_MULT)]
525 ""
526 "%|%.\\tmpy\\t%$\\t%1, %2, %k0"
527 [(set_attr "type" "mpy2")
528 (set_attr "units" "m")
529 (set_attr "op_pattern" "ssx")
530 (set_attr "cross" "n,n,y,y")])
531
532 (define_insn "mulhisi3_lh_real"
533 [(unspec [(match_operand:SI 0 "const_int_operand" "=JA,JB,JA,JB")
534 (mult:SI (sign_extend:SI
535 (match_operand:HI 1 "register_operand" "a,b,?a,?b"))
536 (ashiftrt:SI
537 (match_operand:SI 2 "register_operand" "a,b,b,a")
538 (const_int 16)))] UNSPEC_REAL_MULT)]
539 ""
540 "%|%.\\tmpylh\\t%$\\t%1, %2, %k0"
541 [(set_attr "type" "mpy2")
542 (set_attr "units" "m")
543 (set_attr "cross" "n,n,y,y")])
544
545 (define_insn "mulhisi3_hl_real"
546 [(unspec [(match_operand:SI 0 "const_int_operand" "=JA,JB,JA,JB")
547 (mult:SI (ashiftrt:SI
548 (match_operand:SI 1 "register_operand" "a,b,?a,?b")
549 (const_int 16))
550 (sign_extend:SI
551 (match_operand:HI 2 "register_operand" "a,b,b,a")))] UNSPEC_REAL_MULT)]
552 ""
553 "%|%.\\tmpyhl\\t%$\\t%1, %2, %k0"
554 [(set_attr "type" "mpy2")
555 (set_attr "units" "m")
556 (set_attr "cross" "n,n,y,y")])
557
558 (define_insn "mulhisi3_hh_real"
559 [(unspec [(match_operand:SI 0 "const_int_operand" "=JA,JB,JA,JB")
560 (mult:SI (ashiftrt:SI
561 (match_operand:SI 1 "register_operand" "%a,b,?a,?b")
562 (const_int 16))
563 (ashiftrt:SI
564 (match_operand:SI 2 "register_operand" "a,b,b,a")
565 (const_int 16)))] UNSPEC_REAL_MULT)]
566 ""
567 "%|%.\\tmpyh\\t%$\\t%1, %2, %k0"
568 [(set_attr "type" "mpy2")
569 (set_attr "units" "m")
570 (set_attr "cross" "n,n,y,y")])
571
572 (define_insn "umulhisi3_real"
573 [(unspec [(match_operand:SI 0 "const_int_operand" "=JA,JB,JA,JB")
574 (mult:SI (zero_extend:SI
575 (match_operand:HI 1 "register_operand" "%a,b,?a,?b"))
576 (zero_extend:SI
577 (match_operand:HI 2 "register_operand" "a,b,b,a")))] UNSPEC_REAL_MULT)]
578 ""
579 "%|%.\\tmpyu\\t%$\\t%1, %2, %k0"
580 [(set_attr "type" "mpy2")
581 (set_attr "units" "m")
582 (set_attr "cross" "n,n,y,y")])
583
584 (define_insn "umulhisi3_lh_real"
585 [(unspec [(match_operand:SI 0 "const_int_operand" "=JA,JB,JA,JB")
586 (mult:SI (zero_extend:SI
587 (match_operand:HI 1 "register_operand" "a,b,?a,?b"))
588 (lshiftrt:SI
589 (match_operand:SI 2 "register_operand" "a,b,b,a")
590 (const_int 16)))] UNSPEC_REAL_MULT)]
591 ""
592 "%|%.\\tmpylhu\\t%$\\t%1, %2, %k0"
593 [(set_attr "type" "mpy2")
594 (set_attr "units" "m")
595 (set_attr "cross" "n,n,y,y")])
596
597 (define_insn "umulhisi3_hl_real"
598 [(unspec [(match_operand:SI 0 "const_int_operand" "=JA,JB,JA,JB")
599 (mult:SI (lshiftrt:SI
600 (match_operand:SI 1 "register_operand" "a,b,?a,?b")
601 (const_int 16))
602 (zero_extend:SI
603 (match_operand:HI 2 "register_operand" "a,b,b,a")))] UNSPEC_REAL_MULT)]
604 ""
605 "%|%.\\tmpyhlu\\t%$\\t%1, %2, %k0"
606 [(set_attr "type" "mpy2")
607 (set_attr "units" "m")
608 (set_attr "cross" "n,n,y,y")])
609
610 (define_insn "umulhisi3_hh_real"
611 [(unspec [(match_operand:SI 0 "const_int_operand" "=JA,JB,JA,JB")
612 (mult:SI (lshiftrt:SI
613 (match_operand:SI 1 "register_operand" "%a,b,?a,?b")
614 (const_int 16))
615 (lshiftrt:SI
616 (match_operand:SI 2 "register_operand" "a,b,b,a")
617 (const_int 16)))] UNSPEC_REAL_MULT)]
618 ""
619 "%|%.\\tmpyhu\\t%$\\t%1, %2, %k0"
620 [(set_attr "type" "mpy2")
621 (set_attr "units" "m")
622 (set_attr "cross" "n,n,y,y")])
623
624 (define_insn "usmulhisi3_const_real"
625 [(unspec [(match_operand:SI 0 "const_int_operand" "=JA,JB,JAJB")
626 (mult:SI (zero_extend:SI
627 (match_operand:HI 1 "register_operand" "a,b,?ab"))
628 (match_operand:SI 2 "scst5_operand" "Is5,Is5,Is5"))] UNSPEC_REAL_MULT)]
629 ""
630 "%|%.\\tmpysu\\t%$\\t%2, %1, %k0"
631 [(set_attr "type" "mpy2")
632 (set_attr "units" "m")
633 (set_attr "cross" "n,n,y")])
634
635 (define_insn "*usmulhisi3_insn_real"
636 [(unspec [(match_operand:SI 0 "const_int_operand" "=JA,JB,JA,JB")
637 (mult:SI (zero_extend:SI
638 (match_operand:HI 1 "register_operand" "a,b,?a,?b"))
639 (sign_extend:SI
640 (match_operand:HI 2 "reg_or_scst5_operand" "aIs5,bIs5,bIs5,aIs5")))] UNSPEC_REAL_MULT)]
641 ""
642 "%|%.\\tmpyus\\t%$\\t%1, %2, %k0"
643 [(set_attr "type" "mpy2")
644 (set_attr "units" "m")
645 (set_attr "cross" "n,n,y,y")])
646
647 (define_insn "usmulhisi3_lh_real"
648 [(unspec [(match_operand:SI 0 "const_int_operand" "=JA,JB,JA,JB")
649 (mult:SI (zero_extend:SI
650 (match_operand:HI 1 "register_operand" "a,b,?a,?b"))
651 (ashiftrt:SI
652 (match_operand:SI 2 "register_operand" "a,b,b,a")
653 (const_int 16)))] UNSPEC_REAL_MULT)]
654 ""
655 "%|%.\\tmpyluhs\\t%$\\t%1, %2, %k0"
656 [(set_attr "type" "mpy2")
657 (set_attr "units" "m")
658 (set_attr "cross" "n,n,y,y")])
659
660 (define_insn "usmulhisi3_hl_real"
661 [(unspec [(match_operand:SI 0 "const_int_operand" "=JA,JB,JA,JB")
662 (mult:SI (lshiftrt:SI
663 (match_operand:SI 1 "register_operand" "a,b,?a,?b")
664 (const_int 16))
665 (sign_extend:SI
666 (match_operand:HI 2 "register_operand" "a,b,b,a")))] UNSPEC_REAL_MULT)]
667 ""
668 "%|%.\\tmpyhuls\\t%$\\t%1, %2, %k0"
669 [(set_attr "type" "mpy2")
670 (set_attr "units" "m")
671 (set_attr "cross" "n,n,y,y")])
672
673 (define_insn "usmulhisi3_hh_real"
674 [(unspec [(match_operand:SI 0 "const_int_operand" "=JA,JB,JA,JB")
675 (mult:SI (lshiftrt:SI
676 (match_operand:SI 1 "register_operand" "a,b,?a,?b")
677 (const_int 16))
678 (ashiftrt:SI
679 (match_operand:SI 2 "register_operand" "a,b,b,a")
680 (const_int 16)))] UNSPEC_REAL_MULT)]
681 ""
682 "%|%.\\tmpyhus\\t%$\\t%1, %2, %k0"
683 [(set_attr "type" "mpy2")
684 (set_attr "units" "m")
685 (set_attr "cross" "n,n,y,y")])
686
687 (define_insn "mulsi3_insn_real"
688 [(unspec [(match_operand:SI 0 "const_int_operand" "=JA,JB,JA,JB")
689 (mult:SI (match_operand:SI 1 "register_operand" "%a,b,?a,?b")
690 (match_operand:SI 2 "register_operand" "a,b,b,a"))] UNSPEC_REAL_MULT)]
691 "TARGET_MPY32"
692 "%|%.\\tmpy32\\t%$\\t%1, %2, %k0"
693 [(set_attr "type" "mpy4")
694 (set_attr "units" "m")
695 (set_attr "cross" "n,n,y,y")])
696
697 (define_insn "<u>mulsidi3_real"
698 [(unspec [(match_operand:DI 0 "const_int_operand" "=JA,JB,JA,JB")
699 (mult:DI (any_ext:DI
700 (match_operand:SI 1 "register_operand" "%a,b,?a,?b"))
701 (any_ext:DI
702 (match_operand:SI 2 "register_operand" "a,b,b,a")))] UNSPEC_REAL_MULT)]
703 "TARGET_MPY32"
704 "%|%.\\tmpy32<u>\\t%$\\t%1, %2, %K0"
705 [(set_attr "type" "mpy4")
706 (set_attr "units" "m")
707 (set_attr "cross" "n,n,y,y")])
708
709 (define_insn "usmulsidi3_real"
710 [(unspec [(match_operand:DI 0 "const_int_operand" "=JA,JB,JA,JB")
711 (mult:DI (zero_extend:DI
712 (match_operand:SI 1 "register_operand" "a,b,?a,?b"))
713 (sign_extend:DI
714 (match_operand:SI 2 "register_operand" "a,b,b,a")))] UNSPEC_REAL_MULT)]
715 "TARGET_MPY32"
716 "%|%.\\tmpy32us\\t%$\\t%1, %2, %K0"
717 [(set_attr "type" "mpy4")
718 (set_attr "units" "m")
719 (set_attr "cross" "n,n,y,y")])
720
721 ;; Widening vector multiply and dot product
722
723 (define_insn "mulv2hiv2si3_real"
724 [(unspec [(match_operand:V2SI 0 "const_int_operand" "=JA,JB,JA,JB")
725 (mult:V2SI
726 (sign_extend:V2SI (match_operand:V2HI 1 "register_operand" "a,b,a,b"))
727 (sign_extend:V2SI (match_operand:V2HI 2 "register_operand" "a,b,?b,?a")))] UNSPEC_REAL_MULT)]
728 "TARGET_INSNS_64"
729 "%|%.\\tmpy2\\t%$\\t%1, %2, %k0"
730 [(set_attr "type" "mpy4")
731 (set_attr "units" "m")
732 (set_attr "cross" "n,n,y,y")])
733
734 (define_insn "umulv4qiv4hi3_real"
735 [(unspec [(match_operand:V4HI 0 "const_int_operand" "=JA,JB,JA,JB")
736 (mult:V4HI
737 (zero_extend:V4HI (match_operand:V4QI 1 "register_operand" "a,b,a,b"))
738 (zero_extend:V4HI (match_operand:V4QI 2 "register_operand" "a,b,?b,?a")))] UNSPEC_REAL_MULT)]
739 "TARGET_INSNS_64"
740 "%|%.\\tmpyu4\\t%$\\t%1, %2, %k0"
741 [(set_attr "type" "mpy4")
742 (set_attr "units" "m")
743 (set_attr "cross" "n,n,y,y")])
744
745 (define_insn "usmulv4qiv4hi3_real"
746 [(unspec [(match_operand:V4HI 0 "const_int_operand" "=JA,JB,JA,JB")
747 (mult:V4HI
748 (zero_extend:V4HI (match_operand:V4QI 1 "register_operand" "a,b,?b,?a"))
749 (sign_extend:V4HI (match_operand:V4QI 2 "register_operand" "a,b,a,b")))] UNSPEC_REAL_MULT)]
750 "TARGET_INSNS_64"
751 "%|%.\\tmpyus4\\t%$\\t%1, %2, %k0"
752 [(set_attr "type" "mpy4")
753 (set_attr "units" "m")
754 (set_attr "cross" "n,n,y,y")])
755
756 (define_insn "dotv2hi_real"
757 [(unspec [(match_operand:SI 0 "const_int_operand" "=JA,JB,JA,JB")
758 (plus:SI
759 (mult:SI
760 (sign_extend:SI
761 (vec_select:HI
762 (match_operand:V2HI 1 "register_operand" "a,b,a,b")
763 (parallel [(const_int 0)])))
764 (sign_extend:SI
765 (vec_select:HI
766 (match_operand:V2HI 2 "register_operand" "a,b,?b,?a")
767 (parallel [(const_int 0)]))))
768 (mult:SI
769 (sign_extend:SI
770 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
771 (sign_extend:SI
772 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))))] UNSPEC_REAL_MULT)]
773 "TARGET_INSNS_64"
774 "%|%.\\tdotp2\\t%$\\t%1, %2, %k0"
775 [(set_attr "type" "mpy4")
776 (set_attr "units" "m")
777 (set_attr "cross" "n,n,y,y")])
778
779 ;; Fractional multiply
780
781 (define_insn "mulv2hqv2sq3_real"
782 [(unspec [(match_operand:SI 0 "const_int_operand" "=JA,JB,JA,JB")
783 (ss_mult:V2SQ
784 (fract_convert:V2SQ
785 (match_operand:V2HQ 1 "register_operand" "%a,b,?a,?b"))
786 (fract_convert:V2SQ
787 (match_operand:V2HQ 2 "register_operand" "a,b,b,a")))] UNSPEC_REAL_MULT)]
788 ""
789 "%|%.\\tsmpy2\\t%$\\t%1, %2, %k0"
790 [(set_attr "type" "mpy4")
791 (set_attr "units" "m")
792 (set_attr "cross" "n,n,y,y")])
793
794 (define_insn "mulhqsq3_real"
795 [(unspec [(match_operand:SI 0 "const_int_operand" "=JA,JB,JA,JB")
796 (ss_mult:SQ
797 (fract_convert:SQ
798 (match_operand:HQ 1 "register_operand" "%a,b,?a,?b"))
799 (fract_convert:SQ
800 (match_operand:HQ 2 "register_operand" "a,b,b,a")))] UNSPEC_REAL_MULT)]
801 ""
802 "%|%.\\tsmpy\\t%$\\t%1, %2, %k0"
803 [(set_attr "type" "mpy2")
804 (set_attr "units" "m")
805 (set_attr "cross" "n,n,y,y")])
806
807 (define_insn "mulhqsq3_lh_real"
808 [(unspec [(match_operand:SI 0 "const_int_operand" "=JA,JB,JA,JB")
809 (ss_mult:SQ
810 (fract_convert:SQ
811 (match_operand:HQ 1 "register_operand" "a,b,?a,?b"))
812 (fract_convert:SQ
813 (truncate:HQ (match_operand:SQ 2 "register_operand" "a,b,b,a"))))] UNSPEC_REAL_MULT)]
814 ""
815 "%|%.\\tsmpylh\\t%$\\t%1, %2, %k0"
816 [(set_attr "type" "mpy2")
817 (set_attr "units" "m")
818 (set_attr "cross" "n,n,y,y")])
819
820 (define_insn "mulhqsq3_hl_real"
821 [(unspec [(match_operand:SI 0 "const_int_operand" "=JA,JB,JA,JB")
822 (ss_mult:SQ
823 (fract_convert:SQ
824 (truncate:HQ (match_operand:SQ 1 "register_operand" "a,b,b,a")))
825 (fract_convert:SQ
826 (match_operand:HQ 2 "register_operand" "a,b,b,a")))] UNSPEC_REAL_MULT)]
827 ""
828 "%|%.\\tsmpyhl\\t%$\\t%1, %2, %k0"
829 [(set_attr "type" "mpy2")
830 (set_attr "units" "m")
831 (set_attr "cross" "n,n,y,y")])
832
833 (define_insn "mulhqsq3_hh_real"
834 [(unspec [(match_operand:SI 0 "const_int_operand" "=JA,JB,JA,JB")
835 (ss_mult:SQ
836 (fract_convert:SQ
837 (truncate:HQ (match_operand:SQ 1 "register_operand" "a,b,b,a")))
838 (fract_convert:SQ
839 (truncate:HQ (match_operand:SQ 2 "register_operand" "a,b,b,a"))))] UNSPEC_REAL_MULT)]
840 ""
841 "%|%.\\tsmpyh\\t%$\\t%1, %2, %k0"
842 [(set_attr "type" "mpy2")
843 (set_attr "units" "m")
844 (set_attr "cross" "n,n,y,y")])