OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [config/] [ia64/] [vect.md] - Blame information for rev 154

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
;; IA-64 machine description for vector operations.
2
;; Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
3
;;
4
;; This file is part of GCC.
5
;;
6
;; GCC is free software; you can redistribute it and/or modify
7
;; it under the terms of the GNU General Public License as published by
8
;; the Free Software Foundation; either version 3, or (at your option)
9
;; any later version.
10
;;
11
;; GCC is distributed in the hope that it will be useful,
12
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
;; GNU General Public License for more details.
15
;;
16
;; You should have received a copy of the GNU General Public License
17
;; along with GCC; see the file COPYING3.  If not see
18
;; .
19
 
20
 
21
;; Integer vector operations
22
 
23
(define_mode_macro VECINT [V8QI V4HI V2SI])
24
(define_mode_macro VECINT12 [V8QI V4HI])
25
(define_mode_macro VECINT24 [V4HI V2SI])
26
(define_mode_attr vecsize [(V8QI "1") (V4HI "2") (V2SI "4")])
27
 
28
(define_expand "mov"
29
  [(set (match_operand:VECINT 0 "general_operand" "")
30
        (match_operand:VECINT 1 "general_operand" ""))]
31
  ""
32
{
33
  rtx op1 = ia64_expand_move (operands[0], operands[1]);
34
  if (!op1)
35
    DONE;
36
  operands[1] = op1;
37
})
38
 
39
(define_insn "*mov_internal"
40
  [(set (match_operand:VECINT 0 "destination_operand"
41
                                        "=r,r,r,r,m ,*f ,*f,Q ,r ,*f")
42
        (match_operand:VECINT 1 "move_operand"
43
                                        "rU,W,i,m,rU,U*f,Q ,*f,*f,r "))]
44
  "ia64_move_ok (operands[0], operands[1])"
45
  "@
46
   mov %0 = %r1
47
   addl %0 = %v1, r0
48
   movl %0 = %v1
49
   ld8%O1 %0 = %1%P1
50
   st8%Q0 %0 = %r1%P0
51
   mov %0 = %F1
52
   ldf8 %0 = %1%P1
53
   stf8 %0 = %1%P0
54
   getf.sig %0 = %1
55
   setf.sig %0 = %1"
56
  [(set_attr "itanium_class" "ialu,ialu,long_i,ld,st,fmisc,fld,stf,frfr,tofr")])
57
 
58
(define_insn "one_cmpl2"
59
  [(set (match_operand:VECINT 0 "gr_register_operand" "=r")
60
        (not:VECINT (match_operand:VECINT 1 "gr_register_operand" "r")))]
61
  ""
62
  "andcm %0 = -1, %1"
63
  [(set_attr "itanium_class" "ilog")])
64
 
65
(define_insn "and3"
66
  [(set (match_operand:VECINT 0 "grfr_register_operand" "=r,*f")
67
        (and:VECINT
68
          (match_operand:VECINT 1 "grfr_register_operand" "r,*f")
69
          (match_operand:VECINT 2 "grfr_reg_or_8bit_operand" "r,*f")))]
70
  ""
71
  "@
72
   and %0 = %2, %1
73
   fand %0 = %2, %1"
74
  [(set_attr "itanium_class" "ilog,fmisc")])
75
 
76
(define_insn "*andnot"
77
  [(set (match_operand:VECINT 0 "grfr_register_operand" "=r,*f")
78
        (and:VECINT
79
          (not:VECINT (match_operand:VECINT 1 "grfr_register_operand" "r,*f"))
80
          (match_operand:VECINT 2 "grfr_reg_or_8bit_operand" "r,*f")))]
81
  ""
82
  "@
83
   andcm %0 = %2, %1
84
   fandcm %0 = %2, %1"
85
  [(set_attr "itanium_class" "ilog,fmisc")])
86
 
87
(define_insn "ior3"
88
  [(set (match_operand:VECINT 0 "grfr_register_operand" "=r,*f")
89
        (ior:VECINT
90
          (match_operand:VECINT 1 "grfr_register_operand" "r,*f")
91
          (match_operand:VECINT 2 "grfr_reg_or_8bit_operand" "r,*f")))]
92
  ""
93
  "@
94
   or %0 = %2, %1
95
   for %0 = %2, %1"
96
  [(set_attr "itanium_class" "ilog,fmisc")])
97
 
98
(define_insn "xor3"
99
  [(set (match_operand:VECINT 0 "grfr_register_operand" "=r,*f")
100
        (xor:VECINT
101
          (match_operand:VECINT 1 "grfr_register_operand" "r,*f")
102
          (match_operand:VECINT 2 "grfr_reg_or_8bit_operand" "r,*f")))]
103
  ""
104
  "@
105
   xor %0 = %2, %1
106
   fxor %0 = %2, %1"
107
  [(set_attr "itanium_class" "ilog,fmisc")])
108
 
109
(define_insn "neg2"
110
  [(set (match_operand:VECINT 0 "gr_register_operand" "=r")
111
        (neg:VECINT (match_operand:VECINT 1 "gr_register_operand" "r")))]
112
  ""
113
  "psub %0 = r0, %1"
114
  [(set_attr "itanium_class" "mmalua")])
115
 
116
(define_insn "add3"
117
  [(set (match_operand:VECINT 0 "gr_register_operand" "=r")
118
        (plus:VECINT (match_operand:VECINT 1 "gr_register_operand" "r")
119
                     (match_operand:VECINT 2 "gr_register_operand" "r")))]
120
  ""
121
  "padd %0 = %1, %2"
122
  [(set_attr "itanium_class" "mmalua")])
123
 
124
(define_insn "*ssadd3"
125
  [(set (match_operand:VECINT12 0 "gr_register_operand" "=r")
126
        (ss_plus:VECINT12
127
          (match_operand:VECINT12 1 "gr_register_operand" "r")
128
          (match_operand:VECINT12 2 "gr_register_operand" "r")))]
129
  ""
130
  "padd.sss %0 = %1, %2"
131
  [(set_attr "itanium_class" "mmalua")])
132
 
133
(define_insn "*usadd3"
134
  [(set (match_operand:VECINT12 0 "gr_register_operand" "=r")
135
        (us_plus:VECINT12
136
          (match_operand:VECINT12 1 "gr_register_operand" "r")
137
          (match_operand:VECINT12 2 "gr_register_operand" "r")))]
138
  ""
139
  "padd.uuu %0 = %1, %2"
140
  [(set_attr "itanium_class" "mmalua")])
141
 
142
(define_insn "sub3"
143
  [(set (match_operand:VECINT 0 "gr_register_operand" "=r")
144
        (minus:VECINT (match_operand:VECINT 1 "gr_register_operand" "r")
145
                      (match_operand:VECINT 2 "gr_register_operand" "r")))]
146
  ""
147
  "psub %0 = %1, %2"
148
  [(set_attr "itanium_class" "mmalua")])
149
 
150
(define_insn "*sssub3"
151
  [(set (match_operand:VECINT12 0 "gr_register_operand" "=r")
152
        (ss_minus:VECINT12
153
          (match_operand:VECINT12 1 "gr_register_operand" "r")
154
          (match_operand:VECINT12 2 "gr_register_operand" "r")))]
155
  ""
156
  "psub.sss %0 = %1, %2"
157
  [(set_attr "itanium_class" "mmalua")])
158
 
