annotate gcc/config/mips/loongson.md @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1 ;; Machine description for Loongson-specific patterns, such as
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
2 ;; ST Microelectronics Loongson-2E/2F etc.
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
3 ;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 ;; Contributed by CodeSourcery.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 ;; This file is part of GCC.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 ;;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 ;; GCC is free software; you can redistribute it and/or modify
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 ;; it under the terms of the GNU General Public License as published by
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 ;; the Free Software Foundation; either version 3, or (at your option)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 ;; any later version.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 ;; GCC is distributed in the hope that it will be useful,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 ;; GNU General Public License for more details.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 ;; You should have received a copy of the GNU General Public License
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 ;; along with GCC; see the file COPYING3. If not see
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 ;; <http://www.gnu.org/licenses/>.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
22 (define_c_enum "unspec" [
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
23 UNSPEC_LOONGSON_PAVG
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
24 UNSPEC_LOONGSON_PCMPEQ
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
25 UNSPEC_LOONGSON_PCMPGT
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
26 UNSPEC_LOONGSON_PEXTR
111
kono
parents: 67
diff changeset
27 UNSPEC_LOONGSON_PINSRH
kono
parents: 67
diff changeset
28 UNSPEC_LOONGSON_VINIT
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
29 UNSPEC_LOONGSON_PMADD
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
30 UNSPEC_LOONGSON_PMOVMSK
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
31 UNSPEC_LOONGSON_PMULHU
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
32 UNSPEC_LOONGSON_PMULH
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
33 UNSPEC_LOONGSON_PMULU
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
34 UNSPEC_LOONGSON_PASUBUB
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
35 UNSPEC_LOONGSON_BIADD
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
36 UNSPEC_LOONGSON_PSADBH
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
37 UNSPEC_LOONGSON_PSHUFH
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
38 UNSPEC_LOONGSON_PUNPCKH
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
39 UNSPEC_LOONGSON_PUNPCKL
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
40 UNSPEC_LOONGSON_PADDD
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
41 UNSPEC_LOONGSON_PSUBD
111
kono
parents: 67
diff changeset
42 UNSPEC_LOONGSON_DSLL
kono
parents: 67
diff changeset
43 UNSPEC_LOONGSON_DSRL
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
44 ])
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
45
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 ;; Mode iterators and attributes.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 ;; 64-bit vectors of bytes.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 (define_mode_iterator VB [V8QI])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 ;; 64-bit vectors of halfwords.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 (define_mode_iterator VH [V4HI])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 ;; 64-bit vectors of words.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 (define_mode_iterator VW [V2SI])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
56
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 ;; 64-bit vectors of halfwords and bytes.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 (define_mode_iterator VHB [V4HI V8QI])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
59
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 ;; 64-bit vectors of words and halfwords.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 (define_mode_iterator VWH [V2SI V4HI])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
62
111
kono
parents: 67
diff changeset
63 ;; 64-bit vectors of words and bytes
kono
parents: 67
diff changeset
64 (define_mode_iterator VWB [V2SI V8QI])
kono
parents: 67
diff changeset
65
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 ;; 64-bit vectors of words, halfwords and bytes.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 (define_mode_iterator VWHB [V2SI V4HI V8QI])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
68
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 ;; 64-bit vectors of words, halfwords and bytes; and DImode.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 (define_mode_iterator VWHBDI [V2SI V4HI V8QI DI])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
71
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
72 ;; The Loongson instruction suffixes corresponding to the modes in the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 ;; VWHBDI iterator.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 (define_mode_attr V_suffix [(V2SI "w") (V4HI "h") (V8QI "b") (DI "d")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
75
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 ;; Given a vector type T, the mode of a vector half the size of T
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 ;; and with the same number of elements.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 (define_mode_attr V_squash [(V2SI "V2HI") (V4HI "V4QI")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
79
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 ;; Given a vector type T, the mode of a vector the same size as T
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 ;; but with half as many elements.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 (define_mode_attr V_stretch_half [(V2SI "DI") (V4HI "V2SI") (V8QI "V4HI")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
83
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 ;; The Loongson instruction suffixes corresponding to the transformation
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 ;; expressed by V_stretch_half.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 (define_mode_attr V_stretch_half_suffix [(V2SI "wd") (V4HI "hw") (V8QI "bh")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
87
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 ;; Given a vector type T, the mode of a vector the same size as T
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 ;; but with twice as many elements.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 (define_mode_attr V_squash_double [(V2SI "V4HI") (V4HI "V8QI")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
91
111
kono
parents: 67
diff changeset
92 ;; Given a vector type T, the inner mode.
kono
parents: 67
diff changeset
93 (define_mode_attr V_inner [(V8QI "QI") (V4HI "HI") (V2SI "SI")])
kono
parents: 67
diff changeset
94
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 ;; The Loongson instruction suffixes corresponding to the conversions
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
96 ;; specified by V_half_width.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 (define_mode_attr V_squash_double_suffix [(V2SI "wh") (V4HI "hb")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
98
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
99 ;; Move patterns.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
100
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 ;; Expander to legitimize moves involving values of vector modes.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
102 (define_expand "mov<mode>"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
103 [(set (match_operand:VWHB 0)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
104 (match_operand:VWHB 1))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
105 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
107 if (mips_legitimize_move (<MODE>mode, operands[0], operands[1]))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
108 DONE;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
109 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
110
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
111 ;; Handle legitimized moves between values of vector modes.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
112 (define_insn "mov<mode>_internal"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
113 [(set (match_operand:VWHB 0 "nonimmediate_operand" "=m,f,d,f, d, m, d")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
114 (match_operand:VWHB 1 "move_operand" "f,m,f,dYG,dYG,dYG,m"))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
115 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
116 { return mips_output_move (operands[0], operands[1]); }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
117 [(set_attr "move_type" "fpstore,fpload,mfc,mtc,move,store,load")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
118 (set_attr "mode" "DI")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
119
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
120 ;; Initialization of a vector.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
121
111
kono
parents: 67
diff changeset
122 (define_expand "vec_init<mode><unitmode>"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 [(set (match_operand:VWHB 0 "register_operand")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
124 (match_operand 1 ""))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
125 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
126 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
127 mips_expand_vector_init (operands[0], operands[1]);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
128 DONE;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
129 })
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
130
111
kono
parents: 67
diff changeset
131 ;; Helper for vec_init. Initialize element 0 of the output from the input.
kono
parents: 67
diff changeset
132 ;; All other elements are undefined.
kono
parents: 67
diff changeset
133 (define_insn "loongson_vec_init1_<mode>"
kono
parents: 67
diff changeset
134 [(set (match_operand:VHB 0 "register_operand" "=f")
kono
parents: 67
diff changeset
135 (unspec:VHB [(truncate:<V_inner>
kono
parents: 67
diff changeset
136 (match_operand:DI 1 "reg_or_0_operand" "Jd"))]
kono
parents: 67
diff changeset
137 UNSPEC_LOONGSON_VINIT))]
kono
parents: 67
diff changeset
138 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
139 "dmtc1\t%z1,%0"
kono
parents: 67
diff changeset
140 [(set_attr "move_type" "mtc")
kono
parents: 67
diff changeset
141 (set_attr "mode" "DI")])
kono
parents: 67
diff changeset
142
kono
parents: 67
diff changeset
143 ;; Helper for vec_initv2si.
kono
parents: 67
diff changeset
144 (define_insn "*vec_concatv2si"
kono
parents: 67
diff changeset
145 [(set (match_operand:V2SI 0 "register_operand" "=f")
kono
parents: 67
diff changeset
146 (vec_concat:V2SI
kono
parents: 67
diff changeset
147 (match_operand:SI 1 "register_operand" "f")
kono
parents: 67
diff changeset
148 (match_operand:SI 2 "register_operand" "f")))]
kono
parents: 67
diff changeset
149 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
150 "punpcklwd\t%0,%1,%2"
kono
parents: 67
diff changeset
151 [(set_attr "type" "fcvt")])
kono
parents: 67
diff changeset
152
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
153 ;; Instruction patterns for SIMD instructions.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
154
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
155 ;; Pack with signed saturation.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
156 (define_insn "vec_pack_ssat_<mode>"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
157 [(set (match_operand:<V_squash_double> 0 "register_operand" "=f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
158 (vec_concat:<V_squash_double>
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
159 (ss_truncate:<V_squash>
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
160 (match_operand:VWH 1 "register_operand" "f"))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
161 (ss_truncate:<V_squash>
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
162 (match_operand:VWH 2 "register_operand" "f"))))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
163 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
164 "packss<V_squash_double_suffix>\t%0,%1,%2"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
165 [(set_attr "type" "fmul")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
166
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
167 ;; Pack with unsigned saturation.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
168 (define_insn "vec_pack_usat_<mode>"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
169 [(set (match_operand:<V_squash_double> 0 "register_operand" "=f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
170 (vec_concat:<V_squash_double>
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
171 (us_truncate:<V_squash>
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
172 (match_operand:VH 1 "register_operand" "f"))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
173 (us_truncate:<V_squash>
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
174 (match_operand:VH 2 "register_operand" "f"))))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
175 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
176 "packus<V_squash_double_suffix>\t%0,%1,%2"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
177 [(set_attr "type" "fmul")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
178
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
179 ;; Addition, treating overflow by wraparound.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
180 (define_insn "add<mode>3"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
181 [(set (match_operand:VWHB 0 "register_operand" "=f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
182 (plus:VWHB (match_operand:VWHB 1 "register_operand" "f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
183 (match_operand:VWHB 2 "register_operand" "f")))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
184 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
185 "padd<V_suffix>\t%0,%1,%2"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
186 [(set_attr "type" "fadd")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
187
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
188 ;; Addition of doubleword integers stored in FP registers.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
189 ;; Overflow is treated by wraparound.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
190 ;; We use 'unspec' instead of 'plus' here to avoid clash with
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
191 ;; mips.md::add<mode>3. If 'plus' was used, then such instruction
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
192 ;; would be recognized as adddi3 and reload would make it use
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
193 ;; GPRs instead of FPRs.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
194 (define_insn "loongson_paddd"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
195 [(set (match_operand:DI 0 "register_operand" "=f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
196 (unspec:DI [(match_operand:DI 1 "register_operand" "f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
197 (match_operand:DI 2 "register_operand" "f")]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
198 UNSPEC_LOONGSON_PADDD))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
199 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
200 "paddd\t%0,%1,%2"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
201 [(set_attr "type" "fadd")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
202
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
203 ;; Addition, treating overflow by signed saturation.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
204 (define_insn "ssadd<mode>3"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
205 [(set (match_operand:VHB 0 "register_operand" "=f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
206 (ss_plus:VHB (match_operand:VHB 1 "register_operand" "f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
207 (match_operand:VHB 2 "register_operand" "f")))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
208 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
209 "padds<V_suffix>\t%0,%1,%2"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
210 [(set_attr "type" "fadd")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
211
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
212 ;; Addition, treating overflow by unsigned saturation.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
213 (define_insn "usadd<mode>3"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
214 [(set (match_operand:VHB 0 "register_operand" "=f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
215 (us_plus:VHB (match_operand:VHB 1 "register_operand" "f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
216 (match_operand:VHB 2 "register_operand" "f")))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
217 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
218 "paddus<V_suffix>\t%0,%1,%2"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
219 [(set_attr "type" "fadd")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
220
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
221 ;; Logical AND NOT.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
222 (define_insn "loongson_pandn_<V_suffix>"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
223 [(set (match_operand:VWHBDI 0 "register_operand" "=f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
224 (and:VWHBDI
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
225 (not:VWHBDI (match_operand:VWHBDI 1 "register_operand" "f"))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
226 (match_operand:VWHBDI 2 "register_operand" "f")))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
227 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
228 "pandn\t%0,%1,%2"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
229 [(set_attr "type" "fmul")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
230
111
kono
parents: 67
diff changeset
231 ;; Logical AND.
kono
parents: 67
diff changeset
232 (define_insn "and<mode>3"
kono
parents: 67
diff changeset
233 [(set (match_operand:VWHB 0 "register_operand" "=f")
kono
parents: 67
diff changeset
234 (and:VWHB (match_operand:VWHB 1 "register_operand" "f")
kono
parents: 67
diff changeset
235 (match_operand:VWHB 2 "register_operand" "f")))]
kono
parents: 67
diff changeset
236 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
237 "and\t%0,%1,%2"
kono
parents: 67
diff changeset
238 [(set_attr "type" "fmul")])
kono
parents: 67
diff changeset
239
kono
parents: 67
diff changeset
240 ;; Logical OR.
kono
parents: 67
diff changeset
241 (define_insn "ior<mode>3"
kono
parents: 67
diff changeset
242 [(set (match_operand:VWHB 0 "register_operand" "=f")
kono
parents: 67
diff changeset
243 (ior:VWHB (match_operand:VWHB 1 "register_operand" "f")
kono
parents: 67
diff changeset
244 (match_operand:VWHB 2 "register_operand" "f")))]
kono
parents: 67
diff changeset
245 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
246 "or\t%0,%1,%2"
kono
parents: 67
diff changeset
247 [(set_attr "type" "fcvt")])
kono
parents: 67
diff changeset
248
kono
parents: 67
diff changeset
249 ;; Logical XOR.
kono
parents: 67
diff changeset
250 (define_insn "xor<mode>3"
kono
parents: 67
diff changeset
251 [(set (match_operand:VWHB 0 "register_operand" "=f")
kono
parents: 67
diff changeset
252 (xor:VWHB (match_operand:VWHB 1 "register_operand" "f")
kono
parents: 67
diff changeset
253 (match_operand:VWHB 2 "register_operand" "f")))]
kono
parents: 67
diff changeset
254 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
255 "xor\t%0,%1,%2"
kono
parents: 67
diff changeset
256 [(set_attr "type" "fmul")])
kono
parents: 67
diff changeset
257
kono
parents: 67
diff changeset
258 ;; Logical NOR.
kono
parents: 67
diff changeset
259 (define_insn "*loongson_nor"
kono
parents: 67
diff changeset
260 [(set (match_operand:VWHB 0 "register_operand" "=f")
kono
parents: 67
diff changeset
261 (and:VWHB
kono
parents: 67
diff changeset
262 (not:VWHB (match_operand:VWHB 1 "register_operand" "f"))
kono
parents: 67
diff changeset
263 (not:VWHB (match_operand:VWHB 2 "register_operand" "f"))))]
kono
parents: 67
diff changeset
264 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
265 "nor\t%0,%1,%2"
kono
parents: 67
diff changeset
266 [(set_attr "type" "fmul")])
kono
parents: 67
diff changeset
267
kono
parents: 67
diff changeset
268 ;; Logical NOT.
kono
parents: 67
diff changeset
269 (define_insn "one_cmpl<mode>2"
kono
parents: 67
diff changeset
270 [(set (match_operand:VWHB 0 "register_operand" "=f")
kono
parents: 67
diff changeset
271 (not:VWHB (match_operand:VWHB 1 "register_operand" "f")))]
kono
parents: 67
diff changeset
272 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
273 "nor\t%0,%1,%1"
kono
parents: 67
diff changeset
274 [(set_attr "type" "fmul")])
kono
parents: 67
diff changeset
275
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
276 ;; Average.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
277 (define_insn "loongson_pavg<V_suffix>"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
278 [(set (match_operand:VHB 0 "register_operand" "=f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
279 (unspec:VHB [(match_operand:VHB 1 "register_operand" "f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
280 (match_operand:VHB 2 "register_operand" "f")]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
281 UNSPEC_LOONGSON_PAVG))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
282 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
283 "pavg<V_suffix>\t%0,%1,%2"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
284 [(set_attr "type" "fadd")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
285
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
286 ;; Equality test.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
287 (define_insn "loongson_pcmpeq<V_suffix>"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
288 [(set (match_operand:VWHB 0 "register_operand" "=f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
289 (unspec:VWHB [(match_operand:VWHB 1 "register_operand" "f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
290 (match_operand:VWHB 2 "register_operand" "f")]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
291 UNSPEC_LOONGSON_PCMPEQ))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
292 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
293 "pcmpeq<V_suffix>\t%0,%1,%2"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
294 [(set_attr "type" "fadd")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
295
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
296 ;; Greater-than test.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
297 (define_insn "loongson_pcmpgt<V_suffix>"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
298 [(set (match_operand:VWHB 0 "register_operand" "=f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
299 (unspec:VWHB [(match_operand:VWHB 1 "register_operand" "f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
300 (match_operand:VWHB 2 "register_operand" "f")]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
301 UNSPEC_LOONGSON_PCMPGT))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
302 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
303 "pcmpgt<V_suffix>\t%0,%1,%2"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
304 [(set_attr "type" "fadd")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
305
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
306 ;; Extract halfword.
111
kono
parents: 67
diff changeset
307 (define_insn "loongson_pextrh"
kono
parents: 67
diff changeset
308 [(set (match_operand:V4HI 0 "register_operand" "=f")
kono
parents: 67
diff changeset
309 (unspec:V4HI [(match_operand:V4HI 1 "register_operand" "f")
kono
parents: 67
diff changeset
310 (match_operand:SI 2 "register_operand" "f")]
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
311 UNSPEC_LOONGSON_PEXTR))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
312 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
111
kono
parents: 67
diff changeset
313 "pextrh\t%0,%1,%2"
kono
parents: 67
diff changeset
314 [(set_attr "type" "fcvt")])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
315
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
316 ;; Insert halfword.
111
kono
parents: 67
diff changeset
317 (define_insn "loongson_pinsrh_0"
kono
parents: 67
diff changeset
318 [(set (match_operand:V4HI 0 "register_operand" "=f")
kono
parents: 67
diff changeset
319 (vec_select:V4HI
kono
parents: 67
diff changeset
320 (vec_concat:V8HI
kono
parents: 67
diff changeset
321 (match_operand:V4HI 1 "register_operand" "f")
kono
parents: 67
diff changeset
322 (match_operand:V4HI 2 "register_operand" "f"))
kono
parents: 67
diff changeset
323 (parallel [(const_int 4) (const_int 1)
kono
parents: 67
diff changeset
324 (const_int 2) (const_int 3)])))]
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
325 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
111
kono
parents: 67
diff changeset
326 "pinsrh_0\t%0,%1,%2"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
327 [(set_attr "type" "fdiv")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
328
111
kono
parents: 67
diff changeset
329 (define_insn "loongson_pinsrh_1"
kono
parents: 67
diff changeset
330 [(set (match_operand:V4HI 0 "register_operand" "=f")
kono
parents: 67
diff changeset
331 (vec_select:V4HI
kono
parents: 67
diff changeset
332 (vec_concat:V8HI
kono
parents: 67
diff changeset
333 (match_operand:V4HI 1 "register_operand" "f")
kono
parents: 67
diff changeset
334 (match_operand:V4HI 2 "register_operand" "f"))
kono
parents: 67
diff changeset
335 (parallel [(const_int 0) (const_int 4)
kono
parents: 67
diff changeset
336 (const_int 2) (const_int 3)])))]
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
337 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
111
kono
parents: 67
diff changeset
338 "pinsrh_1\t%0,%1,%2"
kono
parents: 67
diff changeset
339 [(set_attr "type" "fdiv")])
kono
parents: 67
diff changeset
340
kono
parents: 67
diff changeset
341 (define_insn "loongson_pinsrh_2"
kono
parents: 67
diff changeset
342 [(set (match_operand:V4HI 0 "register_operand" "=f")
kono
parents: 67
diff changeset
343 (vec_select:V4HI
kono
parents: 67
diff changeset
344 (vec_concat:V8HI
kono
parents: 67
diff changeset
345 (match_operand:V4HI 1 "register_operand" "f")
kono
parents: 67
diff changeset
346 (match_operand:V4HI 2 "register_operand" "f"))
kono
parents: 67
diff changeset
347 (parallel [(const_int 0) (const_int 1)
kono
parents: 67
diff changeset
348 (const_int 4) (const_int 3)])))]
kono
parents: 67
diff changeset
349 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
350 "pinsrh_2\t%0,%1,%2"
kono
parents: 67
diff changeset
351 [(set_attr "type" "fdiv")])
kono
parents: 67
diff changeset
352
kono
parents: 67
diff changeset
353 (define_insn "loongson_pinsrh_3"
kono
parents: 67
diff changeset
354 [(set (match_operand:V4HI 0 "register_operand" "=f")
kono
parents: 67
diff changeset
355 (vec_select:V4HI
kono
parents: 67
diff changeset
356 (vec_concat:V8HI
kono
parents: 67
diff changeset
357 (match_operand:V4HI 1 "register_operand" "f")
kono
parents: 67
diff changeset
358 (match_operand:V4HI 2 "register_operand" "f"))
kono
parents: 67
diff changeset
359 (parallel [(const_int 0) (const_int 1)
kono
parents: 67
diff changeset
360 (const_int 2) (const_int 4)])))]
kono
parents: 67
diff changeset
361 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
362 "pinsrh_3\t%0,%1,%2"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
363 [(set_attr "type" "fdiv")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
364
111
kono
parents: 67
diff changeset
365 (define_insn "*vec_setv4hi"
kono
parents: 67
diff changeset
366 [(set (match_operand:V4HI 0 "register_operand" "=f")
kono
parents: 67
diff changeset
367 (unspec:V4HI [(match_operand:V4HI 1 "register_operand" "f")
kono
parents: 67
diff changeset
368 (match_operand:SI 2 "register_operand" "f")
kono
parents: 67
diff changeset
369 (match_operand:SI 3 "const_0_to_3_operand" "")]
kono
parents: 67
diff changeset
370 UNSPEC_LOONGSON_PINSRH))]
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
371 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
111
kono
parents: 67
diff changeset
372 "pinsrh_%3\t%0,%1,%2"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
373 [(set_attr "type" "fdiv")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
374
111
kono
parents: 67
diff changeset
375 (define_expand "vec_setv4hi"
kono
parents: 67
diff changeset
376 [(set (match_operand:V4HI 0 "register_operand" "=f")
kono
parents: 67
diff changeset
377 (unspec:V4HI [(match_operand:V4HI 1 "register_operand" "f")
kono
parents: 67
diff changeset
378 (match_operand:HI 2 "register_operand" "f")
kono
parents: 67
diff changeset
379 (match_operand:SI 3 "const_0_to_3_operand" "")]
kono
parents: 67
diff changeset
380 UNSPEC_LOONGSON_PINSRH))]
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
381 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
111
kono
parents: 67
diff changeset
382 {
kono
parents: 67
diff changeset
383 rtx ext = gen_reg_rtx (SImode);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
384 emit_move_insn (ext, gen_lowpart (SImode, operands[2]));
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
385 operands[2] = ext;
111
kono
parents: 67
diff changeset
386 })
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
387
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
388 ;; Multiply and add packed integers.
111
kono
parents: 67
diff changeset
389 (define_insn "loongson_pmaddhw"
kono
parents: 67
diff changeset
390 [(set (match_operand:V2SI 0 "register_operand" "=f")
kono
parents: 67
diff changeset
391 (unspec:V2SI [(match_operand:V4HI 1 "register_operand" "f")
kono
parents: 67
diff changeset
392 (match_operand:V4HI 2 "register_operand" "f")]
kono
parents: 67
diff changeset
393 UNSPEC_LOONGSON_PMADD))]
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
394 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
111
kono
parents: 67
diff changeset
395 "pmaddhw\t%0,%1,%2"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
396 [(set_attr "type" "fmul")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
397
111
kono
parents: 67
diff changeset
398 (define_expand "sdot_prodv4hi"
kono
parents: 67
diff changeset
399 [(match_operand:V2SI 0 "register_operand" "")
kono
parents: 67
diff changeset
400 (match_operand:V4HI 1 "register_operand" "")
kono
parents: 67
diff changeset
401 (match_operand:V4HI 2 "register_operand" "")
kono
parents: 67
diff changeset
402 (match_operand:V2SI 3 "register_operand" "")]
kono
parents: 67
diff changeset
403 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
404 {
kono
parents: 67
diff changeset
405 rtx t = gen_reg_rtx (V2SImode);
kono
parents: 67
diff changeset
406 emit_insn (gen_loongson_pmaddhw (t, operands[1], operands[2]));
kono
parents: 67
diff changeset
407 emit_insn (gen_addv2si3 (operands[0], t, operands[3]));
kono
parents: 67
diff changeset
408 DONE;
kono
parents: 67
diff changeset
409 })
kono
parents: 67
diff changeset
410
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
411 ;; Maximum of signed halfwords.
111
kono
parents: 67
diff changeset
412 (define_insn "smaxv4hi3"
kono
parents: 67
diff changeset
413 [(set (match_operand:V4HI 0 "register_operand" "=f")
kono
parents: 67
diff changeset
414 (smax:V4HI (match_operand:V4HI 1 "register_operand" "f")
kono
parents: 67
diff changeset
415 (match_operand:V4HI 2 "register_operand" "f")))]
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
416 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
111
kono
parents: 67
diff changeset
417 "pmaxsh\t%0,%1,%2"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
418 [(set_attr "type" "fadd")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
419
111
kono
parents: 67
diff changeset
420 (define_expand "smax<mode>3"
kono
parents: 67
diff changeset
421 [(match_operand:VWB 0 "register_operand" "")
kono
parents: 67
diff changeset
422 (match_operand:VWB 1 "register_operand" "")
kono
parents: 67
diff changeset
423 (match_operand:VWB 2 "register_operand" "")]
kono
parents: 67
diff changeset
424 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
425 {
kono
parents: 67
diff changeset
426 mips_expand_vec_minmax (operands[0], operands[1], operands[2],
kono
parents: 67
diff changeset
427 gen_loongson_pcmpgt<V_suffix>, false);
kono
parents: 67
diff changeset
428 DONE;
kono
parents: 67
diff changeset
429 })
kono
parents: 67
diff changeset
430
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
431 ;; Maximum of unsigned bytes.
111
kono
parents: 67
diff changeset
432 (define_insn "umaxv8qi3"
kono
parents: 67
diff changeset
433 [(set (match_operand:V8QI 0 "register_operand" "=f")
kono
parents: 67
diff changeset
434 (umax:V8QI (match_operand:V8QI 1 "register_operand" "f")
kono
parents: 67
diff changeset
435 (match_operand:V8QI 2 "register_operand" "f")))]
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
436 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
111
kono
parents: 67
diff changeset
437 "pmaxub\t%0,%1,%2"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
438 [(set_attr "type" "fadd")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
439
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
440 ;; Minimum of signed halfwords.
111
kono
parents: 67
diff changeset
441 (define_insn "sminv4hi3"
kono
parents: 67
diff changeset
442 [(set (match_operand:V4HI 0 "register_operand" "=f")
kono
parents: 67
diff changeset
443 (smin:V4HI (match_operand:V4HI 1 "register_operand" "f")
kono
parents: 67
diff changeset
444 (match_operand:V4HI 2 "register_operand" "f")))]
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
445 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
111
kono
parents: 67
diff changeset
446 "pminsh\t%0,%1,%2"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
447 [(set_attr "type" "fadd")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
448
111
kono
parents: 67
diff changeset
449 (define_expand "smin<mode>3"
kono
parents: 67
diff changeset
450 [(match_operand:VWB 0 "register_operand" "")
kono
parents: 67
diff changeset
451 (match_operand:VWB 1 "register_operand" "")
kono
parents: 67
diff changeset
452 (match_operand:VWB 2 "register_operand" "")]
kono
parents: 67
diff changeset
453 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
454 {
kono
parents: 67
diff changeset
455 mips_expand_vec_minmax (operands[0], operands[1], operands[2],
kono
parents: 67
diff changeset
456 gen_loongson_pcmpgt<V_suffix>, true);
kono
parents: 67
diff changeset
457 DONE;
kono
parents: 67
diff changeset
458 })
kono
parents: 67
diff changeset
459
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
460 ;; Minimum of unsigned bytes.
111
kono
parents: 67
diff changeset
461 (define_insn "uminv8qi3"
kono
parents: 67
diff changeset
462 [(set (match_operand:V8QI 0 "register_operand" "=f")
kono
parents: 67
diff changeset
463 (umin:V8QI (match_operand:V8QI 1 "register_operand" "f")
kono
parents: 67
diff changeset
464 (match_operand:V8QI 2 "register_operand" "f")))]
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
465 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
111
kono
parents: 67
diff changeset
466 "pminub\t%0,%1,%2"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
467 [(set_attr "type" "fadd")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
468
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
469 ;; Move byte mask.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
470 (define_insn "loongson_pmovmsk<V_suffix>"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
471 [(set (match_operand:VB 0 "register_operand" "=f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
472 (unspec:VB [(match_operand:VB 1 "register_operand" "f")]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
473 UNSPEC_LOONGSON_PMOVMSK))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
474 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
475 "pmovmsk<V_suffix>\t%0,%1"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
476 [(set_attr "type" "fabs")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
477
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
478 ;; Multiply unsigned integers and store high result.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
479 (define_insn "umul<mode>3_highpart"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
480 [(set (match_operand:VH 0 "register_operand" "=f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
481 (unspec:VH [(match_operand:VH 1 "register_operand" "f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
482 (match_operand:VH 2 "register_operand" "f")]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
483 UNSPEC_LOONGSON_PMULHU))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
484 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
485 "pmulhu<V_suffix>\t%0,%1,%2"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
486 [(set_attr "type" "fmul")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
487
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
488 ;; Multiply signed integers and store high result.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
489 (define_insn "smul<mode>3_highpart"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
490 [(set (match_operand:VH 0 "register_operand" "=f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
491 (unspec:VH [(match_operand:VH 1 "register_operand" "f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
492 (match_operand:VH 2 "register_operand" "f")]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
493 UNSPEC_LOONGSON_PMULH))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
494 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
495 "pmulh<V_suffix>\t%0,%1,%2"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
496 [(set_attr "type" "fmul")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
497
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
498 ;; Multiply signed integers and store low result.
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
499 (define_insn "mul<mode>3"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
500 [(set (match_operand:VH 0 "register_operand" "=f")
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
501 (mult:VH (match_operand:VH 1 "register_operand" "f")
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
502 (match_operand:VH 2 "register_operand" "f")))]
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
503 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
504 "pmull<V_suffix>\t%0,%1,%2"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
505 [(set_attr "type" "fmul")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
506
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
507 ;; Multiply unsigned word integers.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
508 (define_insn "loongson_pmulu<V_suffix>"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
509 [(set (match_operand:DI 0 "register_operand" "=f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
510 (unspec:DI [(match_operand:VW 1 "register_operand" "f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
511 (match_operand:VW 2 "register_operand" "f")]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
512 UNSPEC_LOONGSON_PMULU))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
513 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
514 "pmulu<V_suffix>\t%0,%1,%2"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
515 [(set_attr "type" "fmul")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
516
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
517 ;; Absolute difference.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
518 (define_insn "loongson_pasubub"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
519 [(set (match_operand:VB 0 "register_operand" "=f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
520 (unspec:VB [(match_operand:VB 1 "register_operand" "f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
521 (match_operand:VB 2 "register_operand" "f")]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
522 UNSPEC_LOONGSON_PASUBUB))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
523 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
524 "pasubub\t%0,%1,%2"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
525 [(set_attr "type" "fadd")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
526
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
527 ;; Sum of unsigned byte integers.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
528 (define_insn "loongson_biadd"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
529 [(set (match_operand:<V_stretch_half> 0 "register_operand" "=f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
530 (unspec:<V_stretch_half> [(match_operand:VB 1 "register_operand" "f")]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
531 UNSPEC_LOONGSON_BIADD))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
532 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
533 "biadd\t%0,%1"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
534 [(set_attr "type" "fabs")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
535
111
kono
parents: 67
diff changeset
536 (define_insn "reduc_uplus_v8qi"
kono
parents: 67
diff changeset
537 [(set (match_operand:V8QI 0 "register_operand" "=f")
kono
parents: 67
diff changeset
538 (unspec:V8QI [(match_operand:V8QI 1 "register_operand" "f")]
kono
parents: 67
diff changeset
539 UNSPEC_LOONGSON_BIADD))]
kono
parents: 67
diff changeset
540 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
541 "biadd\t%0,%1"
kono
parents: 67
diff changeset
542 [(set_attr "type" "fabs")])
kono
parents: 67
diff changeset
543
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
544 ;; Sum of absolute differences.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
545 (define_insn "loongson_psadbh"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
546 [(set (match_operand:<V_stretch_half> 0 "register_operand" "=f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
547 (unspec:<V_stretch_half> [(match_operand:VB 1 "register_operand" "f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
548 (match_operand:VB 2 "register_operand" "f")]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
549 UNSPEC_LOONGSON_PSADBH))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
550 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
551 "pasubub\t%0,%1,%2;biadd\t%0,%0"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
552 [(set_attr "type" "fadd")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
553
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
554 ;; Shuffle halfwords.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
555 (define_insn "loongson_pshufh"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
556 [(set (match_operand:VH 0 "register_operand" "=f")
111
kono
parents: 67
diff changeset
557 (unspec:VH [(match_operand:VH 1 "register_operand" "f")
kono
parents: 67
diff changeset
558 (match_operand:SI 2 "register_operand" "f")]
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
559 UNSPEC_LOONGSON_PSHUFH))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
560 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
111
kono
parents: 67
diff changeset
561 "pshufh\t%0,%1,%2"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
562 [(set_attr "type" "fmul")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
563
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
564 ;; Shift left logical.
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
565 (define_insn "ashl<mode>3"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
566 [(set (match_operand:VWH 0 "register_operand" "=f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
567 (ashift:VWH (match_operand:VWH 1 "register_operand" "f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
568 (match_operand:SI 2 "register_operand" "f")))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
569 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
570 "psll<V_suffix>\t%0,%1,%2"
111
kono
parents: 67
diff changeset
571 [(set_attr "type" "fcvt")])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
572
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
573 ;; Shift right arithmetic.
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
574 (define_insn "ashr<mode>3"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
575 [(set (match_operand:VWH 0 "register_operand" "=f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
576 (ashiftrt:VWH (match_operand:VWH 1 "register_operand" "f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
577 (match_operand:SI 2 "register_operand" "f")))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
578 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
579 "psra<V_suffix>\t%0,%1,%2"
111
kono
parents: 67
diff changeset
580 [(set_attr "type" "fcvt")])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
581
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
582 ;; Shift right logical.
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
583 (define_insn "lshr<mode>3"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
584 [(set (match_operand:VWH 0 "register_operand" "=f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
585 (lshiftrt:VWH (match_operand:VWH 1 "register_operand" "f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
586 (match_operand:SI 2 "register_operand" "f")))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
587 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
588 "psrl<V_suffix>\t%0,%1,%2"
111
kono
parents: 67
diff changeset
589 [(set_attr "type" "fcvt")])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
590
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
591 ;; Subtraction, treating overflow by wraparound.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
592 (define_insn "sub<mode>3"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
593 [(set (match_operand:VWHB 0 "register_operand" "=f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
594 (minus:VWHB (match_operand:VWHB 1 "register_operand" "f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
595 (match_operand:VWHB 2 "register_operand" "f")))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
596 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
597 "psub<V_suffix>\t%0,%1,%2"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
598 [(set_attr "type" "fadd")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
599
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
600 ;; Subtraction of doubleword integers stored in FP registers.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
601 ;; Overflow is treated by wraparound.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
602 ;; See loongson_paddd for the reason we use 'unspec' rather than
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
603 ;; 'minus' here.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
604 (define_insn "loongson_psubd"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
605 [(set (match_operand:DI 0 "register_operand" "=f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
606 (unspec:DI [(match_operand:DI 1 "register_operand" "f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
607 (match_operand:DI 2 "register_operand" "f")]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
608 UNSPEC_LOONGSON_PSUBD))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
609 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
610 "psubd\t%0,%1,%2"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
611 [(set_attr "type" "fadd")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
612
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
613 ;; Subtraction, treating overflow by signed saturation.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
614 (define_insn "sssub<mode>3"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
615 [(set (match_operand:VHB 0 "register_operand" "=f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
616 (ss_minus:VHB (match_operand:VHB 1 "register_operand" "f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
617 (match_operand:VHB 2 "register_operand" "f")))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
618 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
619 "psubs<V_suffix>\t%0,%1,%2"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
620 [(set_attr "type" "fadd")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
621
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
622 ;; Subtraction, treating overflow by unsigned saturation.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
623 (define_insn "ussub<mode>3"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
624 [(set (match_operand:VHB 0 "register_operand" "=f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
625 (us_minus:VHB (match_operand:VHB 1 "register_operand" "f")
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
626 (match_operand:VHB 2 "register_operand" "f")))]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
627 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
628 "psubus<V_suffix>\t%0,%1,%2"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
629 [(set_attr "type" "fadd")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
630
111
kono
parents: 67
diff changeset
631 ;; Unpack high data. Recall that Loongson only runs in little-endian.
kono
parents: 67
diff changeset
632 (define_insn "loongson_punpckhbh"
kono
parents: 67
diff changeset
633 [(set (match_operand:V8QI 0 "register_operand" "=f")
kono
parents: 67
diff changeset
634 (vec_select:V8QI
kono
parents: 67
diff changeset
635 (vec_concat:V16QI
kono
parents: 67
diff changeset
636 (match_operand:V8QI 1 "register_operand" "f")
kono
parents: 67
diff changeset
637 (match_operand:V8QI 2 "register_operand" "f"))
kono
parents: 67
diff changeset
638 (parallel [(const_int 4) (const_int 12)
kono
parents: 67
diff changeset
639 (const_int 5) (const_int 13)
kono
parents: 67
diff changeset
640 (const_int 6) (const_int 14)
kono
parents: 67
diff changeset
641 (const_int 7) (const_int 15)])))]
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
642 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
111
kono
parents: 67
diff changeset
643 "punpckhbh\t%0,%1,%2"
kono
parents: 67
diff changeset
644 [(set_attr "type" "fdiv")])
kono
parents: 67
diff changeset
645
kono
parents: 67
diff changeset
646 (define_insn "loongson_punpckhhw"
kono
parents: 67
diff changeset
647 [(set (match_operand:V4HI 0 "register_operand" "=f")
kono
parents: 67
diff changeset
648 (vec_select:V4HI
kono
parents: 67
diff changeset
649 (vec_concat:V8HI
kono
parents: 67
diff changeset
650 (match_operand:V4HI 1 "register_operand" "f")
kono
parents: 67
diff changeset
651 (match_operand:V4HI 2 "register_operand" "f"))
kono
parents: 67
diff changeset
652 (parallel [(const_int 2) (const_int 6)
kono
parents: 67
diff changeset
653 (const_int 3) (const_int 7)])))]
kono
parents: 67
diff changeset
654 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
655 "punpckhhw\t%0,%1,%2"
kono
parents: 67
diff changeset
656 [(set_attr "type" "fdiv")])
kono
parents: 67
diff changeset
657
kono
parents: 67
diff changeset
658 (define_insn "loongson_punpckhhw_qi"
kono
parents: 67
diff changeset
659 [(set (match_operand:V8QI 0 "register_operand" "=f")
kono
parents: 67
diff changeset
660 (vec_select:V8QI
kono
parents: 67
diff changeset
661 (vec_concat:V16QI
kono
parents: 67
diff changeset
662 (match_operand:V8QI 1 "register_operand" "f")
kono
parents: 67
diff changeset
663 (match_operand:V8QI 2 "register_operand" "f"))
kono
parents: 67
diff changeset
664 (parallel [(const_int 4) (const_int 5)
kono
parents: 67
diff changeset
665 (const_int 12) (const_int 13)
kono
parents: 67
diff changeset
666 (const_int 6) (const_int 7)
kono
parents: 67
diff changeset
667 (const_int 14) (const_int 15)])))]
kono
parents: 67
diff changeset
668 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
669 "punpckhhw\t%0,%1,%2"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
670 [(set_attr "type" "fdiv")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
671
111
kono
parents: 67
diff changeset
672 (define_insn "loongson_punpckhwd"
kono
parents: 67
diff changeset
673 [(set (match_operand:V2SI 0 "register_operand" "=f")
kono
parents: 67
diff changeset
674 (vec_select:V2SI
kono
parents: 67
diff changeset
675 (vec_concat:V4SI
kono
parents: 67
diff changeset
676 (match_operand:V2SI 1 "register_operand" "f")
kono
parents: 67
diff changeset
677 (match_operand:V2SI 2 "register_operand" "f"))
kono
parents: 67
diff changeset
678 (parallel [(const_int 1) (const_int 3)])))]
kono
parents: 67
diff changeset
679 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
680 "punpckhwd\t%0,%1,%2"
kono
parents: 67
diff changeset
681 [(set_attr "type" "fcvt")])
kono
parents: 67
diff changeset
682
kono
parents: 67
diff changeset
683 (define_insn "loongson_punpckhwd_qi"
kono
parents: 67
diff changeset
684 [(set (match_operand:V8QI 0 "register_operand" "=f")
kono
parents: 67
diff changeset
685 (vec_select:V8QI
kono
parents: 67
diff changeset
686 (vec_concat:V16QI
kono
parents: 67
diff changeset
687 (match_operand:V8QI 1 "register_operand" "f")
kono
parents: 67
diff changeset
688 (match_operand:V8QI 2 "register_operand" "f"))
kono
parents: 67
diff changeset
689 (parallel [(const_int 4) (const_int 5)
kono
parents: 67
diff changeset
690 (const_int 6) (const_int 7)
kono
parents: 67
diff changeset
691 (const_int 12) (const_int 13)
kono
parents: 67
diff changeset
692 (const_int 14) (const_int 15)])))]
kono
parents: 67
diff changeset
693 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
694 "punpckhwd\t%0,%1,%2"
kono
parents: 67
diff changeset
695 [(set_attr "type" "fcvt")])
kono
parents: 67
diff changeset
696
kono
parents: 67
diff changeset
697 (define_insn "loongson_punpckhwd_hi"
kono
parents: 67
diff changeset
698 [(set (match_operand:V4HI 0 "register_operand" "=f")
kono
parents: 67
diff changeset
699 (vec_select:V4HI
kono
parents: 67
diff changeset
700 (vec_concat:V8HI
kono
parents: 67
diff changeset
701 (match_operand:V4HI 1 "register_operand" "f")
kono
parents: 67
diff changeset
702 (match_operand:V4HI 2 "register_operand" "f"))
kono
parents: 67
diff changeset
703 (parallel [(const_int 2) (const_int 3)
kono
parents: 67
diff changeset
704 (const_int 6) (const_int 7)])))]
kono
parents: 67
diff changeset
705 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
706 "punpckhwd\t%0,%1,%2"
kono
parents: 67
diff changeset
707 [(set_attr "type" "fcvt")])
kono
parents: 67
diff changeset
708
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
709 ;; Unpack low data.
111
kono
parents: 67
diff changeset
710 (define_insn "loongson_punpcklbh"
kono
parents: 67
diff changeset
711 [(set (match_operand:V8QI 0 "register_operand" "=f")
kono
parents: 67
diff changeset
712 (vec_select:V8QI
kono
parents: 67
diff changeset
713 (vec_concat:V16QI
kono
parents: 67
diff changeset
714 (match_operand:V8QI 1 "register_operand" "f")
kono
parents: 67
diff changeset
715 (match_operand:V8QI 2 "register_operand" "f"))
kono
parents: 67
diff changeset
716 (parallel [(const_int 0) (const_int 8)
kono
parents: 67
diff changeset
717 (const_int 1) (const_int 9)
kono
parents: 67
diff changeset
718 (const_int 2) (const_int 10)
kono
parents: 67
diff changeset
719 (const_int 3) (const_int 11)])))]
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
720 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
111
kono
parents: 67
diff changeset
721 "punpcklbh\t%0,%1,%2"
kono
parents: 67
diff changeset
722 [(set_attr "type" "fdiv")])
kono
parents: 67
diff changeset
723
kono
parents: 67
diff changeset
724 (define_insn "loongson_punpcklhw"
kono
parents: 67
diff changeset
725 [(set (match_operand:V4HI 0 "register_operand" "=f")
kono
parents: 67
diff changeset
726 (vec_select:V4HI
kono
parents: 67
diff changeset
727 (vec_concat:V8HI
kono
parents: 67
diff changeset
728 (match_operand:V4HI 1 "register_operand" "f")
kono
parents: 67
diff changeset
729 (match_operand:V4HI 2 "register_operand" "f"))
kono
parents: 67
diff changeset
730 (parallel [(const_int 0) (const_int 4)
kono
parents: 67
diff changeset
731 (const_int 1) (const_int 5)])))]
kono
parents: 67
diff changeset
732 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
733 "punpcklhw\t%0,%1,%2"
kono
parents: 67
diff changeset
734 [(set_attr "type" "fdiv")])
kono
parents: 67
diff changeset
735
kono
parents: 67
diff changeset
736 (define_insn "*loongson_punpcklhw_qi"
kono
parents: 67
diff changeset
737 [(set (match_operand:V8QI 0 "register_operand" "=f")
kono
parents: 67
diff changeset
738 (vec_select:V8QI
kono
parents: 67
diff changeset
739 (vec_concat:V16QI
kono
parents: 67
diff changeset
740 (match_operand:V8QI 1 "register_operand" "f")
kono
parents: 67
diff changeset
741 (match_operand:V8QI 2 "register_operand" "f"))
kono
parents: 67
diff changeset
742 (parallel [(const_int 0) (const_int 1)
kono
parents: 67
diff changeset
743 (const_int 8) (const_int 9)
kono
parents: 67
diff changeset
744 (const_int 2) (const_int 3)
kono
parents: 67
diff changeset
745 (const_int 10) (const_int 11)])))]
kono
parents: 67
diff changeset
746 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
747 "punpcklhw\t%0,%1,%2"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
748 [(set_attr "type" "fdiv")])
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
749
111
kono
parents: 67
diff changeset
750 (define_insn "loongson_punpcklwd"
kono
parents: 67
diff changeset
751 [(set (match_operand:V2SI 0 "register_operand" "=f")
kono
parents: 67
diff changeset
752 (vec_select:V2SI
kono
parents: 67
diff changeset
753 (vec_concat:V4SI
kono
parents: 67
diff changeset
754 (match_operand:V2SI 1 "register_operand" "f")
kono
parents: 67
diff changeset
755 (match_operand:V2SI 2 "register_operand" "f"))
kono
parents: 67
diff changeset
756 (parallel [(const_int 0) (const_int 2)])))]
kono
parents: 67
diff changeset
757 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
758 "punpcklwd\t%0,%1,%2"
kono
parents: 67
diff changeset
759 [(set_attr "type" "fcvt")])
kono
parents: 67
diff changeset
760
kono
parents: 67
diff changeset
761 (define_insn "*loongson_punpcklwd_qi"
kono
parents: 67
diff changeset
762 [(set (match_operand:V8QI 0 "register_operand" "=f")
kono
parents: 67
diff changeset
763 (vec_select:V8QI
kono
parents: 67
diff changeset
764 (vec_concat:V16QI
kono
parents: 67
diff changeset
765 (match_operand:V8QI 1 "register_operand" "f")
kono
parents: 67
diff changeset
766 (match_operand:V8QI 2 "register_operand" "f"))
kono
parents: 67
diff changeset
767 (parallel [(const_int 0) (const_int 1)
kono
parents: 67
diff changeset
768 (const_int 2) (const_int 3)
kono
parents: 67
diff changeset
769 (const_int 8) (const_int 9)
kono
parents: 67
diff changeset
770 (const_int 10) (const_int 11)])))]
kono
parents: 67
diff changeset
771 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
772 "punpcklwd\t%0,%1,%2"
kono
parents: 67
diff changeset
773 [(set_attr "type" "fcvt")])
kono
parents: 67
diff changeset
774
kono
parents: 67
diff changeset
775 (define_insn "*loongson_punpcklwd_hi"
kono
parents: 67
diff changeset
776 [(set (match_operand:V4HI 0 "register_operand" "=f")
kono
parents: 67
diff changeset
777 (vec_select:V4HI
kono
parents: 67
diff changeset
778 (vec_concat:V8HI
kono
parents: 67
diff changeset
779 (match_operand:V4HI 1 "register_operand" "f")
kono
parents: 67
diff changeset
780 (match_operand:V4HI 2 "register_operand" "f"))
kono
parents: 67
diff changeset
781 (parallel [(const_int 0) (const_int 1)
kono
parents: 67
diff changeset
782 (const_int 4) (const_int 5)])))]
kono
parents: 67
diff changeset
783 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
784 "punpcklwd\t%0,%1,%2"
kono
parents: 67
diff changeset
785 [(set_attr "type" "fcvt")])
kono
parents: 67
diff changeset
786
kono
parents: 67
diff changeset
787 (define_expand "vec_unpacks_lo_<mode>"
kono
parents: 67
diff changeset
788 [(match_operand:<V_stretch_half> 0 "register_operand" "")
kono
parents: 67
diff changeset
789 (match_operand:VHB 1 "register_operand" "")]
kono
parents: 67
diff changeset
790 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
791 {
kono
parents: 67
diff changeset
792 mips_expand_vec_unpack (operands, false, false);
kono
parents: 67
diff changeset
793 DONE;
kono
parents: 67
diff changeset
794 })
kono
parents: 67
diff changeset
795
kono
parents: 67
diff changeset
796 (define_expand "vec_unpacks_hi_<mode>"
kono
parents: 67
diff changeset
797 [(match_operand:<V_stretch_half> 0 "register_operand" "")
kono
parents: 67
diff changeset
798 (match_operand:VHB 1 "register_operand" "")]
kono
parents: 67
diff changeset
799 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
800 {
kono
parents: 67
diff changeset
801 mips_expand_vec_unpack (operands, false, true);
kono
parents: 67
diff changeset
802 DONE;
kono
parents: 67
diff changeset
803 })
kono
parents: 67
diff changeset
804
kono
parents: 67
diff changeset
805 (define_expand "vec_unpacku_lo_<mode>"
kono
parents: 67
diff changeset
806 [(match_operand:<V_stretch_half> 0 "register_operand" "")
kono
parents: 67
diff changeset
807 (match_operand:VHB 1 "register_operand" "")]
kono
parents: 67
diff changeset
808 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
809 {
kono
parents: 67
diff changeset
810 mips_expand_vec_unpack (operands, true, false);
kono
parents: 67
diff changeset
811 DONE;
kono
parents: 67
diff changeset
812 })
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
813
111
kono
parents: 67
diff changeset
814 (define_expand "vec_unpacku_hi_<mode>"
kono
parents: 67
diff changeset
815 [(match_operand:<V_stretch_half> 0 "register_operand" "")
kono
parents: 67
diff changeset
816 (match_operand:VHB 1 "register_operand" "")]
kono
parents: 67
diff changeset
817 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
818 {
kono
parents: 67
diff changeset
819 mips_expand_vec_unpack (operands, true, true);
kono
parents: 67
diff changeset
820 DONE;
kono
parents: 67
diff changeset
821 })
kono
parents: 67
diff changeset
822
kono
parents: 67
diff changeset
823 ;; Whole vector shifts, used for reduction epilogues.
kono
parents: 67
diff changeset
824 (define_insn "vec_shl_<mode>"
kono
parents: 67
diff changeset
825 [(set (match_operand:VWHBDI 0 "register_operand" "=f")
kono
parents: 67
diff changeset
826 (unspec:VWHBDI [(match_operand:VWHBDI 1 "register_operand" "f")
kono
parents: 67
diff changeset
827 (match_operand:SI 2 "register_operand" "f")]
kono
parents: 67
diff changeset
828 UNSPEC_LOONGSON_DSLL))]
kono
parents: 67
diff changeset
829 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
830 "dsll\t%0,%1,%2"
kono
parents: 67
diff changeset
831 [(set_attr "type" "fcvt")])
kono
parents: 67
diff changeset
832
kono
parents: 67
diff changeset
833 (define_insn "vec_shr_<mode>"
kono
parents: 67
diff changeset
834 [(set (match_operand:VWHBDI 0 "register_operand" "=f")
kono
parents: 67
diff changeset
835 (unspec:VWHBDI [(match_operand:VWHBDI 1 "register_operand" "f")
kono
parents: 67
diff changeset
836 (match_operand:SI 2 "register_operand" "f")]
kono
parents: 67
diff changeset
837 UNSPEC_LOONGSON_DSRL))]
kono
parents: 67
diff changeset
838 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
839 "dsrl\t%0,%1,%2"
kono
parents: 67
diff changeset
840 [(set_attr "type" "fcvt")])
kono
parents: 67
diff changeset
841
kono
parents: 67
diff changeset
842 (define_insn "vec_loongson_extract_lo_<mode>"
kono
parents: 67
diff changeset
843 [(set (match_operand:<V_inner> 0 "register_operand" "=r")
kono
parents: 67
diff changeset
844 (vec_select:<V_inner>
kono
parents: 67
diff changeset
845 (match_operand:VWHB 1 "register_operand" "f")
kono
parents: 67
diff changeset
846 (parallel [(const_int 0)])))]
kono
parents: 67
diff changeset
847 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
848 "mfc1\t%0,%1"
kono
parents: 67
diff changeset
849 [(set_attr "type" "mfc")])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
850
111
kono
parents: 67
diff changeset
851 (define_expand "reduc_plus_scal_<mode>"
kono
parents: 67
diff changeset
852 [(match_operand:<V_inner> 0 "register_operand" "")
kono
parents: 67
diff changeset
853 (match_operand:VWHB 1 "register_operand" "")]
kono
parents: 67
diff changeset
854 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
855 {
kono
parents: 67
diff changeset
856 rtx tmp = gen_reg_rtx (GET_MODE (operands[1]));
kono
parents: 67
diff changeset
857 mips_expand_vec_reduc (tmp, operands[1], gen_add<mode>3);
kono
parents: 67
diff changeset
858 emit_insn (gen_vec_loongson_extract_lo_<mode> (operands[0], tmp));
kono
parents: 67
diff changeset
859 DONE;
kono
parents: 67
diff changeset
860 })
kono
parents: 67
diff changeset
861
kono
parents: 67
diff changeset
862 (define_expand "reduc_smax_scal_<mode>"
kono
parents: 67
diff changeset
863 [(match_operand:<V_inner> 0 "register_operand" "")
kono
parents: 67
diff changeset
864 (match_operand:VWHB 1 "register_operand" "")]
kono
parents: 67
diff changeset
865 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
866 {
kono
parents: 67
diff changeset
867 rtx tmp = gen_reg_rtx (GET_MODE (operands[1]));
kono
parents: 67
diff changeset
868 mips_expand_vec_reduc (tmp, operands[1], gen_smax<mode>3);
kono
parents: 67
diff changeset
869 emit_insn (gen_vec_loongson_extract_lo_<mode> (operands[0], tmp));
kono
parents: 67
diff changeset
870 DONE;
kono
parents: 67
diff changeset
871 })
kono
parents: 67
diff changeset
872
kono
parents: 67
diff changeset
873 (define_expand "reduc_smin_scal_<mode>"
kono
parents: 67
diff changeset
874 [(match_operand:<V_inner> 0 "register_operand" "")
kono
parents: 67
diff changeset
875 (match_operand:VWHB 1 "register_operand" "")]
kono
parents: 67
diff changeset
876 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
877 {
kono
parents: 67
diff changeset
878 rtx tmp = gen_reg_rtx (GET_MODE (operands[1]));
kono
parents: 67
diff changeset
879 mips_expand_vec_reduc (tmp, operands[1], gen_smin<mode>3);
kono
parents: 67
diff changeset
880 emit_insn (gen_vec_loongson_extract_lo_<mode> (operands[0], tmp));
kono
parents: 67
diff changeset
881 DONE;
kono
parents: 67
diff changeset
882 })
kono
parents: 67
diff changeset
883
kono
parents: 67
diff changeset
884 (define_expand "reduc_umax_scal_<mode>"
kono
parents: 67
diff changeset
885 [(match_operand:<V_inner> 0 "register_operand" "")
kono
parents: 67
diff changeset
886 (match_operand:VB 1 "register_operand" "")]
kono
parents: 67
diff changeset
887 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
888 {
kono
parents: 67
diff changeset
889 rtx tmp = gen_reg_rtx (GET_MODE (operands[1]));
kono
parents: 67
diff changeset
890 mips_expand_vec_reduc (tmp, operands[1], gen_umax<mode>3);
kono
parents: 67
diff changeset
891 emit_insn (gen_vec_loongson_extract_lo_<mode> (operands[0], tmp));
kono
parents: 67
diff changeset
892 DONE;
kono
parents: 67
diff changeset
893 })
kono
parents: 67
diff changeset
894
kono
parents: 67
diff changeset
895 (define_expand "reduc_umin_scal_<mode>"
kono
parents: 67
diff changeset
896 [(match_operand:<V_inner> 0 "register_operand" "")
kono
parents: 67
diff changeset
897 (match_operand:VB 1 "register_operand" "")]
kono
parents: 67
diff changeset
898 "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
kono
parents: 67
diff changeset
899 {
kono
parents: 67
diff changeset
900 rtx tmp = gen_reg_rtx (GET_MODE (operands[1]));
kono
parents: 67
diff changeset
901 mips_expand_vec_reduc (tmp, operands[1], gen_umin<mode>3);
kono
parents: 67
diff changeset
902 emit_insn (gen_vec_loongson_extract_lo_<mode> (operands[0], tmp));
kono
parents: 67
diff changeset
903 DONE;
kono
parents: 67
diff changeset
904 })