159
(define_insn "*ussub3"
160
  [(set (match_operand:VECINT12 0 "gr_register_operand" "=r")
161
        (us_minus:VECINT12
162
          (match_operand:VECINT12 1 "gr_register_operand" "r")
163
          (match_operand:VECINT12 2 "gr_register_operand" "r")))]
164
  ""
165
  "psub.uuu %0 = %1, %2"
166
  [(set_attr "itanium_class" "mmalua")])
167
 
168
(define_expand "mulv8qi3"
169
  [(set (match_operand:V8QI 0 "gr_register_operand" "")
170
        (mult:V8QI (match_operand:V8QI 1 "gr_register_operand" "r")
171
                   (match_operand:V8QI 2 "gr_register_operand" "r")))]
172
  ""
173
{
174
  rtx r1, l1, r2, l2, rm, lm;
175
 
176
  r1 = gen_reg_rtx (V4HImode);
177
  l1 = gen_reg_rtx (V4HImode);
178
  r2 = gen_reg_rtx (V4HImode);
179
  l2 = gen_reg_rtx (V4HImode);
180
 
181
  /* Zero-extend the QImode elements into two words of HImode elements
182
     by interleaving them with zero bytes.  */
183
  emit_insn (gen_mix1_r (gen_lowpart (V8QImode, r1),
184
                         operands[1], CONST0_RTX (V8QImode)));
185
  emit_insn (gen_mix1_r (gen_lowpart (V8QImode, r2),
186
                         operands[2], CONST0_RTX (V8QImode)));
187
  emit_insn (gen_mix1_l (gen_lowpart (V8QImode, l1),
188
                         operands[1], CONST0_RTX (V8QImode)));
189
  emit_insn (gen_mix1_l (gen_lowpart (V8QImode, l2),
190
                         operands[2], CONST0_RTX (V8QImode)));
191
 
192
  /* Multiply.  */
193
  rm = gen_reg_rtx (V4HImode);
194
  lm = gen_reg_rtx (V4HImode);
195
  emit_insn (gen_mulv4hi3 (rm, r1, r2));
196
  emit_insn (gen_mulv4hi3 (lm, l1, l2));
197
 
198
  /* Zap the high order bytes of the HImode elements by overwriting those
199
     in one part with the low order bytes of the other.  */
200
  emit_insn (gen_mix1_r (operands[0],
201
                         gen_lowpart (V8QImode, rm),
202
                         gen_lowpart (V8QImode, lm)));
203
  DONE;
204
})
205
 
206
(define_insn "mulv4hi3"
207
  [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
208
        (mult:V4HI (match_operand:V4HI 1 "gr_register_operand" "r")
209
                   (match_operand:V4HI 2 "gr_register_operand" "r")))]
210
  ""
211
  "pmpyshr2 %0 = %1, %2, 0"
212
  [(set_attr "itanium_class" "mmmul")])
213
 
214
(define_insn "pmpy2_r"
215
  [(set (match_operand:V2SI 0 "gr_register_operand" "=r")
216
        (mult:V2SI
217
          (vec_select:V2SI
218
            (sign_extend:V4SI
219
              (match_operand:V4HI 1 "gr_register_operand" "r"))
220
            (parallel [(const_int 0) (const_int 2)]))
221
          (vec_select:V2SI
222
            (sign_extend:V4SI
223
              (match_operand:V4HI 2 "gr_register_operand" "r"))
224
            (parallel [(const_int 0) (const_int 2)]))))]
225
  ""
226
  "pmpy2.r %0 = %1, %2"
227
  [(set_attr "itanium_class" "mmshf")])
228
 
229
(define_insn "pmpy2_l"
230
  [(set (match_operand:V2SI 0 "gr_register_operand" "=r")
231
        (mult:V2SI
232
          (vec_select:V2SI
233
            (sign_extend:V4SI
234
              (match_operand:V4HI 1 "gr_register_operand" "r"))
235
            (parallel [(const_int 1) (const_int 3)]))
236
          (vec_select:V2SI
237
            (sign_extend:V4SI
238
              (match_operand:V4HI 2 "gr_register_operand" "r"))
239
            (parallel [(const_int 1) (const_int 3)]))))]
240
  ""
241
  "pmpy2.l %0 = %1, %2"
242
  [(set_attr "itanium_class" "mmshf")])
243
 
244
(define_expand "umax3"
245
  [(set (match_operand:VECINT 0 "gr_register_operand" "")
246
        (umax:VECINT (match_operand:VECINT 1 "gr_register_operand" "")
247
                     (match_operand:VECINT 2 "gr_register_operand" "")))]
248
  ""
249
{
250
  if (ia64_expand_vecint_minmax (UMAX, mode, operands))
251
    DONE;
252
})
253
 
254
(define_expand "smax3"
255
  [(set (match_operand:VECINT 0 "gr_register_operand" "")
256
        (smax:VECINT (match_operand:VECINT 1 "gr_reg_or_0_operand" "")
257
                     (match_operand:VECINT 2 "gr_reg_or_0_operand" "")))]
258
  ""
259
{
260
  if (ia64_expand_vecint_minmax (SMAX, mode, operands))
261
    DONE;
262
})
263
 
264
(define_expand "umin3"
265
  [(set (match_operand:VECINT 0 "gr_register_operand" "")
266
        (umin:VECINT (match_operand:VECINT 1 "gr_register_operand" "")
267
                     (match_operand:VECINT 2 "gr_register_operand" "")))]
268
  ""
269
{
270
  if (ia64_expand_vecint_minmax (UMIN, mode, operands))
271
    DONE;
272
})
273
 
274
(define_expand "smin3"
275
  [(set (match_operand:VECINT 0 "gr_register_operand" "")
276
        (smin:VECINT (match_operand:VECINT 1 "gr_reg_or_0_operand" "")
277
                     (match_operand:VECINT 2 "gr_reg_or_0_operand" "")))]
278
  ""
279
{
280
  if (ia64_expand_vecint_minmax (SMIN, mode, operands))
281
    DONE;
282
})
283
 
284
(define_insn "*umaxv8qi3"
285
  [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
286
        (umax:V8QI (match_operand:V8QI 1 "gr_register_operand" "r")
287
                   (match_operand:V8QI 2 "gr_register_operand" "r")))]
288
  ""
289
  "pmax1.u %0 = %1, %2"
290
  [(set_attr "itanium_class" "mmshf")])
291
 
292
(define_insn "*smaxv4hi3"
293
  [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
294
        (smax:V4HI (match_operand:V4HI 1 "gr_reg_or_0_operand" "rU")
295
                   (match_operand:V4HI 2 "gr_reg_or_0_operand" "rU")))]
296
  ""
297
  "pmax2 %0 = %r1, %r2"
298
  [(set_attr "itanium_class" "mmshf")])
299
 
300
(define_insn "*uminv8qi3"
301
  [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
302
        (umin:V8QI (match_operand:V8QI 1 "gr_register_operand" "r")
303
                   (match_operand:V8QI 2 "gr_register_operand" "r")))]
304
  ""
305
  "pmin1.u %0 = %1, %2"
306
  [(set_attr "itanium_class" "mmshf")])
307
 
308
(define_insn "*sminv4hi3"
309
  [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
310
        (smin:V4HI (match_operand:V4HI 1 "gr_reg_or_0_operand" "rU")
311
                   (match_operand:V4HI 2 "gr_reg_or_0_operand" "rU")))]
312
  ""
313
  "pmin2 %0 = %r1, %r2"
314
  [(set_attr "itanium_class" "mmshf")])
315
 
316
(define_insn "ashl3"
317
  [(set (match_operand:VECINT24 0 "gr_register_operand" "=r")
318
        (ashift:VECINT24
319
          (match_operand:VECINT24 1 "gr_register_operand" "r")
320
          (match_operand:DI 2 "gr_reg_or_5bit_operand" "rn")))]
321
  ""
322
  "pshl %0 = %1, %2"
323
  [(set_attr "itanium_class" "mmshf")])
324
 
325
(define_insn "ashr3"
326
  [(set (match_operand:VECINT24 0 "gr_register_operand" "=r")
327
        (ashiftrt:VECINT24
328
          (match_operand:VECINT24 1 "gr_register_operand" "r")
329
          (match_operand:DI 2 "gr_reg_or_5bit_operand" "rn")))]
330
  ""
331
  "pshr %0 = %1, %2"
332
  [(set_attr "itanium_class" "mmshf")])
333
 
334
(define_insn "lshr3"
335
  [(set (match_operand:VECINT24 0 "gr_register_operand" "=r")
336
        (lshiftrt:VECINT24
337
          (match_operand:VECINT24 1 "gr_register_operand" "r")
338
          (match_operand:DI 2 "gr_reg_or_5bit_operand" "rn")))]
339
  ""
340
  "pshr.u %0 = %1, %2"
341
  [(set_attr "itanium_class" "mmshf")])
342
 
343
(define_expand "vec_shl_"
344
  [(set (match_operand:VECINT 0 "gr_register_operand" "")
345
        (ashift:DI (match_operand:VECINT 1 "gr_register_operand" "")
346
                   (match_operand:DI 2 "gr_reg_or_6bit_operand" "")))]
347
  ""
348
{
349
  operands[0] = gen_lowpart (DImode, operands[0]);
350
  operands[1] = gen_lowpart (DImode, operands[1]);
351
})
352
 
353
(define_expand "vec_shr_"
354
  [(set (match_operand:VECINT 0 "gr_register_operand" "")
355
        (lshiftrt:DI (match_operand:VECINT 1 "gr_register_operand" "")
356
                     (match_operand:DI 2 "gr_reg_or_6bit_operand" "")))]
357
  ""
358
{
359
  operands[0] = gen_lowpart (DImode, operands[0]);
360
  operands[1] = gen_lowpart (DImode, operands[1]);
361
})
362
 
363
(define_expand "widen_usumv8qi3"
364
  [(match_operand:V4HI 0 "gr_register_operand" "")
365
   (match_operand:V8QI 1 "gr_register_operand" "")
366
   (match_operand:V4HI 2 "gr_register_operand" "")]
367
  ""
368
{
369
  ia64_expand_widen_sum (operands, true);
370
  DONE;
371
})
372
 
373
(define_expand "widen_usumv4hi3"
374
  [(match_operand:V2SI 0 "gr_register_operand" "")
375
   (match_operand:V4HI 1 "gr_register_operand" "")
376
   (match_operand:V2SI 2 "gr_register_operand" "")]
377
  ""
378
{
379
  ia64_expand_widen_sum (operands, true);
380
  DONE;
381
})
382
 
383
(define_expand "widen_ssumv8qi3"
384
  [(match_operand:V4HI 0 "gr_register_operand" "")
385
   (match_operand:V8QI 1 "gr_register_operand" "")
386
   (match_operand:V4HI 2 "gr_register_operand" "")]
387
  ""
388
{
389
  ia64_expand_widen_sum (operands, false);
390
  DONE;
391
})
392
 
393
(define_expand "widen_ssumv4hi3"
394
  [(match_operand:V2SI 0 "gr_register_operand" "")
395
   (match_operand:V4HI 1 "gr_register_operand" "")
396
   (match_operand:V2SI 2 "gr_register_operand" "")]
397
  ""
398
{
399
  ia64_expand_widen_sum (operands, false);
400
  DONE;
401
})
402
 
403
(define_expand "udot_prodv8qi"
404
  [(match_operand:V2SI 0 "gr_register_operand" "")
405
   (match_operand:V8QI 1 "gr_register_operand" "")
406
   (match_operand:V8QI 2 "gr_register_operand" "")
407
   (match_operand:V2SI 3 "gr_register_operand" "")]
408
  ""
409
{
410
  ia64_expand_dot_prod_v8qi (operands, true);
411
  DONE;
412
})
413
 
414
(define_expand "sdot_prodv8qi"
415
  [(match_operand:V2SI 0 "gr_register_operand" "")
416
   (match_operand:V8QI 1 "gr_register_operand" "")
417
   (match_operand:V8QI 2 "gr_register_operand" "")
418
   (match_operand:V2SI 3 "gr_register_operand" "")]
419
  ""
420
{
421
  ia64_expand_dot_prod_v8qi (operands, false);
422
  DONE;
423
})
424
 
425
(define_expand "sdot_prodv4hi"
426
  [(match_operand:V2SI 0 "gr_register_operand" "")
427
   (match_operand:V4HI 1 "gr_register_operand" "")
428
   (match_operand:V4HI 2 "gr_register_operand" "")
429
   (match_operand:V2SI 3 "gr_register_operand" "")]
430
  ""
431
{
432
  rtx l, r, t;
433
 
434
  r = gen_reg_rtx (V2SImode);
435
  l = gen_reg_rtx (V2SImode);
436
  t = gen_reg_rtx (V2SImode);
437
 
438
  emit_insn (gen_pmpy2_r (r, operands[1], operands[2]));
439
  emit_insn (gen_pmpy2_l (l, operands[1], operands[2]));
440
  emit_insn (gen_addv2si3 (t, r, operands[3]));
441
  emit_insn (gen_addv2si3 (operands[0], t, l));
442
  DONE;
443
})
444
 
445
(define_expand "vcond"
446
  [(set (match_operand:VECINT 0 "gr_register_operand" "")
447
        (if_then_else:VECINT
448
          (match_operator 3 ""
449
            [(match_operand:VECINT 4 "gr_reg_or_0_operand" "")
450
             (match_operand:VECINT 5 "gr_reg_or_0_operand" "")])
451
          (match_operand:VECINT 1 "gr_reg_or_0_operand" "")
452
          (match_operand:VECINT 2 "gr_reg_or_0_operand" "")))]
453
  ""
454
{
455
  ia64_expand_vecint_cmov (operands);
456
  DONE;
457
})
458
 
459
(define_expand "vcondu"
460
  [(set (match_operand:VECINT 0 "gr_register_operand" "")
461
        (if_then_else:VECINT
462
          (match_operator 3 ""
463
            [(match_operand:VECINT 4 "gr_reg_or_0_operand" "")
464
             (match_operand:VECINT 5 "gr_reg_or_0_operand" "")])
465
          (match_operand:VECINT 1 "gr_reg_or_0_operand" "")
466
          (match_operand:VECINT 2 "gr_reg_or_0_operand" "")))]
467
  ""
468
{
469
  ia64_expand_vecint_cmov (operands);
470
  DONE;
471
})
472
 
473
(define_insn "*cmpeq_"
474
  [(set (match_operand:VECINT 0 "gr_register_operand" "=r")
475
        (eq:VECINT (match_operand:VECINT 1 "gr_reg_or_0_operand" "rU")
476
                   (match_operand:VECINT 2 "gr_reg_or_0_operand" "rU")))]
477
  ""
478
  "pcmp.eq %0 = %r1, %r2"
479
  [(set_attr "itanium_class" "mmalua")])
480
 
481
(define_insn "*cmpgt_"
482
  [(set (match_operand:VECINT 0 "gr_register_operand" "=r")
483
        (gt:VECINT (match_operand:VECINT 1 "gr_reg_or_0_operand" "rU")
484
                   (match_operand:VECINT 2 "gr_reg_or_0_operand" "rU")))]
485
  ""
486
  "pcmp.gt %0 = %r1, %r2"
487
  [(set_attr "itanium_class" "mmalua")])
488
 
489
(define_insn "pack2_sss"
490
  [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
491
        (vec_concat:V8QI
492
          (ss_truncate:V4QI
493
            (match_operand:V4HI 1 "gr_reg_or_0_operand" "rU"))
494
          (ss_truncate:V4QI
495
            (match_operand:V4HI 2 "gr_reg_or_0_operand" "rU"))))]
496
  ""
497
  "pack2.sss %0 = %r1, %r2"
498
  [(set_attr "itanium_class" "mmshf")])
499
 
500
(define_insn "*pack2_uss"
501
  [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
502
        (vec_concat:V8QI
503
          (us_truncate:V4QI
504
            (match_operand:V4HI 1 "gr_reg_or_0_operand" "rU"))
505
          (us_truncate:V4QI
506
            (match_operand:V4HI 2 "gr_reg_or_0_operand" "rU"))))]
507
  ""
508
  "pack2.uss %0 = %r1, %r2"
509
  [(set_attr "itanium_class" "mmshf")])
510
 
511
(define_insn "pack4_sss"
512
  [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
513
        (vec_concat:V4HI
514
          (ss_truncate:V2HI
515
            (match_operand:V2SI 1 "gr_reg_or_0_operand" "rU"))
516
          (ss_truncate:V2HI
517
            (match_operand:V2SI 2 "gr_reg_or_0_operand" "rU"))))]
518
  ""
519
  "pack4.sss %0 = %r1, %r2"
520
  [(set_attr "itanium_class" "mmshf")])
521
 
522
(define_insn "unpack1_l"
523
  [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
524
        (vec_select:V8QI
525
          (vec_concat:V16QI
526
            (match_operand:V8QI 1 "gr_reg_or_0_operand" "rU")
527
            (match_operand:V8QI 2 "gr_reg_or_0_operand" "rU"))
528
          (parallel [(const_int 0)
529
                     (const_int 1)
530
                     (const_int 2)
531
                     (const_int 3)
532
                     (const_int 8)
533
                     (const_int 9)
534
                     (const_int 10)
535
                     (const_int 11)])))]
536
  ""
537
  "unpack1.l %0 = %r2, %r1"
538
  [(set_attr "itanium_class" "mmshf")])
539
 
540
(define_insn "unpack1_h"
541
  [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
542
        (vec_select:V8QI
543
          (vec_concat:V16QI
544
            (match_operand:V8QI 1 "gr_reg_or_0_operand" "rU")
545
            (match_operand:V8QI 2 "gr_reg_or_0_operand" "rU"))
546
          (parallel [(const_int 4)
547
                     (const_int 5)
548
                     (const_int 6)
549
                     (const_int 7)
550
                     (const_int 12)
551
                     (const_int 13)
552
                     (const_int 14)
553
                     (const_int 15)])))]
554
  ""
555
  "unpack1.h %0 = %r2, %r1"
556
  [(set_attr "itanium_class" "mmshf")])
557
 
558
(define_insn "mix1_r"
559
  [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
560
        (vec_select:V8QI
561
          (vec_concat:V16QI
562
            (match_operand:V8QI 1 "gr_reg_or_0_operand" "rU")
563
            (match_operand:V8QI 2 "gr_reg_or_0_operand" "rU"))
564
          (parallel [(const_int 0)
565
                     (const_int 8)
566
                     (const_int 2)
567
                     (const_int 10)
568
                     (const_int 4)
569
                     (const_int 12)
570
                     (const_int 6)
571
                     (const_int 14)])))]
572
  ""
573
  "mix1.r %0 = %r2, %r1"
574
  [(set_attr "itanium_class" "mmshf")])
575
 
576
(define_insn "mix1_l"
577
  [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
578
        (vec_select:V8QI
579
          (vec_concat:V16QI
580
            (match_operand:V8QI 1 "gr_reg_or_0_operand" "rU")
581
            (match_operand:V8QI 2 "gr_reg_or_0_operand" "rU"))
582
          (parallel [(const_int 1)
583
                     (const_int 9)
584
                     (const_int 3)
585
                     (const_int 11)
586
                     (const_int 5)
587
                     (const_int 13)
588
                     (const_int 7)
589
                     (const_int 15)])))]
590
  ""
591
  "mix1.l %0 = %r2, %r1"
592
  [(set_attr "itanium_class" "mmshf")])
593
 
594
(define_insn "*mux1_rev"
595
  [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
596
        (vec_select:V8QI
597
          (match_operand:V8QI 1 "gr_register_operand" "r")
598
          (parallel [(const_int 7)
599
                     (const_int 6)
600
                     (const_int 5)
601
                     (const_int 4)
602
                     (const_int 3)
603
                     (const_int 2)
604
                     (const_int 1)
605
                     (const_int 0)])))]
606
  ""
607
  "mux1 %0 = %1, @rev"
608
  [(set_attr "itanium_class" "mmshf")])
609
 
610
(define_insn "*mux1_mix"
611
  [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
612
        (vec_select:V8QI
613
          (match_operand:V8QI 1 "gr_register_operand" "r")
614
          (parallel [(const_int 0)
615
                     (const_int 4)
616
                     (const_int 2)
617
                     (const_int 6)
618
                     (const_int 1)
619
                     (const_int 5)
620
                     (const_int 3)
621
                     (const_int 7)])))]
622
  ""
623
  "mux1 %0 = %1, @mix"
624
  [(set_attr "itanium_class" "mmshf")])
625
 
626
(define_insn "*mux1_shuf"
627
  [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
628
        (vec_select:V8QI
629
          (match_operand:V8QI 1 "gr_register_operand" "r")
630
          (parallel [(const_int 0)
631
                     (const_int 4)
632
                     (const_int 1)
633
                     (const_int 5)
634
                     (const_int 2)
635
                     (const_int 6)
636
                     (const_int 3)
637
                     (const_int 7)])))]
638
  ""
639
  "mux1 %0 = %1, @shuf"
640
  [(set_attr "itanium_class" "mmshf")])
641
 
642
(define_insn "*mux1_alt"
643
  [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
644
        (vec_select:V8QI
645
          (match_operand:V8QI 1 "gr_register_operand" "r")
646
          (parallel [(const_int 0)
647
                     (const_int 2)
648
                     (const_int 4)
649
                     (const_int 6)
650
                     (const_int 1)
651
                     (const_int 3)
652
                     (const_int 5)
653
                     (const_int 7)])))]
654
  ""
655
  "mux1 %0 = %1, @alt"
656
  [(set_attr "itanium_class" "mmshf")])
657
 
658
(define_insn "*mux1_brcst_v8qi"
659
  [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
660
        (vec_select:V8QI
661
          (match_operand:V8QI 1 "gr_register_operand" "r")
662
          (parallel [(const_int 0)
663
                     (const_int 0)
664
                     (const_int 0)
665
                     (const_int 0)
666
                     (const_int 0)
667
                     (const_int 0)
668
                     (const_int 0)
669
                     (const_int 0)])))]
670
  ""
671
  "mux1 %0 = %1, @brcst"
672
  [(set_attr "itanium_class" "mmshf")])
673
 
674
(define_insn "*mux1_brcst_qi"
675
  [(set (match_operand:V8QI 0 "gr_register_operand" "=r")
676
        (vec_duplicate:V8QI
677
          (match_operand:QI 1 "gr_register_operand" "r")))]
678
  ""
679
  "mux1 %0 = %1, @brcst"
680
  [(set_attr "itanium_class" "mmshf")])
681
 
682
(define_insn "unpack2_l"
683
  [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
684
        (vec_select:V4HI
685
          (vec_concat:V8HI
686
            (match_operand:V4HI 1 "gr_reg_or_0_operand" "rU")
687
            (match_operand:V4HI 2 "gr_reg_or_0_operand" "rU"))
688
          (parallel [(const_int 0)
689
                     (const_int 4)
690
                     (const_int 1)
691
                     (const_int 5)])))]
692
  ""
693
  "unpack2.l %0 = %r2, %r1"
694
  [(set_attr "itanium_class" "mmshf")])
695
 
696
(define_insn "unpack2_h"
697
  [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
698
        (vec_select:V4HI
699
          (vec_concat:V8HI
700
            (match_operand:V4HI 1 "gr_reg_or_0_operand" "rU")
701
            (match_operand:V4HI 2 "gr_reg_or_0_operand" "rU"))
702
          (parallel [(const_int 2)
703
                     (const_int 6)
704
                     (const_int 3)
705
                     (const_int 7)])))]
706
  ""
707
  "unpack2.h %0 = %r2, %r1"
708
  [(set_attr "itanium_class" "mmshf")])
709
 
710
(define_insn "*mix2_r"
711
  [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
712
        (vec_select:V4HI
713
          (vec_concat:V8HI
714
            (match_operand:V4HI 1 "gr_reg_or_0_operand" "rU")
715
            (match_operand:V4HI 2 "gr_reg_or_0_operand" "rU"))
716
          (parallel [(const_int 0)
717
                     (const_int 4)
718
                     (const_int 2)
719
                     (const_int 6)])))]
720
  ""
721
  "mix2.r %0 = %r2, %r1"
722
  [(set_attr "itanium_class" "mmshf")])
723
 
724
(define_insn "*mix2_l"
725
  [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
726
        (vec_select:V4HI
727
          (vec_concat:V8HI
728
            (match_operand:V4HI 1 "gr_reg_or_0_operand" "rU")
729
            (match_operand:V4HI 2 "gr_reg_or_0_operand" "rU"))
730
          (parallel [(const_int 1)
731
                     (const_int 5)
732
                     (const_int 3)
733
                     (const_int 7)])))]
734
  ""
735
  "mix2.l %0 = %r2, %r1"
736
  [(set_attr "itanium_class" "mmshf")])
737
 
738
(define_insn "*mux2"
739
  [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
740
        (vec_select:V4HI
741
          (match_operand:V4HI 1 "gr_register_operand" "r")
742
          (parallel [(match_operand 2 "const_int_2bit_operand" "")
743
                     (match_operand 3 "const_int_2bit_operand" "")
744
                     (match_operand 4 "const_int_2bit_operand" "")
745
                     (match_operand 5 "const_int_2bit_operand" "")])))]
746
  ""
747
{
748
  int mask;
749
  mask  = INTVAL (operands[2]);
750
  mask |= INTVAL (operands[3]) << 2;
751
  mask |= INTVAL (operands[4]) << 4;
752
  mask |= INTVAL (operands[5]) << 6;
753
  operands[2] = GEN_INT (mask);
754
  return "%,mux2 %0 = %1, %2";
755
}
756
  [(set_attr "itanium_class" "mmshf")])
757
 
758
(define_insn "*mux2_brcst_hi"
759
  [(set (match_operand:V4HI 0 "gr_register_operand" "=r")
760
        (vec_duplicate:V4HI
761
          (match_operand:HI 1 "gr_register_operand" "r")))]
762
  ""
763
  "mux2 %0 = %1, 0"
764
  [(set_attr "itanium_class" "mmshf")])
765
 
766
;; Note that mix4.r performs the exact same operation.
767
(define_insn "*unpack4_l"
768
  [(set (match_operand:V2SI 0 "gr_register_operand" "=r")
769
        (vec_select:V2SI
770
          (vec_concat:V4SI
771
            (match_operand:V2SI 1 "gr_reg_or_0_operand" "rU")
772
            (match_operand:V2SI 2 "gr_reg_or_0_operand" "rU"))
773
          (parallel [(const_int 0)
774
                     (const_int 2)])))]
775
  ""
776
  "unpack4.l %0 = %r2, %r1"
777
  [(set_attr "itanium_class" "mmshf")])
778
 
779
;; Note that mix4.l performs the exact same operation.
780
(define_insn "*unpack4_h"
781
  [(set (match_operand:V2SI 0 "gr_register_operand" "=r")
782
        (vec_select:V2SI
783
          (vec_concat:V4SI
784
            (match_operand:V2SI 1 "gr_reg_or_0_operand" "rU")
785
            (match_operand:V2SI 2 "gr_reg_or_0_operand" "rU"))
786
          (parallel [(const_int 1)
787
                     (const_int 3)])))]
788
  ""
789
  "unpack4.h %0 = %r2, %r1"
790
  [(set_attr "itanium_class" "mmshf")])
791
 
792
(define_expand "vec_initv2si"
793
  [(match_operand:V2SI 0 "gr_register_operand" "")
794
   (match_operand 1 "" "")]
795
  ""
796
{
797
  rtx op1 = XVECEXP (operands[1], 0, 0);
798
  rtx op2 = XVECEXP (operands[1], 0, 1);
799
  rtx x;
800
 
801
  if (GET_CODE (op1) == CONST_INT && GET_CODE (op2) == CONST_INT)
802
    {
803
      rtvec v = rtvec_alloc (2);
804
      RTVEC_ELT (v, 0) = TARGET_BIG_ENDIAN ? op2 : op1;
805
      RTVEC_ELT (v, 1) = TARGET_BIG_ENDIAN ? op1 : op2;;
806
      x = gen_rtx_CONST_VECTOR (V2SImode, v);
807
      emit_move_insn (operands[0], x);
808
      DONE;
809
    }
810
 
811
  if (!gr_reg_or_0_operand (op1, SImode))
812
    op1 = force_reg (SImode, op1);
813
  if (!gr_reg_or_0_operand (op2, SImode))
814
    op2 = force_reg (SImode, op2);
815
 
816
  if (TARGET_BIG_ENDIAN)
817
    x = gen_rtx_VEC_CONCAT (V2SImode, op2, op1);
818
  else
819
    x = gen_rtx_VEC_CONCAT (V2SImode, op1, op2);
820
  emit_insn (gen_rtx_SET (VOIDmode, operands[0], x));
821
  DONE;
822
})
823
 
824
(define_insn "*vecinit_v2si"
825
  [(set (match_operand:V2SI 0 "gr_register_operand" "=r")
826
        (vec_concat:V2SI
827
          (match_operand:SI 1 "gr_reg_or_0_operand" "rO")
828
          (match_operand:SI 2 "gr_reg_or_0_operand" "rO")))]
829
  ""
830
  "unpack4.l %0 = %r2, %r1"
831
  [(set_attr "itanium_class" "mmshf")])
832
 
833
;; Missing operations
834
;; padd.uus
835
;; pavg
836
;; pavgsub
837
;; pmpyshr, general form
838
;; psad
839
;; pshladd
840
;; pshradd
841
;; psub.uus
842
 
843
;; Floating point vector operations
844
 
845
(define_expand "movv2sf"
846
  [(set (match_operand:V2SF 0 "general_operand" "")
847
        (match_operand:V2SF 1 "general_operand" ""))]
848
  ""
849
{
850
  rtx op1 = ia64_expand_move (operands[0], operands[1]);
851
  if (!op1)
852
    DONE;
853
  operands[1] = op1;
854
})
855
 
856
(define_insn "*movv2sf_internal"
857
  [(set (match_operand:V2SF 0 "destination_operand"
858
                                        "=f,f,f,Q,*r ,*r,*r,*r,m ,f ,*r")
859
        (match_operand:V2SF 1 "move_operand"
860
                                        "fU,Y,Q,f,U*r,W ,i ,m ,*r,*r,f "))]
861
  "ia64_move_ok (operands[0], operands[1])"
862
{
863
  static const char * const alt[] = {
864
    "%,mov %0 = %F1",
865
    "%,fpack %0 = %F2, %F1",
866
    "%,ldf8 %0 = %1%P1",
867
    "%,stf8 %0 = %1%P0",
868
    "%,mov %0 = %r1",
869
    "%,addl %0 = %v1, r0",
870
    "%,movl %0 = %v1",
871
    "%,ld8%O1 %0 = %1%P1",
872
    "%,st8%Q0 %0 = %r1%P0",
873
    "%,setf.sig %0 = %1",
874
    "%,getf.sig %0 = %1"
875
  };
876
 
877
  if (which_alternative == 1)
878
    {
879
      operands[2] = XVECEXP (operands[1], 0, 1);
880
      operands[1] = XVECEXP (operands[1], 0, 0);
881
    }
882
 
883
  return alt[which_alternative];
884
}
885
  [(set_attr "itanium_class" "fmisc,fmisc,fld,stf,ialu,ialu,long_i,ld,st,tofr,frfr")])
886
 
887
(define_insn "absv2sf2"
888
  [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
889
        (abs:V2SF (match_operand:V2SF 1 "fr_register_operand" "f")))]
890
  ""
891
  "fpabs %0 = %1"
892
  [(set_attr "itanium_class" "fmisc")])
893
 
894
(define_insn "negv2sf2"
895
  [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
896
        (neg:V2SF (match_operand:V2SF 1 "fr_register_operand" "f")))]
897
  ""
898
  "fpneg %0 = %1"
899
  [(set_attr "itanium_class" "fmisc")])
900
 
901
(define_insn "*negabsv2sf2"
902
  [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
903
        (neg:V2SF
904
          (abs:V2SF (match_operand:V2SF 1 "fr_register_operand" "f"))))]
905
  ""
906
  "fpnegabs %0 = %1"
907
  [(set_attr "itanium_class" "fmisc")])
908
 
909
;; In order to convince combine to merge plus and mult to a useful fpma,
910
;; we need a couple of extra patterns.
911
(define_expand "addv2sf3"
912
  [(parallel
913
    [(set (match_operand:V2SF 0 "fr_register_operand" "")
914
          (plus:V2SF (match_operand:V2SF 1 "fr_register_operand" "")
915
                     (match_operand:V2SF 2 "fr_register_operand" "")))
916
     (use (match_dup 3))])]
917
  ""
918
{
919
  rtvec v = gen_rtvec (2, CONST1_RTX (SFmode), CONST1_RTX (SFmode));
920
  operands[3] = force_reg (V2SFmode, gen_rtx_CONST_VECTOR (V2SFmode, v));
921
})
922
 
923
;; The split condition here could be combine_completed, if we had such.
924
(define_insn_and_split "*addv2sf3_1"
925
  [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
926
        (plus:V2SF (match_operand:V2SF 1 "fr_register_operand" "f")
927
                   (match_operand:V2SF 2 "fr_register_operand" "f")))
928
   (use (match_operand:V2SF 3 "fr_register_operand" "f"))]
929
  ""
930
  "#"
931
  "reload_completed"
932
  [(set (match_dup 0)
933
        (plus:V2SF
934
          (mult:V2SF (match_dup 1) (match_dup 3))
935
          (match_dup 2)))]
936
  "")
937
 
938
(define_insn_and_split "*addv2sf3_2"
939
  [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
940
        (plus:V2SF
941
          (mult:V2SF (match_operand:V2SF 1 "fr_register_operand" "f")
942
                     (match_operand:V2SF 2 "fr_register_operand" "f"))
943
          (match_operand:V2SF 3 "fr_register_operand" "f")))
944
    (use (match_operand:V2SF 4 "" "X"))]
945
  ""
946
  "#"
947
  ""
948
  [(set (match_dup 0)
949
        (plus:V2SF
950
          (mult:V2SF (match_dup 1) (match_dup 2))
951
          (match_dup 3)))]
952
  "")
953
 
954
;; In order to convince combine to merge minus and mult to a useful fpms,
955
;; we need a couple of extra patterns.
956
(define_expand "subv2sf3"
957
  [(parallel
958
    [(set (match_operand:V2SF 0 "fr_register_operand" "")
959
          (minus:V2SF (match_operand:V2SF 1 "fr_register_operand" "")
960
                      (match_operand:V2SF 2 "fr_register_operand" "")))
961
     (use (match_dup 3))])]
962
  ""
963
{
964
  rtvec v = gen_rtvec (2, CONST1_RTX (SFmode), CONST1_RTX (SFmode));
965
  operands[3] = force_reg (V2SFmode, gen_rtx_CONST_VECTOR (V2SFmode, v));
966
})
967
 
968
;; The split condition here could be combine_completed, if we had such.
969
(define_insn_and_split "*subv2sf3_1"
970
  [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
971
        (minus:V2SF (match_operand:V2SF 1 "fr_register_operand" "f")
972
                    (match_operand:V2SF 2 "fr_register_operand" "f")))
973
   (use (match_operand:V2SF 3 "fr_register_operand" "f"))]
974
  ""
975
  "#"
976
  "reload_completed"
977
  [(set (match_dup 0)
978
        (minus:V2SF
979
          (mult:V2SF (match_dup 1) (match_dup 3))
980
          (match_dup 2)))]
981
  "")
982
 
983
(define_insn_and_split "*subv2sf3_2"
984
  [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
985
        (minus:V2SF
986
          (mult:V2SF (match_operand:V2SF 1 "fr_register_operand" "f")
987
                     (match_operand:V2SF 2 "fr_register_operand" "f"))
988
          (match_operand:V2SF 3 "fr_register_operand" "f")))
989
    (use (match_operand:V2SF 4 "" "X"))]
990
  ""
991
  "#"
992
  ""
993
  [(set (match_dup 0)
994
        (minus:V2SF
995
          (mult:V2SF (match_dup 1) (match_dup 2))
996
          (match_dup 3)))]
997
  "")
998
 
999
(define_insn "mulv2sf3"
1000
  [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1001
        (mult:V2SF (match_operand:V2SF 1 "fr_register_operand" "f")
1002
                   (match_operand:V2SF 2 "fr_register_operand" "f")))]
1003
  ""
1004
  "fpmpy %0 = %1, %2"
1005
  [(set_attr "itanium_class" "fmac")])
1006
 
1007
(define_insn "*fpma"
1008
  [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1009
        (plus:V2SF
1010
          (mult:V2SF (match_operand:V2SF 1 "fr_register_operand" "f")
1011
                     (match_operand:V2SF 2 "fr_register_operand" "f"))
1012
          (match_operand:V2SF 3 "fr_register_operand" "f")))]
1013
  ""
1014
  "fpma %0 = %1, %2, %3"
1015
  [(set_attr "itanium_class" "fmac")])
1016
 
1017
(define_insn "*fpms"
1018
  [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1019
        (minus:V2SF
1020
          (mult:V2SF (match_operand:V2SF 1 "fr_register_operand" "f")
1021
                     (match_operand:V2SF 2 "fr_register_operand" "f"))
1022
          (match_operand:V2SF 3 "fr_register_operand" "f")))]
1023
  ""
1024
  "fpms %0 = %1, %2, %3"
1025
  [(set_attr "itanium_class" "fmac")])
1026
 
1027
(define_insn "*fpnmpy"
1028
  [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1029
        (neg:V2SF
1030
          (mult:V2SF (match_operand:V2SF 1 "fr_register_operand" "f")
1031
                     (match_operand:V2SF 2 "fr_register_operand" "f"))))]
1032
  ""
1033
  "fpnmpy %0 = %1, %2"
1034
  [(set_attr "itanium_class" "fmac")])
1035
 
1036
(define_insn "*fpnma"
1037
  [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1038
        (plus:V2SF
1039
          (neg:V2SF
1040
            (mult:V2SF (match_operand:V2SF 1 "fr_register_operand" "f")
1041
                       (match_operand:V2SF 2 "fr_register_operand" "f")))
1042
          (match_operand:V2SF 3 "fr_register_operand" "f")))]
1043
  ""
1044
  "fpnma %0 = %1, %2, %3"
1045
  [(set_attr "itanium_class" "fmac")])
1046
 
1047
(define_insn "smaxv2sf3"
1048
  [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1049
        (smax:V2SF (match_operand:V2SF 1 "fr_register_operand" "f")
1050
                   (match_operand:V2SF 2 "fr_register_operand" "f")))]
1051
  ""
1052
  "fpmax %0 = %1, %2"
1053
  [(set_attr "itanium_class" "fmisc")])
1054
 
1055
(define_insn "sminv2sf3"
1056
  [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1057
        (smin:V2SF (match_operand:V2SF 1 "fr_register_operand" "f")
1058
                   (match_operand:V2SF 2 "fr_register_operand" "f")))]
1059
  ""
1060
  "fpmin %0 = %1, %2"
1061
  [(set_attr "itanium_class" "fmisc")])
1062
 
1063
(define_expand "reduc_splus_v2sf"
1064
  [(match_operand:V2SF 0 "fr_register_operand" "")
1065
   (match_operand:V2SF 1 "fr_register_operand" "")]
1066
  ""
1067
{
1068
  rtx tmp = gen_reg_rtx (V2SFmode);
1069
  emit_insn (gen_fswap (tmp, operands[1], CONST0_RTX (V2SFmode)));
1070
  emit_insn (gen_addv2sf3 (operands[0], operands[1], tmp));
1071
  DONE;
1072
})
1073
 
1074
(define_expand "reduc_smax_v2sf"
1075
  [(match_operand:V2SF 0 "fr_register_operand" "")
1076
   (match_operand:V2SF 1 "fr_register_operand" "")]
1077
  ""
1078
{
1079
  rtx tmp = gen_reg_rtx (V2SFmode);
1080
  emit_insn (gen_fswap (tmp, operands[1], CONST0_RTX (V2SFmode)));
1081
  emit_insn (gen_smaxv2sf3 (operands[0], operands[1], tmp));
1082
  DONE;
1083
})
1084
 
1085
(define_expand "reduc_smin_v2sf"
1086
  [(match_operand:V2SF 0 "fr_register_operand" "")
1087
   (match_operand:V2SF 1 "fr_register_operand" "")]
1088
  ""
1089
{
1090
  rtx tmp = gen_reg_rtx (V2SFmode);
1091
  emit_insn (gen_fswap (tmp, operands[1], CONST0_RTX (V2SFmode)));
1092
  emit_insn (gen_sminv2sf3 (operands[0], operands[1], tmp));
1093
  DONE;
1094
})
1095
 
1096
(define_expand "vcondv2sf"
1097
  [(set (match_operand:V2SF 0 "fr_register_operand" "")
1098
        (if_then_else:V2SF
1099
          (match_operator 3 ""
1100
            [(match_operand:V2SF 4 "fr_reg_or_0_operand" "")
1101
             (match_operand:V2SF 5 "fr_reg_or_0_operand" "")])
1102
          (match_operand:V2SF 1 "fr_reg_or_0_operand" "")
1103
          (match_operand:V2SF 2 "fr_reg_or_0_operand" "")))]
1104
  ""
1105
{
1106
  rtx x, cmp;
1107
 
1108
  cmp = gen_reg_rtx (V2SFmode);
1109
  PUT_MODE (operands[3], V2SFmode);
1110
  emit_insn (gen_rtx_SET (VOIDmode, cmp, operands[3]));
1111
 
1112
  x = gen_rtx_IF_THEN_ELSE (V2SFmode, cmp, operands[1], operands[2]);
1113
  emit_insn (gen_rtx_SET (VOIDmode, operands[0], x));
1114
  DONE;
1115
})
1116
 
1117
(define_insn "*fpcmp"
1118
  [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1119
        (match_operator:V2SF 3 "comparison_operator"
1120
          [(match_operand:V2SF 1 "fr_reg_or_0_operand" "fU")
1121
           (match_operand:V2SF 2 "fr_reg_or_0_operand" "fU")]))]
1122
  ""
1123
  "fpcmp.%D3 %0 = %F1, %F2"
1124
  [(set_attr "itanium_class" "fmisc")])
1125
 
1126
(define_insn "*fselect"
1127
  [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1128
        (if_then_else:V2SF
1129
          (match_operand:V2SF 1 "fr_register_operand" "f")
1130
          (match_operand:V2SF 2 "fr_reg_or_0_operand" "fU")
1131
          (match_operand:V2SF 3 "fr_reg_or_0_operand" "fU")))]
1132
  ""
1133
  "fselect %0 = %F2, %F3, %1"
1134
  [(set_attr "itanium_class" "fmisc")])
1135
 
1136
(define_expand "vec_initv2sf"
1137
  [(match_operand:V2SF 0 "fr_register_operand" "")
1138
   (match_operand 1 "" "")]
1139
  ""
1140
{
1141
  rtx op1 = XVECEXP (operands[1], 0, 0);
1142
  rtx op2 = XVECEXP (operands[1], 0, 1);
1143
  rtx x;
1144
 
1145
  if (GET_CODE (op1) == CONST_DOUBLE && GET_CODE (op2) == CONST_DOUBLE)
1146
    {
1147
      x = gen_rtx_CONST_VECTOR (V2SFmode, XVEC (operands[1], 0));
1148
      emit_move_insn (operands[0], x);
1149
      DONE;
1150
    }
1151
 
1152
  if (!fr_reg_or_fp01_operand (op1, SFmode))
1153
    op1 = force_reg (SFmode, op1);
1154
  if (!fr_reg_or_fp01_operand (op2, SFmode))
1155
    op2 = force_reg (SFmode, op2);
1156
 
1157
  if (TARGET_BIG_ENDIAN)
1158
    emit_insn (gen_fpack (operands[0], op2, op1));
1159
  else
1160
    emit_insn (gen_fpack (operands[0], op1, op2));
1161
  DONE;
1162
})
1163
 
1164
(define_insn "fpack"
1165
  [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1166
        (vec_concat:V2SF
1167
          (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
1168
          (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
1169
  ""
1170
  "fpack %0 = %F2, %F1"
1171
  [(set_attr "itanium_class" "fmisc")])
1172
 
1173
(define_insn "fswap"
1174
  [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1175
        (vec_select:V2SF
1176
          (vec_concat:V4SF
1177
            (match_operand:V2SF 1 "fr_reg_or_0_operand" "fU")
1178
            (match_operand:V2SF 2 "fr_reg_or_0_operand" "fU"))
1179
          (parallel [(const_int 1) (const_int 2)])))]
1180
  ""
1181
  "fswap %0 = %F1, %F2"
1182
  [(set_attr "itanium_class" "fmisc")])
1183
 
1184
(define_insn "*fmix_l"
1185
  [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1186
        (vec_select:V2SF
1187
          (vec_concat:V4SF
1188
            (match_operand:V2SF 1 "fr_reg_or_0_operand" "fU")
1189
            (match_operand:V2SF 2 "fr_reg_or_0_operand" "fU"))
1190
          (parallel [(const_int 1) (const_int 3)])))]
1191
  ""
1192
  "fmix.l %0 = %F2, %F1"
1193
  [(set_attr "itanium_class" "fmisc")])
1194
 
1195
(define_insn "fmix_r"
1196
  [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1197
        (vec_select:V2SF
1198
          (vec_concat:V4SF
1199
            (match_operand:V2SF 1 "fr_reg_or_0_operand" "fU")
1200
            (match_operand:V2SF 2 "fr_reg_or_0_operand" "fU"))
1201
          (parallel [(const_int 0) (const_int 2)])))]
1202
  ""
1203
  "fmix.r %0 = %F2, %F1"
1204
  [(set_attr "itanium_class" "fmisc")])
1205
 
1206
(define_insn "fmix_lr"
1207
  [(set (match_operand:V2SF 0 "fr_register_operand" "=f")
1208
        (vec_select:V2SF
1209
          (vec_concat:V4SF
1210
            (match_operand:V2SF 1 "fr_reg_or_0_operand" "fU")
1211
            (match_operand:V2SF 2 "fr_reg_or_0_operand" "fU"))
1212
          (parallel [(const_int 0) (const_int 3)])))]
1213
  ""
1214
  "fmix.lr %0 = %F2, %F1"
1215
  [(set_attr "itanium_class" "fmisc")])
1216
 
1217
(define_expand "vec_setv2sf"
1218
  [(match_operand:V2SF 0 "fr_register_operand" "")
1219
   (match_operand:SF 1 "fr_register_operand" "")
1220
   (match_operand 2 "const_int_operand" "")]
1221
  ""
1222
{
1223
  rtx tmp = gen_reg_rtx (V2SFmode);
1224
  emit_insn (gen_fpack (tmp, operands[1], CONST0_RTX (SFmode)));
1225
 
1226
  switch (INTVAL (operands[2]))
1227
    {
1228
    case 0:
1229
      emit_insn (gen_fmix_lr (operands[0], tmp, operands[0]));
1230
      break;
1231
    case 1:
1232
      emit_insn (gen_fmix_r (operands[0], operands[0], tmp));
1233
      break;
1234
    default:
1235
      gcc_unreachable ();
1236
    }
1237
  DONE;
1238
})
1239
 
1240
(define_insn_and_split "*vec_extractv2sf_0_le"
1241
  [(set (match_operand:SF 0 "nonimmediate_operand" "=r,f,m")
1242
        (unspec:SF [(match_operand:V2SF 1 "nonimmediate_operand" "rfm,rm,r")
1243
                    (const_int 0)]
1244
                   UNSPEC_VECT_EXTR))]
1245
  "!TARGET_BIG_ENDIAN"
1246
  "#"
1247
  "reload_completed"
1248
  [(set (match_dup 0) (match_dup 1))]
1249
{
1250
  if (REG_P (operands[1]) && FR_REGNO_P (REGNO (operands[1])))
1251
    operands[0] = gen_rtx_REG (V2SFmode, REGNO (operands[0]));
1252
  else if (MEM_P (operands[1]))
1253
    operands[1] = adjust_address (operands[1], SFmode, 0);
1254
  else
1255
    operands[1] = gen_rtx_REG (SFmode, REGNO (operands[1]));
1256
})
1257
 
1258
(define_insn_and_split "*vec_extractv2sf_0_be"
1259
  [(set (match_operand:SF 0 "register_operand" "=r,f")
1260
        (unspec:SF [(match_operand:V2SF 1 "register_operand" "rf,r")
1261
                    (const_int 0)]
1262
                   UNSPEC_VECT_EXTR))]
1263
  "TARGET_BIG_ENDIAN"
1264
  "#"
1265
  "reload_completed"
1266
  [(set (match_dup 0) (match_dup 1))]
1267
{
1268
  if (REG_P (operands[1]) && FR_REGNO_P (REGNO (operands[1])))
1269
    operands[0] = gen_rtx_REG (V2SFmode, REGNO (operands[0]));
1270
  else
1271
    operands[1] = gen_rtx_REG (SFmode, REGNO (operands[1]));
1272
})
1273
 
1274
(define_insn_and_split "*vec_extractv2sf_1"
1275
  [(set (match_operand:SF 0 "register_operand" "=r")
1276
        (unspec:SF [(match_operand:V2SF 1 "register_operand" "r")
1277
                    (const_int 1)]
1278
                   UNSPEC_VECT_EXTR))]
1279
  ""
1280
  "#"
1281
  "reload_completed"
1282
  [(const_int 0)]
1283
{
1284
  operands[0] = gen_rtx_REG (DImode, REGNO (operands[0]));
1285
  operands[1] = gen_rtx_REG (DImode, REGNO (operands[1]));
1286
  if (TARGET_BIG_ENDIAN)
1287
    emit_move_insn (operands[0], operands[1]);
1288
  else
1289
    emit_insn (gen_lshrdi3 (operands[0], operands[1], GEN_INT (32)));
1290
  DONE;
1291
})
1292
 
1293
(define_expand "vec_extractv2sf"
1294
  [(set (match_operand:SF 0 "register_operand" "")
1295
        (unspec:SF [(match_operand:V2SF 1 "register_operand" "")
1296
                    (match_operand:DI 2 "const_int_operand" "")]
1297
                   UNSPEC_VECT_EXTR))]
1298
  ""
1299
  "")
1300
 
1301
;; Missing operations
1302
;; fprcpa
1303
;; fpsqrta

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.