1 ;; Machine description for RISC-V 'V' Extension for GNU compiler.
2 ;; Copyright (C) 2022-2024 Free Software Foundation, Inc.
3 ;; Contributed by Juzhe Zhong (juzhe.zhong@rivai.ai), RiVAI Technologies Ltd.
5 ;; This file is part of GCC.
7 ;; GCC is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation; either version 3, or (at your option)
12 ;; GCC is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GCC; see the file COPYING3. If not see
19 ;; <http://www.gnu.org/licenses/>.
21 ;; This file describes the RISC-V 'V' Extension, Version 1.0.
23 ;; This file include :
25 ;; - Intrinsics (https://github.com/riscv/rvv-intrinsic-doc)
26 ;; - Auto-vectorization (autovec.md)
27 ;; - Optimization (autovec-opt.md)
29 (include "vector-iterators.md")
32 (INVALID_ATTRIBUTE 255)
36 ;; True if the type is RVV instructions that include VTYPE
37 ;; global status register in the use op list.
38 ;; We known VTYPE has 4 fields: SEW, LMUL, TA, MA.
39 ;; The instruction need any of VTYPE field is set as true
41 (define_attr "has_vtype_op" "false,true"
42 (cond [(eq_attr "type" "vlde,vste,vldm,vstm,vlds,vsts,\
43 vldux,vldox,vstux,vstox,vldff,\
44 vialu,viwalu,vext,vicalu,vshift,vnshift,vicmp,viminmax,\
45 vimul,vidiv,viwmul,vimuladd,viwmuladd,vimerge,vimov,\
46 vsalu,vaalu,vsmul,vsshift,vnclip,\
47 vfalu,vfwalu,vfmul,vfdiv,vfwmul,vfmuladd,vfwmuladd,vfsqrt,vfrecp,\
48 vfcmp,vfminmax,vfsgnj,vfclass,vfmerge,vfmov,\
49 vfcvtitof,vfcvtftoi,vfwcvtitof,vfwcvtftoi,\
50 vfwcvtftof,vfncvtitof,vfncvtftoi,vfncvtftof,\
51 vired,viwred,vfredu,vfredo,vfwredu,vfwredo,\
52 vmalu,vmpop,vmffs,vmsfs,vmiota,vmidx,vimovvx,vimovxv,vfmovvf,vfmovfv,\
53 vslideup,vslidedown,vislide1up,vislide1down,vfslide1up,vfslide1down,\
54 vgather,vcompress,vlsegde,vssegte,vlsegds,vssegts,vlsegdux,vlsegdox,\
55 vssegtux,vssegtox,vlsegdff,vandn,vbrev,vbrev8,vrev8,vclz,vctz,vrol,\
56 vror,vwsll,vclmul,vclmulh,vghsh,vgmul,vaesef,vaesem,vaesdf,vaesdm,\
57 vaeskf1,vaeskf2,vaesz,vsha2ms,vsha2ch,vsha2cl,vsm4k,vsm4r,vsm3me,vsm3c")
58 (const_string "true")]
59 (const_string "false")))
61 ;; True if the type is RVV instructions that include VL
62 ;; global status register in the use op list.
63 ;; The instruction need vector length to be specified is set
65 (define_attr "has_vl_op" "false,true"
66 (cond [(eq_attr "type" "vlde,vste,vldm,vstm,vlds,vsts,\
67 vldux,vldox,vstux,vstox,vldff,\
68 vialu,viwalu,vext,vicalu,vshift,vnshift,vicmp,viminmax,\
69 vimul,vidiv,viwmul,vimuladd,viwmuladd,vimerge,vimov,\
70 vsalu,vaalu,vsmul,vsshift,vnclip,\
71 vfalu,vfwalu,vfmul,vfdiv,vfwmul,vfmuladd,vfwmuladd,vfsqrt,vfrecp,\
72 vfcmp,vfminmax,vfsgnj,vfclass,vfmerge,vfmov,\
73 vfcvtitof,vfcvtftoi,vfwcvtitof,vfwcvtftoi,\
74 vfwcvtftof,vfncvtitof,vfncvtftoi,vfncvtftof,\
75 vired,viwred,vfredu,vfredo,vfwredu,vfwredo,\
76 vmalu,vmpop,vmffs,vmsfs,vmiota,vmidx,vimovxv,vfmovfv,\
77 vslideup,vslidedown,vislide1up,vislide1down,vfslide1up,vfslide1down,\
78 vgather,vcompress,vlsegde,vssegte,vlsegds,vssegts,vlsegdux,vlsegdox,\
79 vssegtux,vssegtox,vlsegdff,vandn,vbrev,vbrev8,vrev8,vclz,vctz,vrol,\
80 vror,vwsll,vclmul,vclmulh,vghsh,vgmul,vaesef,vaesem,vaesdf,vaesdm,\
81 vaeskf1,vaeskf2,vaesz,vsha2ms,vsha2ch,vsha2cl,vsm4k,vsm4r,vsm3me,vsm3c")
82 (const_string "true")]
83 (const_string "false")))
85 ;; The default SEW of RVV instruction. This attribute doesn't mean the instruction
86 ;; is necessary to require SEW check for example vlm.v which require ratio to
87 ;; check. However, we need default value of SEW for vsetvl instruction since there
88 ;; is no field for ratio in the vsetvl instruction encoding.
90 (cond [(eq_attr "mode" "RVVMF64BI,RVVMF32BI,RVVMF16BI,RVVMF8BI,RVVMF4BI,RVVMF2BI,RVVM1BI,\
91 RVVM8QI,RVVM4QI,RVVM2QI,RVVM1QI,RVVMF2QI,RVVMF4QI,RVVMF8QI,\
92 RVVM1x8QI,RVVMF2x8QI,RVVMF4x8QI,RVVMF8x8QI,\
93 RVVM1x7QI,RVVMF2x7QI,RVVMF4x7QI,RVVMF8x7QI,\
94 RVVM1x6QI,RVVMF2x6QI,RVVMF4x6QI,RVVMF8x6QI,\
95 RVVM1x5QI,RVVMF2x5QI,RVVMF4x5QI,RVVMF8x5QI,\
96 RVVM2x4QI,RVVM1x4QI,RVVMF2x4QI,RVVMF4x4QI,RVVMF8x4QI,\
97 RVVM2x3QI,RVVM1x3QI,RVVMF2x3QI,RVVMF4x3QI,RVVMF8x3QI,\
98 RVVM4x2QI,RVVM2x2QI,RVVM1x2QI,RVVMF2x2QI,RVVMF4x2QI,RVVMF8x2QI,\
99 V1QI,V2QI,V4QI,V8QI,V16QI,V32QI,V64QI,V128QI,V256QI,V512QI,V1024QI,V2048QI,V4096QI,\
100 V1BI,V2BI,V4BI,V8BI,V16BI,V32BI,V64BI,V128BI,V256BI,V512BI,V1024BI,V2048BI,V4096BI")
102 (eq_attr "mode" "RVVM8HI,RVVM4HI,RVVM2HI,RVVM1HI,RVVMF2HI,RVVMF4HI,\
103 RVVM1x8HI,RVVMF2x8HI,RVVMF4x8HI,\
104 RVVM1x7HI,RVVMF2x7HI,RVVMF4x7HI,\
105 RVVM1x6HI,RVVMF2x6HI,RVVMF4x6HI,\
106 RVVM1x5HI,RVVMF2x5HI,RVVMF4x5HI,\
107 RVVM2x4HI,RVVM1x4HI,RVVMF2x4HI,RVVMF4x4HI,\
108 RVVM2x3HI,RVVM1x3HI,RVVMF2x3HI,RVVMF4x3HI,\
109 RVVM4x2HI,RVVM2x2HI,RVVM1x2HI,RVVMF2x2HI,RVVMF4x2HI,\
110 RVVM8HF,RVVM4HF,RVVM2HF,RVVM1HF,RVVMF2HF,RVVMF4HF,\
111 RVVM1x8HF,RVVMF2x8HF,RVVMF4x8HF,\
112 RVVM1x7HF,RVVMF2x7HF,RVVMF4x7HF,\
113 RVVM1x6HF,RVVMF2x6HF,RVVMF4x6HF,\
114 RVVM1x5HF,RVVMF2x5HF,RVVMF4x5HF,\
115 RVVM2x4HF,RVVM1x4HF,RVVMF2x4HF,RVVMF4x4HF,\
116 RVVM2x3HF,RVVM1x3HF,RVVMF2x3HF,RVVMF4x3HF,\
117 RVVM4x2HF,RVVM2x2HF,RVVM1x2HF,RVVMF2x2HF,RVVMF4x2HF,\
118 V1HI,V2HI,V4HI,V8HI,V16HI,V32HI,V64HI,V128HI,V256HI,V512HI,V1024HI,V2048HI,\
119 V1HF,V2HF,V4HF,V8HF,V16HF,V32HF,V64HF,V128HF,V256HF,V512HF,V1024HF,V2048HF")
121 (eq_attr "mode" "RVVM8SI,RVVM4SI,RVVM2SI,RVVM1SI,RVVMF2SI,\
122 RVVM8SF,RVVM4SF,RVVM2SF,RVVM1SF,RVVMF2SF,\
123 RVVM1x8SI,RVVMF2x8SI,\
124 RVVM1x7SI,RVVMF2x7SI,\
125 RVVM1x6SI,RVVMF2x6SI,\
126 RVVM1x5SI,RVVMF2x5SI,\
127 RVVMF2x4SI,RVVMF2x3SI,\
128 RVVM2x4SI,RVVM1x4SI,\
129 RVVM2x3SI,RVVM1x3SI,\
130 RVVM4x2SI,RVVM2x2SI,RVVM1x2SI,RVVMF2x2SI,\
131 RVVM1x8SF,RVVMF2x8SF,\
132 RVVM1x7SF,RVVMF2x7SF,\
133 RVVM1x6SF,RVVMF2x6SF,\
134 RVVM1x5SF,RVVMF2x5SF,\
135 RVVM2x4SF,RVVM1x4SF,RVVMF2x4SF,\
136 RVVM2x3SF,RVVM1x3SF,RVVMF2x3SF,\
137 RVVM4x2SF,RVVM2x2SF,RVVM1x2SF,RVVMF2x2SF,\
138 V1SI,V2SI,V4SI,V8SI,V16SI,V32SI,V64SI,V128SI,V256SI,V512SI,V1024SI,\
139 V1SF,V2SF,V4SF,V8SF,V16SF,V32SF,V64SF,V128SF,V256SF,V512SF,V1024SF")
141 (eq_attr "mode" "RVVM8DI,RVVM4DI,RVVM2DI,RVVM1DI,\
142 RVVM8DF,RVVM4DF,RVVM2DF,RVVM1DF,\
143 RVVM1x8DI,RVVM1x7DI,RVVM1x6DI,RVVM1x5DI,\
144 RVVM2x4DI,RVVM1x4DI,\
145 RVVM2x3DI,RVVM1x3DI,\
146 RVVM4x2DI,RVVM2x2DI,RVVM1x2DI,\
147 RVVM1x8DF,RVVM1x7DF,RVVM1x6DF,RVVM1x5DF,\
148 RVVM2x4DF,RVVM1x4DF,\
149 RVVM2x3DF,RVVM1x3DF,\
150 RVVM4x2DF,RVVM2x2DF,RVVM1x2DF,\
151 V1DI,V2DI,V4DI,V8DI,V16DI,V32DI,V64DI,V128DI,V256DI,V512DI,\
152 V1DF,V2DF,V4DF,V8DF,V16DF,V32DF,V64DF,V128DF,V256DF,V512DF")
154 (const_int INVALID_ATTRIBUTE)))
157 (define_attr "vlmul" ""
158 (cond [(eq_attr "mode" "RVVM8QI,RVVM1BI") (symbol_ref "riscv_vector::LMUL_8")
159 (eq_attr "mode" "RVVM4QI,RVVMF2BI") (symbol_ref "riscv_vector::LMUL_4")
160 (eq_attr "mode" "RVVM2QI,RVVMF4BI") (symbol_ref "riscv_vector::LMUL_2")
161 (eq_attr "mode" "RVVM1QI,RVVMF8BI") (symbol_ref "riscv_vector::LMUL_1")
162 (eq_attr "mode" "RVVMF2QI,RVVMF16BI") (symbol_ref "riscv_vector::LMUL_F2")
163 (eq_attr "mode" "RVVMF4QI,RVVMF32BI") (symbol_ref "riscv_vector::LMUL_F4")
164 (eq_attr "mode" "RVVMF8QI,RVVMF64BI") (symbol_ref "riscv_vector::LMUL_F8")
165 (eq_attr "mode" "RVVM8HI") (symbol_ref "riscv_vector::LMUL_8")
166 (eq_attr "mode" "RVVM4HI") (symbol_ref "riscv_vector::LMUL_4")
167 (eq_attr "mode" "RVVM2HI") (symbol_ref "riscv_vector::LMUL_2")
168 (eq_attr "mode" "RVVM1HI") (symbol_ref "riscv_vector::LMUL_1")
169 (eq_attr "mode" "RVVMF2HI") (symbol_ref "riscv_vector::LMUL_F2")
170 (eq_attr "mode" "RVVMF4HI") (symbol_ref "riscv_vector::LMUL_F4")
171 (eq_attr "mode" "RVVM8HF") (symbol_ref "riscv_vector::LMUL_8")
172 (eq_attr "mode" "RVVM4HF") (symbol_ref "riscv_vector::LMUL_4")
173 (eq_attr "mode" "RVVM2HF") (symbol_ref "riscv_vector::LMUL_2")
174 (eq_attr "mode" "RVVM1HF") (symbol_ref "riscv_vector::LMUL_1")
175 (eq_attr "mode" "RVVMF2HF") (symbol_ref "riscv_vector::LMUL_F2")
176 (eq_attr "mode" "RVVMF4HF") (symbol_ref "riscv_vector::LMUL_F4")
177 (eq_attr "mode" "RVVM8SI") (symbol_ref "riscv_vector::LMUL_8")
178 (eq_attr "mode" "RVVM4SI") (symbol_ref "riscv_vector::LMUL_4")
179 (eq_attr "mode" "RVVM2SI") (symbol_ref "riscv_vector::LMUL_2")
180 (eq_attr "mode" "RVVM1SI") (symbol_ref "riscv_vector::LMUL_1")
181 (eq_attr "mode" "RVVMF2SI") (symbol_ref "riscv_vector::LMUL_F2")
182 (eq_attr "mode" "RVVM8SF") (symbol_ref "riscv_vector::LMUL_8")
183 (eq_attr "mode" "RVVM4SF") (symbol_ref "riscv_vector::LMUL_4")
184 (eq_attr "mode" "RVVM2SF") (symbol_ref "riscv_vector::LMUL_2")
185 (eq_attr "mode" "RVVM1SF") (symbol_ref "riscv_vector::LMUL_1")
186 (eq_attr "mode" "RVVMF2SF") (symbol_ref "riscv_vector::LMUL_F2")
187 (eq_attr "mode" "RVVM8DI") (symbol_ref "riscv_vector::LMUL_8")
188 (eq_attr "mode" "RVVM4DI") (symbol_ref "riscv_vector::LMUL_4")
189 (eq_attr "mode" "RVVM2DI") (symbol_ref "riscv_vector::LMUL_2")
190 (eq_attr "mode" "RVVM1DI") (symbol_ref "riscv_vector::LMUL_1")
191 (eq_attr "mode" "RVVM8DF") (symbol_ref "riscv_vector::LMUL_8")
192 (eq_attr "mode" "RVVM4DF") (symbol_ref "riscv_vector::LMUL_4")
193 (eq_attr "mode" "RVVM2DF") (symbol_ref "riscv_vector::LMUL_2")
194 (eq_attr "mode" "RVVM1DF") (symbol_ref "riscv_vector::LMUL_1")
195 (eq_attr "mode" "RVVM1x8QI") (symbol_ref "riscv_vector::LMUL_1")
196 (eq_attr "mode" "RVVMF2x8QI") (symbol_ref "riscv_vector::LMUL_F2")
197 (eq_attr "mode" "RVVMF4x8QI") (symbol_ref "riscv_vector::LMUL_F4")
198 (eq_attr "mode" "RVVMF8x8QI") (symbol_ref "riscv_vector::LMUL_F8")
199 (eq_attr "mode" "RVVM1x7QI") (symbol_ref "riscv_vector::LMUL_1")
200 (eq_attr "mode" "RVVMF2x7QI") (symbol_ref "riscv_vector::LMUL_F2")
201 (eq_attr "mode" "RVVMF4x7QI") (symbol_ref "riscv_vector::LMUL_F4")
202 (eq_attr "mode" "RVVMF8x7QI") (symbol_ref "riscv_vector::LMUL_F8")
203 (eq_attr "mode" "RVVM1x6QI") (symbol_ref "riscv_vector::LMUL_1")
204 (eq_attr "mode" "RVVMF2x6QI") (symbol_ref "riscv_vector::LMUL_F2")
205 (eq_attr "mode" "RVVMF4x6QI") (symbol_ref "riscv_vector::LMUL_F4")
206 (eq_attr "mode" "RVVMF8x6QI") (symbol_ref "riscv_vector::LMUL_F8")
207 (eq_attr "mode" "RVVM1x5QI") (symbol_ref "riscv_vector::LMUL_1")
208 (eq_attr "mode" "RVVMF2x5QI") (symbol_ref "riscv_vector::LMUL_F2")
209 (eq_attr "mode" "RVVMF4x5QI") (symbol_ref "riscv_vector::LMUL_F4")
210 (eq_attr "mode" "RVVMF8x5QI") (symbol_ref "riscv_vector::LMUL_F8")
211 (eq_attr "mode" "RVVM2x4QI") (symbol_ref "riscv_vector::LMUL_2")
212 (eq_attr "mode" "RVVM1x4QI") (symbol_ref "riscv_vector::LMUL_1")
213 (eq_attr "mode" "RVVMF2x4QI") (symbol_ref "riscv_vector::LMUL_F2")
214 (eq_attr "mode" "RVVMF4x4QI") (symbol_ref "riscv_vector::LMUL_F4")
215 (eq_attr "mode" "RVVMF8x4QI") (symbol_ref "riscv_vector::LMUL_F8")
216 (eq_attr "mode" "RVVM2x3QI") (symbol_ref "riscv_vector::LMUL_2")
217 (eq_attr "mode" "RVVM1x3QI") (symbol_ref "riscv_vector::LMUL_1")
218 (eq_attr "mode" "RVVMF2x3QI") (symbol_ref "riscv_vector::LMUL_F2")
219 (eq_attr "mode" "RVVMF4x3QI") (symbol_ref "riscv_vector::LMUL_F4")
220 (eq_attr "mode" "RVVMF8x3QI") (symbol_ref "riscv_vector::LMUL_F8")
221 (eq_attr "mode" "RVVM4x2QI") (symbol_ref "riscv_vector::LMUL_4")
222 (eq_attr "mode" "RVVM2x2QI") (symbol_ref "riscv_vector::LMUL_2")
223 (eq_attr "mode" "RVVM1x2QI") (symbol_ref "riscv_vector::LMUL_1")
224 (eq_attr "mode" "RVVMF2x2QI") (symbol_ref "riscv_vector::LMUL_F2")
225 (eq_attr "mode" "RVVMF4x2QI") (symbol_ref "riscv_vector::LMUL_F4")
226 (eq_attr "mode" "RVVMF8x2QI") (symbol_ref "riscv_vector::LMUL_F8")
227 (eq_attr "mode" "RVVM1x8HI") (symbol_ref "riscv_vector::LMUL_1")
228 (eq_attr "mode" "RVVMF2x8HI") (symbol_ref "riscv_vector::LMUL_F2")
229 (eq_attr "mode" "RVVMF4x8HI") (symbol_ref "riscv_vector::LMUL_F4")
230 (eq_attr "mode" "RVVM1x7HI") (symbol_ref "riscv_vector::LMUL_1")
231 (eq_attr "mode" "RVVMF2x7HI") (symbol_ref "riscv_vector::LMUL_F2")
232 (eq_attr "mode" "RVVMF4x7HI") (symbol_ref "riscv_vector::LMUL_F4")
233 (eq_attr "mode" "RVVM1x6HI") (symbol_ref "riscv_vector::LMUL_1")
234 (eq_attr "mode" "RVVMF2x6HI") (symbol_ref "riscv_vector::LMUL_F2")
235 (eq_attr "mode" "RVVMF4x6HI") (symbol_ref "riscv_vector::LMUL_F4")
236 (eq_attr "mode" "RVVM1x5HI") (symbol_ref "riscv_vector::LMUL_1")
237 (eq_attr "mode" "RVVMF2x5HI") (symbol_ref "riscv_vector::LMUL_F2")
238 (eq_attr "mode" "RVVMF4x5HI") (symbol_ref "riscv_vector::LMUL_F4")
239 (eq_attr "mode" "RVVM2x4HI") (symbol_ref "riscv_vector::LMUL_2")
240 (eq_attr "mode" "RVVM1x4HI") (symbol_ref "riscv_vector::LMUL_1")
241 (eq_attr "mode" "RVVMF2x4HI") (symbol_ref "riscv_vector::LMUL_F2")
242 (eq_attr "mode" "RVVMF4x4HI") (symbol_ref "riscv_vector::LMUL_F4")
243 (eq_attr "mode" "RVVM2x3HI") (symbol_ref "riscv_vector::LMUL_2")
244 (eq_attr "mode" "RVVM1x3HI") (symbol_ref "riscv_vector::LMUL_1")
245 (eq_attr "mode" "RVVMF2x3HI") (symbol_ref "riscv_vector::LMUL_F2")
246 (eq_attr "mode" "RVVMF4x3HI") (symbol_ref "riscv_vector::LMUL_F4")
247 (eq_attr "mode" "RVVM4x2HI") (symbol_ref "riscv_vector::LMUL_4")
248 (eq_attr "mode" "RVVM2x2HI") (symbol_ref "riscv_vector::LMUL_2")
249 (eq_attr "mode" "RVVM1x2HI") (symbol_ref "riscv_vector::LMUL_1")
250 (eq_attr "mode" "RVVMF2x2HI") (symbol_ref "riscv_vector::LMUL_F2")
251 (eq_attr "mode" "RVVMF4x2HI") (symbol_ref "riscv_vector::LMUL_F4")
252 (eq_attr "mode" "RVVM1x8HF") (symbol_ref "riscv_vector::LMUL_1")
253 (eq_attr "mode" "RVVMF2x8HF") (symbol_ref "riscv_vector::LMUL_F2")
254 (eq_attr "mode" "RVVMF4x8HF") (symbol_ref "riscv_vector::LMUL_F4")
255 (eq_attr "mode" "RVVM1x7HF") (symbol_ref "riscv_vector::LMUL_1")
256 (eq_attr "mode" "RVVMF2x7HF") (symbol_ref "riscv_vector::LMUL_F2")
257 (eq_attr "mode" "RVVMF4x7HF") (symbol_ref "riscv_vector::LMUL_F4")
258 (eq_attr "mode" "RVVM1x6HF") (symbol_ref "riscv_vector::LMUL_1")
259 (eq_attr "mode" "RVVMF2x6HF") (symbol_ref "riscv_vector::LMUL_F2")
260 (eq_attr "mode" "RVVMF4x6HF") (symbol_ref "riscv_vector::LMUL_F4")
261 (eq_attr "mode" "RVVM1x5HF") (symbol_ref "riscv_vector::LMUL_1")
262 (eq_attr "mode" "RVVMF2x5HF") (symbol_ref "riscv_vector::LMUL_F2")
263 (eq_attr "mode" "RVVMF4x5HF") (symbol_ref "riscv_vector::LMUL_F4")
264 (eq_attr "mode" "RVVM2x4HF") (symbol_ref "riscv_vector::LMUL_2")
265 (eq_attr "mode" "RVVM1x4HF") (symbol_ref "riscv_vector::LMUL_1")
266 (eq_attr "mode" "RVVMF2x4HF") (symbol_ref "riscv_vector::LMUL_F2")
267 (eq_attr "mode" "RVVMF4x4HF") (symbol_ref "riscv_vector::LMUL_F4")
268 (eq_attr "mode" "RVVM2x3HF") (symbol_ref "riscv_vector::LMUL_2")
269 (eq_attr "mode" "RVVM1x3HF") (symbol_ref "riscv_vector::LMUL_1")
270 (eq_attr "mode" "RVVMF2x3HF") (symbol_ref "riscv_vector::LMUL_F2")
271 (eq_attr "mode" "RVVMF4x3HF") (symbol_ref "riscv_vector::LMUL_F4")
272 (eq_attr "mode" "RVVM4x2HF") (symbol_ref "riscv_vector::LMUL_4")
273 (eq_attr "mode" "RVVM2x2HF") (symbol_ref "riscv_vector::LMUL_2")
274 (eq_attr "mode" "RVVM1x2HF") (symbol_ref "riscv_vector::LMUL_1")
275 (eq_attr "mode" "RVVMF2x2HF") (symbol_ref "riscv_vector::LMUL_F2")
276 (eq_attr "mode" "RVVMF4x2HF") (symbol_ref "riscv_vector::LMUL_F4")
277 (eq_attr "mode" "RVVM1x8SI") (symbol_ref "riscv_vector::LMUL_1")
278 (eq_attr "mode" "RVVMF2x8SI") (symbol_ref "riscv_vector::LMUL_F2")
279 (eq_attr "mode" "RVVM1x7SI") (symbol_ref "riscv_vector::LMUL_1")
280 (eq_attr "mode" "RVVMF2x7SI") (symbol_ref "riscv_vector::LMUL_F2")
281 (eq_attr "mode" "RVVM1x6SI") (symbol_ref "riscv_vector::LMUL_1")
282 (eq_attr "mode" "RVVMF2x6SI") (symbol_ref "riscv_vector::LMUL_F2")
283 (eq_attr "mode" "RVVM1x5SI") (symbol_ref "riscv_vector::LMUL_1")
284 (eq_attr "mode" "RVVMF2x5SI") (symbol_ref "riscv_vector::LMUL_F2")
285 (eq_attr "mode" "RVVM2x4SI") (symbol_ref "riscv_vector::LMUL_2")
286 (eq_attr "mode" "RVVM1x4SI") (symbol_ref "riscv_vector::LMUL_1")
287 (eq_attr "mode" "RVVMF2x4SI") (symbol_ref "riscv_vector::LMUL_F2")
288 (eq_attr "mode" "RVVM2x3SI") (symbol_ref "riscv_vector::LMUL_2")
289 (eq_attr "mode" "RVVM1x3SI") (symbol_ref "riscv_vector::LMUL_1")
290 (eq_attr "mode" "RVVMF2x3SI") (symbol_ref "riscv_vector::LMUL_F2")
291 (eq_attr "mode" "RVVM4x2SI") (symbol_ref "riscv_vector::LMUL_4")
292 (eq_attr "mode" "RVVM2x2SI") (symbol_ref "riscv_vector::LMUL_2")
293 (eq_attr "mode" "RVVM1x2SI") (symbol_ref "riscv_vector::LMUL_1")
294 (eq_attr "mode" "RVVMF2x2SI") (symbol_ref "riscv_vector::LMUL_F2")
295 (eq_attr "mode" "RVVM1x8SF") (symbol_ref "riscv_vector::LMUL_1")
296 (eq_attr "mode" "RVVMF2x8SF") (symbol_ref "riscv_vector::LMUL_F2")
297 (eq_attr "mode" "RVVM1x7SF") (symbol_ref "riscv_vector::LMUL_1")
298 (eq_attr "mode" "RVVMF2x7SF") (symbol_ref "riscv_vector::LMUL_F2")
299 (eq_attr "mode" "RVVM1x6SF") (symbol_ref "riscv_vector::LMUL_1")
300 (eq_attr "mode" "RVVMF2x6SF") (symbol_ref "riscv_vector::LMUL_F2")
301 (eq_attr "mode" "RVVM1x5SF") (symbol_ref "riscv_vector::LMUL_1")
302 (eq_attr "mode" "RVVMF2x5SF") (symbol_ref "riscv_vector::LMUL_F2")
303 (eq_attr "mode" "RVVM2x4SF") (symbol_ref "riscv_vector::LMUL_2")
304 (eq_attr "mode" "RVVM1x4SF") (symbol_ref "riscv_vector::LMUL_1")
305 (eq_attr "mode" "RVVMF2x4SF") (symbol_ref "riscv_vector::LMUL_F2")
306 (eq_attr "mode" "RVVM2x3SF") (symbol_ref "riscv_vector::LMUL_2")
307 (eq_attr "mode" "RVVM1x3SF") (symbol_ref "riscv_vector::LMUL_1")
308 (eq_attr "mode" "RVVMF2x3SF") (symbol_ref "riscv_vector::LMUL_F2")
309 (eq_attr "mode" "RVVM4x2SF") (symbol_ref "riscv_vector::LMUL_4")
310 (eq_attr "mode" "RVVM2x2SF") (symbol_ref "riscv_vector::LMUL_2")
311 (eq_attr "mode" "RVVM1x2SF") (symbol_ref "riscv_vector::LMUL_1")
312 (eq_attr "mode" "RVVMF2x2SF") (symbol_ref "riscv_vector::LMUL_F2")
313 (eq_attr "mode" "RVVM1x8DI") (symbol_ref "riscv_vector::LMUL_1")
314 (eq_attr "mode" "RVVM1x7DI") (symbol_ref "riscv_vector::LMUL_1")
315 (eq_attr "mode" "RVVM1x6DI") (symbol_ref "riscv_vector::LMUL_1")
316 (eq_attr "mode" "RVVM1x5DI") (symbol_ref "riscv_vector::LMUL_1")
317 (eq_attr "mode" "RVVM2x4DI") (symbol_ref "riscv_vector::LMUL_2")
318 (eq_attr "mode" "RVVM1x4DI") (symbol_ref "riscv_vector::LMUL_1")
319 (eq_attr "mode" "RVVM2x3DI") (symbol_ref "riscv_vector::LMUL_2")
320 (eq_attr "mode" "RVVM1x3DI") (symbol_ref "riscv_vector::LMUL_1")
321 (eq_attr "mode" "RVVM4x2DI") (symbol_ref "riscv_vector::LMUL_4")
322 (eq_attr "mode" "RVVM2x2DI") (symbol_ref "riscv_vector::LMUL_2")
323 (eq_attr "mode" "RVVM1x2DI") (symbol_ref "riscv_vector::LMUL_1")
324 (eq_attr "mode" "RVVM1x8DF") (symbol_ref "riscv_vector::LMUL_1")
325 (eq_attr "mode" "RVVM1x7DF") (symbol_ref "riscv_vector::LMUL_1")
326 (eq_attr "mode" "RVVM1x6DF") (symbol_ref "riscv_vector::LMUL_1")
327 (eq_attr "mode" "RVVM1x5DF") (symbol_ref "riscv_vector::LMUL_1")
328 (eq_attr "mode" "RVVM2x4DF") (symbol_ref "riscv_vector::LMUL_2")
329 (eq_attr "mode" "RVVM1x4DF") (symbol_ref "riscv_vector::LMUL_1")
330 (eq_attr "mode" "RVVM2x3DF") (symbol_ref "riscv_vector::LMUL_2")
331 (eq_attr "mode" "RVVM1x3DF") (symbol_ref "riscv_vector::LMUL_1")
332 (eq_attr "mode" "RVVM4x2DF") (symbol_ref "riscv_vector::LMUL_4")
333 (eq_attr "mode" "RVVM2x2DF") (symbol_ref "riscv_vector::LMUL_2")
334 (eq_attr "mode" "RVVM1x2DF") (symbol_ref "riscv_vector::LMUL_1")
337 (eq_attr "mode" "V1QI,V1BI") (symbol_ref "riscv_vector::get_vlmul(E_V1QImode)")
338 (eq_attr "mode" "V2QI,V2BI") (symbol_ref "riscv_vector::get_vlmul(E_V2QImode)")
339 (eq_attr "mode" "V4QI,V4BI") (symbol_ref "riscv_vector::get_vlmul(E_V4QImode)")
340 (eq_attr "mode" "V8QI,V8BI") (symbol_ref "riscv_vector::get_vlmul(E_V8QImode)")
341 (eq_attr "mode" "V16QI,V16BI") (symbol_ref "riscv_vector::get_vlmul(E_V16QImode)")
342 (eq_attr "mode" "V32QI,V32BI") (symbol_ref "riscv_vector::get_vlmul(E_V32QImode)")
343 (eq_attr "mode" "V64QI,V64BI") (symbol_ref "riscv_vector::get_vlmul(E_V64QImode)")
344 (eq_attr "mode" "V128QI,V128BI") (symbol_ref "riscv_vector::get_vlmul(E_V128QImode)")
345 (eq_attr "mode" "V256QI,V256BI") (symbol_ref "riscv_vector::get_vlmul(E_V256QImode)")
346 (eq_attr "mode" "V512QI,V512BI") (symbol_ref "riscv_vector::get_vlmul(E_V512QImode)")
347 (eq_attr "mode" "V1024QI,V1024BI") (symbol_ref "riscv_vector::get_vlmul(E_V1024QImode)")
348 (eq_attr "mode" "V2048QI,V2048BI") (symbol_ref "riscv_vector::get_vlmul(E_V2048QImode)")
349 (eq_attr "mode" "V4096QI,V4096BI") (symbol_ref "riscv_vector::get_vlmul(E_V4096QImode)")
350 (eq_attr "mode" "V1HI") (symbol_ref "riscv_vector::get_vlmul(E_V1HImode)")
351 (eq_attr "mode" "V2HI") (symbol_ref "riscv_vector::get_vlmul(E_V2HImode)")
352 (eq_attr "mode" "V4HI") (symbol_ref "riscv_vector::get_vlmul(E_V4HImode)")
353 (eq_attr "mode" "V8HI") (symbol_ref "riscv_vector::get_vlmul(E_V8HImode)")
354 (eq_attr "mode" "V16HI") (symbol_ref "riscv_vector::get_vlmul(E_V16HImode)")
355 (eq_attr "mode" "V32HI") (symbol_ref "riscv_vector::get_vlmul(E_V32HImode)")
356 (eq_attr "mode" "V64HI") (symbol_ref "riscv_vector::get_vlmul(E_V64HImode)")
357 (eq_attr "mode" "V128HI") (symbol_ref "riscv_vector::get_vlmul(E_V128HImode)")
358 (eq_attr "mode" "V256HI") (symbol_ref "riscv_vector::get_vlmul(E_V256HImode)")
359 (eq_attr "mode" "V512HI") (symbol_ref "riscv_vector::get_vlmul(E_V512HImode)")
360 (eq_attr "mode" "V1024HI") (symbol_ref "riscv_vector::get_vlmul(E_V1024HImode)")
361 (eq_attr "mode" "V2048HI") (symbol_ref "riscv_vector::get_vlmul(E_V2048HImode)")
362 (eq_attr "mode" "V1SI") (symbol_ref "riscv_vector::get_vlmul(E_V1SImode)")
363 (eq_attr "mode" "V2SI") (symbol_ref "riscv_vector::get_vlmul(E_V2SImode)")
364 (eq_attr "mode" "V4SI") (symbol_ref "riscv_vector::get_vlmul(E_V4SImode)")
365 (eq_attr "mode" "V8SI") (symbol_ref "riscv_vector::get_vlmul(E_V8SImode)")
366 (eq_attr "mode" "V16SI") (symbol_ref "riscv_vector::get_vlmul(E_V16SImode)")
367 (eq_attr "mode" "V32SI") (symbol_ref "riscv_vector::get_vlmul(E_V32SImode)")
368 (eq_attr "mode" "V64SI") (symbol_ref "riscv_vector::get_vlmul(E_V64SImode)")
369 (eq_attr "mode" "V128SI") (symbol_ref "riscv_vector::get_vlmul(E_V128SImode)")
370 (eq_attr "mode" "V256SI") (symbol_ref "riscv_vector::get_vlmul(E_V256SImode)")
371 (eq_attr "mode" "V512SI") (symbol_ref "riscv_vector::get_vlmul(E_V512SImode)")
372 (eq_attr "mode" "V1024SI") (symbol_ref "riscv_vector::get_vlmul(E_V1024SImode)")
373 (eq_attr "mode" "V1DI") (symbol_ref "riscv_vector::get_vlmul(E_V1DImode)")
374 (eq_attr "mode" "V2DI") (symbol_ref "riscv_vector::get_vlmul(E_V2DImode)")
375 (eq_attr "mode" "V4DI") (symbol_ref "riscv_vector::get_vlmul(E_V4DImode)")
376 (eq_attr "mode" "V8DI") (symbol_ref "riscv_vector::get_vlmul(E_V8DImode)")
377 (eq_attr "mode" "V16DI") (symbol_ref "riscv_vector::get_vlmul(E_V16DImode)")
378 (eq_attr "mode" "V32DI") (symbol_ref "riscv_vector::get_vlmul(E_V32DImode)")
379 (eq_attr "mode" "V64DI") (symbol_ref "riscv_vector::get_vlmul(E_V64DImode)")
380 (eq_attr "mode" "V128DI") (symbol_ref "riscv_vector::get_vlmul(E_V128DImode)")
381 (eq_attr "mode" "V256DI") (symbol_ref "riscv_vector::get_vlmul(E_V256DImode)")
382 (eq_attr "mode" "V512DI") (symbol_ref "riscv_vector::get_vlmul(E_V512DImode)")
383 (eq_attr "mode" "V1HF") (symbol_ref "riscv_vector::get_vlmul(E_V1HFmode)")
384 (eq_attr "mode" "V2HF") (symbol_ref "riscv_vector::get_vlmul(E_V2HFmode)")
385 (eq_attr "mode" "V4HF") (symbol_ref "riscv_vector::get_vlmul(E_V4HFmode)")
386 (eq_attr "mode" "V8HF") (symbol_ref "riscv_vector::get_vlmul(E_V8HFmode)")
387 (eq_attr "mode" "V16HF") (symbol_ref "riscv_vector::get_vlmul(E_V16HFmode)")
388 (eq_attr "mode" "V32HF") (symbol_ref "riscv_vector::get_vlmul(E_V32HFmode)")
389 (eq_attr "mode" "V64HF") (symbol_ref "riscv_vector::get_vlmul(E_V64HFmode)")
390 (eq_attr "mode" "V128HF") (symbol_ref "riscv_vector::get_vlmul(E_V128HFmode)")
391 (eq_attr "mode" "V256HF") (symbol_ref "riscv_vector::get_vlmul(E_V256HFmode)")
392 (eq_attr "mode" "V512HF") (symbol_ref "riscv_vector::get_vlmul(E_V512HFmode)")
393 (eq_attr "mode" "V1024HF") (symbol_ref "riscv_vector::get_vlmul(E_V1024HFmode)")
394 (eq_attr "mode" "V2048HF") (symbol_ref "riscv_vector::get_vlmul(E_V2048HFmode)")
395 (eq_attr "mode" "V1SF") (symbol_ref "riscv_vector::get_vlmul(E_V1SFmode)")
396 (eq_attr "mode" "V2SF") (symbol_ref "riscv_vector::get_vlmul(E_V2SFmode)")
397 (eq_attr "mode" "V4SF") (symbol_ref "riscv_vector::get_vlmul(E_V4SFmode)")
398 (eq_attr "mode" "V8SF") (symbol_ref "riscv_vector::get_vlmul(E_V8SFmode)")
399 (eq_attr "mode" "V16SF") (symbol_ref "riscv_vector::get_vlmul(E_V16SFmode)")
400 (eq_attr "mode" "V32SF") (symbol_ref "riscv_vector::get_vlmul(E_V32SFmode)")
401 (eq_attr "mode" "V64SF") (symbol_ref "riscv_vector::get_vlmul(E_V64SFmode)")
402 (eq_attr "mode" "V128SF") (symbol_ref "riscv_vector::get_vlmul(E_V128SFmode)")
403 (eq_attr "mode" "V256SF") (symbol_ref "riscv_vector::get_vlmul(E_V256SFmode)")
404 (eq_attr "mode" "V512SF") (symbol_ref "riscv_vector::get_vlmul(E_V512SFmode)")
405 (eq_attr "mode" "V1024SF") (symbol_ref "riscv_vector::get_vlmul(E_V1024SFmode)")
406 (eq_attr "mode" "V1DF") (symbol_ref "riscv_vector::get_vlmul(E_V1DFmode)")
407 (eq_attr "mode" "V2DF") (symbol_ref "riscv_vector::get_vlmul(E_V2DFmode)")
408 (eq_attr "mode" "V4DF") (symbol_ref "riscv_vector::get_vlmul(E_V4DFmode)")
409 (eq_attr "mode" "V8DF") (symbol_ref "riscv_vector::get_vlmul(E_V8DFmode)")
410 (eq_attr "mode" "V16DF") (symbol_ref "riscv_vector::get_vlmul(E_V16DFmode)")
411 (eq_attr "mode" "V32DF") (symbol_ref "riscv_vector::get_vlmul(E_V32DFmode)")
412 (eq_attr "mode" "V64DF") (symbol_ref "riscv_vector::get_vlmul(E_V64DFmode)")
413 (eq_attr "mode" "V128DF") (symbol_ref "riscv_vector::get_vlmul(E_V128DFmode)")
414 (eq_attr "mode" "V256DF") (symbol_ref "riscv_vector::get_vlmul(E_V256DFmode)")
415 (eq_attr "mode" "V512DF") (symbol_ref "riscv_vector::get_vlmul(E_V512DFmode)")]
416 (const_int INVALID_ATTRIBUTE)))
418 ;; It is valid for instruction that require sew/lmul ratio.
419 (define_attr "ratio" ""
420 (cond [(eq_attr "type" "vimov,vfmov,vldux,vldox,vstux,vstox,\
421 vialu,vshift,vicmp,vimul,vidiv,vsalu,\
422 vext,viwalu,viwmul,vicalu,vnshift,\
423 vimuladd,vimerge,vaalu,vsmul,vsshift,\
424 vnclip,viminmax,viwmuladd,vmffs,vmsfs,\
425 vmiota,vmidx,vfalu,vfmul,vfminmax,vfdiv,\
426 vfwalu,vfwmul,vfsqrt,vfrecp,vfsgnj,vfcmp,\
427 vfmerge,vfcvtitof,vfcvtftoi,vfwcvtitof,\
428 vfwcvtftoi,vfwcvtftof,vfncvtitof,vfncvtftoi,\
429 vfncvtftof,vfmuladd,vfwmuladd,vfclass,vired,\
430 viwred,vfredu,vfredo,vfwredu,vfwredo,vimovvx,\
431 vimovxv,vfmovvf,vfmovfv,vslideup,vslidedown,\
432 vislide1up,vislide1down,vfslide1up,vfslide1down,\
433 vgather,vcompress,vlsegdux,vlsegdox,vssegtux,vssegtox,\
434 vandn,vbrev,vbrev8,vrev8,vclz,vctz,vrol,vror,vwsll,\
435 vclmul,vclmulh,vghsh,vgmul,vaesef,vaesem,vaesdf,vaesdm,\
436 vaeskf1,vaeskf2,vaesz,vsha2ms,vsha2ch,vsha2cl,vsm4k,vsm4r,\
438 (const_int INVALID_ATTRIBUTE)
439 (eq_attr "mode" "RVVM8QI,RVVM1BI") (const_int 1)
440 (eq_attr "mode" "RVVM4QI,RVVMF2BI") (const_int 2)
441 (eq_attr "mode" "RVVM2QI,RVVMF4BI") (const_int 4)
442 (eq_attr "mode" "RVVM1QI,RVVMF8BI") (const_int 8)
443 (eq_attr "mode" "RVVMF2QI,RVVMF16BI") (const_int 16)
444 (eq_attr "mode" "RVVMF4QI,RVVMF32BI") (const_int 32)
445 (eq_attr "mode" "RVVMF8QI,RVVMF64BI") (const_int 64)
446 (eq_attr "mode" "RVVM8HI") (const_int 2)
447 (eq_attr "mode" "RVVM4HI") (const_int 4)
448 (eq_attr "mode" "RVVM2HI") (const_int 8)
449 (eq_attr "mode" "RVVM1HI") (const_int 16)
450 (eq_attr "mode" "RVVMF2HI") (const_int 32)
451 (eq_attr "mode" "RVVMF4HI") (const_int 64)
452 (eq_attr "mode" "RVVM8HF") (const_int 2)
453 (eq_attr "mode" "RVVM4HF") (const_int 4)
454 (eq_attr "mode" "RVVM2HF") (const_int 8)
455 (eq_attr "mode" "RVVM1HF") (const_int 16)
456 (eq_attr "mode" "RVVMF2HF") (const_int 32)
457 (eq_attr "mode" "RVVMF4HF") (const_int 64)
458 (eq_attr "mode" "RVVM8SI") (const_int 4)
459 (eq_attr "mode" "RVVM4SI") (const_int 8)
460 (eq_attr "mode" "RVVM2SI") (const_int 16)
461 (eq_attr "mode" "RVVM1SI") (const_int 32)
462 (eq_attr "mode" "RVVMF2SI") (const_int 64)
463 (eq_attr "mode" "RVVM8SF") (const_int 4)
464 (eq_attr "mode" "RVVM4SF") (const_int 8)
465 (eq_attr "mode" "RVVM2SF") (const_int 16)
466 (eq_attr "mode" "RVVM1SF") (const_int 32)
467 (eq_attr "mode" "RVVMF2SF") (const_int 64)
468 (eq_attr "mode" "RVVM8DI") (const_int 8)
469 (eq_attr "mode" "RVVM4DI") (const_int 16)
470 (eq_attr "mode" "RVVM2DI") (const_int 32)
471 (eq_attr "mode" "RVVM1DI") (const_int 64)
472 (eq_attr "mode" "RVVM8DF") (const_int 8)
473 (eq_attr "mode" "RVVM4DF") (const_int 16)
474 (eq_attr "mode" "RVVM2DF") (const_int 32)
475 (eq_attr "mode" "RVVM1DF") (const_int 64)
476 (eq_attr "mode" "RVVM1x8QI") (const_int 8)
477 (eq_attr "mode" "RVVMF2x8QI") (const_int 16)
478 (eq_attr "mode" "RVVMF4x8QI") (const_int 32)
479 (eq_attr "mode" "RVVMF8x8QI") (const_int 64)
480 (eq_attr "mode" "RVVM1x7QI") (const_int 8)
481 (eq_attr "mode" "RVVMF2x7QI") (const_int 16)
482 (eq_attr "mode" "RVVMF4x7QI") (const_int 32)
483 (eq_attr "mode" "RVVMF8x7QI") (const_int 64)
484 (eq_attr "mode" "RVVM1x6QI") (const_int 8)
485 (eq_attr "mode" "RVVMF2x6QI") (const_int 16)
486 (eq_attr "mode" "RVVMF4x6QI") (const_int 32)
487 (eq_attr "mode" "RVVMF8x6QI") (const_int 64)
488 (eq_attr "mode" "RVVM1x5QI") (const_int 8)
489 (eq_attr "mode" "RVVMF2x5QI") (const_int 16)
490 (eq_attr "mode" "RVVMF4x5QI") (const_int 32)
491 (eq_attr "mode" "RVVMF8x5QI") (const_int 64)
492 (eq_attr "mode" "RVVM2x4QI") (const_int 4)
493 (eq_attr "mode" "RVVM1x4QI") (const_int 8)
494 (eq_attr "mode" "RVVMF2x4QI") (const_int 16)
495 (eq_attr "mode" "RVVMF4x4QI") (const_int 32)
496 (eq_attr "mode" "RVVMF8x4QI") (const_int 64)
497 (eq_attr "mode" "RVVM2x3QI") (const_int 4)
498 (eq_attr "mode" "RVVM1x3QI") (const_int 8)
499 (eq_attr "mode" "RVVMF2x3QI") (const_int 16)
500 (eq_attr "mode" "RVVMF4x3QI") (const_int 32)
501 (eq_attr "mode" "RVVMF8x3QI") (const_int 64)
502 (eq_attr "mode" "RVVM4x2QI") (const_int 2)
503 (eq_attr "mode" "RVVM2x2QI") (const_int 4)
504 (eq_attr "mode" "RVVM1x2QI") (const_int 8)
505 (eq_attr "mode" "RVVMF2x2QI") (const_int 16)
506 (eq_attr "mode" "RVVMF4x2QI") (const_int 32)
507 (eq_attr "mode" "RVVMF8x2QI") (const_int 64)
508 (eq_attr "mode" "RVVM1x8HI") (const_int 16)
509 (eq_attr "mode" "RVVMF2x8HI") (const_int 32)
510 (eq_attr "mode" "RVVMF4x8HI") (const_int 64)
511 (eq_attr "mode" "RVVM1x7HI") (const_int 16)
512 (eq_attr "mode" "RVVMF2x7HI") (const_int 32)
513 (eq_attr "mode" "RVVMF4x7HI") (const_int 64)
514 (eq_attr "mode" "RVVM1x6HI") (const_int 16)
515 (eq_attr "mode" "RVVMF2x6HI") (const_int 32)
516 (eq_attr "mode" "RVVMF4x6HI") (const_int 64)
517 (eq_attr "mode" "RVVM1x5HI") (const_int 16)
518 (eq_attr "mode" "RVVMF2x5HI") (const_int 32)
519 (eq_attr "mode" "RVVMF4x5HI") (const_int 64)
520 (eq_attr "mode" "RVVM2x4HI") (const_int 8)
521 (eq_attr "mode" "RVVM1x4HI") (const_int 16)
522 (eq_attr "mode" "RVVMF2x4HI") (const_int 32)
523 (eq_attr "mode" "RVVMF4x4HI") (const_int 64)
524 (eq_attr "mode" "RVVM2x3HI") (const_int 8)
525 (eq_attr "mode" "RVVM1x3HI") (const_int 16)
526 (eq_attr "mode" "RVVMF2x3HI") (const_int 32)
527 (eq_attr "mode" "RVVMF4x3HI") (const_int 64)
528 (eq_attr "mode" "RVVM4x2HI") (const_int 4)
529 (eq_attr "mode" "RVVM2x2HI") (const_int 8)
530 (eq_attr "mode" "RVVM1x2HI") (const_int 16)
531 (eq_attr "mode" "RVVMF2x2HI") (const_int 32)
532 (eq_attr "mode" "RVVMF4x2HI") (const_int 64)
533 (eq_attr "mode" "RVVM1x8HF") (const_int 16)
534 (eq_attr "mode" "RVVMF2x8HF") (const_int 32)
535 (eq_attr "mode" "RVVMF4x8HF") (const_int 64)
536 (eq_attr "mode" "RVVM1x7HF") (const_int 16)
537 (eq_attr "mode" "RVVMF2x7HF") (const_int 32)
538 (eq_attr "mode" "RVVMF4x7HF") (const_int 64)
539 (eq_attr "mode" "RVVM1x6HF") (const_int 16)
540 (eq_attr "mode" "RVVMF2x6HF") (const_int 32)
541 (eq_attr "mode" "RVVMF4x6HF") (const_int 64)
542 (eq_attr "mode" "RVVM1x5HF") (const_int 16)
543 (eq_attr "mode" "RVVMF2x5HF") (const_int 32)
544 (eq_attr "mode" "RVVMF4x5HF") (const_int 64)
545 (eq_attr "mode" "RVVM2x4HF") (const_int 8)
546 (eq_attr "mode" "RVVM1x4HF") (const_int 16)
547 (eq_attr "mode" "RVVMF2x4HF") (const_int 32)
548 (eq_attr "mode" "RVVMF4x4HF") (const_int 64)
549 (eq_attr "mode" "RVVM2x3HF") (const_int 8)
550 (eq_attr "mode" "RVVM1x3HF") (const_int 16)
551 (eq_attr "mode" "RVVMF2x3HF") (const_int 32)
552 (eq_attr "mode" "RVVMF4x3HF") (const_int 64)
553 (eq_attr "mode" "RVVM4x2HF") (const_int 4)
554 (eq_attr "mode" "RVVM2x2HF") (const_int 8)
555 (eq_attr "mode" "RVVM1x2HF") (const_int 16)
556 (eq_attr "mode" "RVVMF2x2HF") (const_int 32)
557 (eq_attr "mode" "RVVMF4x2HF") (const_int 64)
558 (eq_attr "mode" "RVVM1x8SI") (const_int 32)
559 (eq_attr "mode" "RVVMF2x8SI") (const_int 64)
560 (eq_attr "mode" "RVVM1x7SI") (const_int 32)
561 (eq_attr "mode" "RVVMF2x7SI") (const_int 64)
562 (eq_attr "mode" "RVVM1x6SI") (const_int 32)
563 (eq_attr "mode" "RVVMF2x6SI") (const_int 64)
564 (eq_attr "mode" "RVVM1x5SI") (const_int 32)
565 (eq_attr "mode" "RVVMF2x5SI") (const_int 64)
566 (eq_attr "mode" "RVVM2x4SI") (const_int 16)
567 (eq_attr "mode" "RVVM1x4SI") (const_int 32)
568 (eq_attr "mode" "RVVMF2x4SI") (const_int 64)
569 (eq_attr "mode" "RVVM2x3SI") (const_int 16)
570 (eq_attr "mode" "RVVM1x3SI") (const_int 32)
571 (eq_attr "mode" "RVVMF2x3SI") (const_int 64)
572 (eq_attr "mode" "RVVM4x2SI") (const_int 8)
573 (eq_attr "mode" "RVVM2x2SI") (const_int 16)
574 (eq_attr "mode" "RVVM1x2SI") (const_int 32)
575 (eq_attr "mode" "RVVMF2x2SI") (const_int 64)
576 (eq_attr "mode" "RVVM1x8SF") (const_int 32)
577 (eq_attr "mode" "RVVMF2x8SF") (const_int 64)
578 (eq_attr "mode" "RVVM1x7SF") (const_int 32)
579 (eq_attr "mode" "RVVMF2x7SF") (const_int 64)
580 (eq_attr "mode" "RVVM1x6SF") (const_int 32)
581 (eq_attr "mode" "RVVMF2x6SF") (const_int 64)
582 (eq_attr "mode" "RVVM1x5SF") (const_int 32)
583 (eq_attr "mode" "RVVMF2x5SF") (const_int 64)
584 (eq_attr "mode" "RVVM2x4SF") (const_int 16)
585 (eq_attr "mode" "RVVM1x4SF") (const_int 32)
586 (eq_attr "mode" "RVVMF2x4SF") (const_int 64)
587 (eq_attr "mode" "RVVM2x3SF") (const_int 16)
588 (eq_attr "mode" "RVVM1x3SF") (const_int 32)
589 (eq_attr "mode" "RVVMF2x3SF") (const_int 64)
590 (eq_attr "mode" "RVVM4x2SF") (const_int 8)
591 (eq_attr "mode" "RVVM2x2SF") (const_int 16)
592 (eq_attr "mode" "RVVM1x2SF") (const_int 32)
593 (eq_attr "mode" "RVVMF2x2SF") (const_int 64)
594 (eq_attr "mode" "RVVM1x8DI") (const_int 64)
595 (eq_attr "mode" "RVVM1x7DI") (const_int 64)
596 (eq_attr "mode" "RVVM1x6DI") (const_int 64)
597 (eq_attr "mode" "RVVM1x5DI") (const_int 64)
598 (eq_attr "mode" "RVVM2x4DI") (const_int 32)
599 (eq_attr "mode" "RVVM1x4DI") (const_int 64)
600 (eq_attr "mode" "RVVM2x3DI") (const_int 32)
601 (eq_attr "mode" "RVVM1x3DI") (const_int 64)
602 (eq_attr "mode" "RVVM4x2DI") (const_int 16)
603 (eq_attr "mode" "RVVM2x2DI") (const_int 32)
604 (eq_attr "mode" "RVVM1x2DI") (const_int 64)
605 (eq_attr "mode" "RVVM1x8DF") (const_int 64)
606 (eq_attr "mode" "RVVM1x7DF") (const_int 64)
607 (eq_attr "mode" "RVVM1x6DF") (const_int 64)
608 (eq_attr "mode" "RVVM1x5DF") (const_int 64)
609 (eq_attr "mode" "RVVM2x4DF") (const_int 32)
610 (eq_attr "mode" "RVVM1x4DF") (const_int 64)
611 (eq_attr "mode" "RVVM2x3DF") (const_int 32)
612 (eq_attr "mode" "RVVM1x3DF") (const_int 64)
613 (eq_attr "mode" "RVVM4x2DF") (const_int 16)
614 (eq_attr "mode" "RVVM2x2DF") (const_int 32)
615 (eq_attr "mode" "RVVM1x2DF") (const_int 64)
618 (eq_attr "mode" "V1QI,V1BI") (symbol_ref "riscv_vector::get_ratio(E_V1QImode)")
619 (eq_attr "mode" "V2QI,V2BI") (symbol_ref "riscv_vector::get_ratio(E_V2QImode)")
620 (eq_attr "mode" "V4QI,V4BI") (symbol_ref "riscv_vector::get_ratio(E_V4QImode)")
621 (eq_attr "mode" "V8QI,V8BI") (symbol_ref "riscv_vector::get_ratio(E_V8QImode)")
622 (eq_attr "mode" "V16QI,V16BI") (symbol_ref "riscv_vector::get_ratio(E_V16QImode)")
623 (eq_attr "mode" "V32QI,V32BI") (symbol_ref "riscv_vector::get_ratio(E_V32QImode)")
624 (eq_attr "mode" "V64QI,V64BI") (symbol_ref "riscv_vector::get_ratio(E_V64QImode)")
625 (eq_attr "mode" "V128QI,V128BI") (symbol_ref "riscv_vector::get_ratio(E_V128QImode)")
626 (eq_attr "mode" "V256QI,V256BI") (symbol_ref "riscv_vector::get_ratio(E_V256QImode)")
627 (eq_attr "mode" "V512QI,V512BI") (symbol_ref "riscv_vector::get_ratio(E_V512QImode)")
628 (eq_attr "mode" "V1024QI,V1024BI") (symbol_ref "riscv_vector::get_ratio(E_V1024QImode)")
629 (eq_attr "mode" "V2048QI,V2048BI") (symbol_ref "riscv_vector::get_ratio(E_V2048QImode)")
630 (eq_attr "mode" "V4096QI,V4096BI") (symbol_ref "riscv_vector::get_ratio(E_V4096QImode)")
631 (eq_attr "mode" "V1HI") (symbol_ref "riscv_vector::get_ratio(E_V1HImode)")
632 (eq_attr "mode" "V2HI") (symbol_ref "riscv_vector::get_ratio(E_V2HImode)")
633 (eq_attr "mode" "V4HI") (symbol_ref "riscv_vector::get_ratio(E_V4HImode)")
634 (eq_attr "mode" "V8HI") (symbol_ref "riscv_vector::get_ratio(E_V8HImode)")
635 (eq_attr "mode" "V16HI") (symbol_ref "riscv_vector::get_ratio(E_V16HImode)")
636 (eq_attr "mode" "V32HI") (symbol_ref "riscv_vector::get_ratio(E_V32HImode)")
637 (eq_attr "mode" "V64HI") (symbol_ref "riscv_vector::get_ratio(E_V64HImode)")
638 (eq_attr "mode" "V128HI") (symbol_ref "riscv_vector::get_ratio(E_V128HImode)")
639 (eq_attr "mode" "V256HI") (symbol_ref "riscv_vector::get_ratio(E_V256HImode)")
640 (eq_attr "mode" "V512HI") (symbol_ref "riscv_vector::get_ratio(E_V512HImode)")
641 (eq_attr "mode" "V1024HI") (symbol_ref "riscv_vector::get_ratio(E_V1024HImode)")
642 (eq_attr "mode" "V2048HI") (symbol_ref "riscv_vector::get_ratio(E_V2048HImode)")
643 (eq_attr "mode" "V1SI") (symbol_ref "riscv_vector::get_ratio(E_V1SImode)")
644 (eq_attr "mode" "V2SI") (symbol_ref "riscv_vector::get_ratio(E_V2SImode)")
645 (eq_attr "mode" "V4SI") (symbol_ref "riscv_vector::get_ratio(E_V4SImode)")
646 (eq_attr "mode" "V8SI") (symbol_ref "riscv_vector::get_ratio(E_V8SImode)")
647 (eq_attr "mode" "V16SI") (symbol_ref "riscv_vector::get_ratio(E_V16SImode)")
648 (eq_attr "mode" "V32SI") (symbol_ref "riscv_vector::get_ratio(E_V32SImode)")
649 (eq_attr "mode" "V64SI") (symbol_ref "riscv_vector::get_ratio(E_V64SImode)")
650 (eq_attr "mode" "V128SI") (symbol_ref "riscv_vector::get_ratio(E_V128SImode)")
651 (eq_attr "mode" "V256SI") (symbol_ref "riscv_vector::get_ratio(E_V256SImode)")
652 (eq_attr "mode" "V512SI") (symbol_ref "riscv_vector::get_ratio(E_V512SImode)")
653 (eq_attr "mode" "V1024SI") (symbol_ref "riscv_vector::get_ratio(E_V1024SImode)")
654 (eq_attr "mode" "V1DI") (symbol_ref "riscv_vector::get_ratio(E_V1DImode)")
655 (eq_attr "mode" "V2DI") (symbol_ref "riscv_vector::get_ratio(E_V2DImode)")
656 (eq_attr "mode" "V4DI") (symbol_ref "riscv_vector::get_ratio(E_V4DImode)")
657 (eq_attr "mode" "V8DI") (symbol_ref "riscv_vector::get_ratio(E_V8DImode)")
658 (eq_attr "mode" "V16DI") (symbol_ref "riscv_vector::get_ratio(E_V16DImode)")
659 (eq_attr "mode" "V32DI") (symbol_ref "riscv_vector::get_ratio(E_V32DImode)")
660 (eq_attr "mode" "V64DI") (symbol_ref "riscv_vector::get_ratio(E_V64DImode)")
661 (eq_attr "mode" "V128DI") (symbol_ref "riscv_vector::get_ratio(E_V128DImode)")
662 (eq_attr "mode" "V256DI") (symbol_ref "riscv_vector::get_ratio(E_V256DImode)")
663 (eq_attr "mode" "V512DI") (symbol_ref "riscv_vector::get_ratio(E_V512DImode)")
664 (eq_attr "mode" "V1HF") (symbol_ref "riscv_vector::get_ratio(E_V1HFmode)")
665 (eq_attr "mode" "V2HF") (symbol_ref "riscv_vector::get_ratio(E_V2HFmode)")
666 (eq_attr "mode" "V4HF") (symbol_ref "riscv_vector::get_ratio(E_V4HFmode)")
667 (eq_attr "mode" "V8HF") (symbol_ref "riscv_vector::get_ratio(E_V8HFmode)")
668 (eq_attr "mode" "V16HF") (symbol_ref "riscv_vector::get_ratio(E_V16HFmode)")
669 (eq_attr "mode" "V32HF") (symbol_ref "riscv_vector::get_ratio(E_V32HFmode)")
670 (eq_attr "mode" "V64HF") (symbol_ref "riscv_vector::get_ratio(E_V64HFmode)")
671 (eq_attr "mode" "V128HF") (symbol_ref "riscv_vector::get_ratio(E_V128HFmode)")
672 (eq_attr "mode" "V256HF") (symbol_ref "riscv_vector::get_ratio(E_V256HFmode)")
673 (eq_attr "mode" "V512HF") (symbol_ref "riscv_vector::get_ratio(E_V512HFmode)")
674 (eq_attr "mode" "V1024HF") (symbol_ref "riscv_vector::get_ratio(E_V1024HFmode)")
675 (eq_attr "mode" "V2048HF") (symbol_ref "riscv_vector::get_ratio(E_V2048HFmode)")
676 (eq_attr "mode" "V1SF") (symbol_ref "riscv_vector::get_ratio(E_V1SFmode)")
677 (eq_attr "mode" "V2SF") (symbol_ref "riscv_vector::get_ratio(E_V2SFmode)")
678 (eq_attr "mode" "V4SF") (symbol_ref "riscv_vector::get_ratio(E_V4SFmode)")
679 (eq_attr "mode" "V8SF") (symbol_ref "riscv_vector::get_ratio(E_V8SFmode)")
680 (eq_attr "mode" "V16SF") (symbol_ref "riscv_vector::get_ratio(E_V16SFmode)")
681 (eq_attr "mode" "V32SF") (symbol_ref "riscv_vector::get_ratio(E_V32SFmode)")
682 (eq_attr "mode" "V64SF") (symbol_ref "riscv_vector::get_ratio(E_V64SFmode)")
683 (eq_attr "mode" "V128SF") (symbol_ref "riscv_vector::get_ratio(E_V128SFmode)")
684 (eq_attr "mode" "V256SF") (symbol_ref "riscv_vector::get_ratio(E_V256SFmode)")
685 (eq_attr "mode" "V512SF") (symbol_ref "riscv_vector::get_ratio(E_V512SFmode)")
686 (eq_attr "mode" "V1024SF") (symbol_ref "riscv_vector::get_ratio(E_V1024SFmode)")
687 (eq_attr "mode" "V1DF") (symbol_ref "riscv_vector::get_ratio(E_V1DFmode)")
688 (eq_attr "mode" "V2DF") (symbol_ref "riscv_vector::get_ratio(E_V2DFmode)")
689 (eq_attr "mode" "V4DF") (symbol_ref "riscv_vector::get_ratio(E_V4DFmode)")
690 (eq_attr "mode" "V8DF") (symbol_ref "riscv_vector::get_ratio(E_V8DFmode)")
691 (eq_attr "mode" "V16DF") (symbol_ref "riscv_vector::get_ratio(E_V16DFmode)")
692 (eq_attr "mode" "V32DF") (symbol_ref "riscv_vector::get_ratio(E_V32DFmode)")
693 (eq_attr "mode" "V64DF") (symbol_ref "riscv_vector::get_ratio(E_V64DFmode)")
694 (eq_attr "mode" "V128DF") (symbol_ref "riscv_vector::get_ratio(E_V128DFmode)")
695 (eq_attr "mode" "V256DF") (symbol_ref "riscv_vector::get_ratio(E_V256DFmode)")
696 (eq_attr "mode" "V512DF") (symbol_ref "riscv_vector::get_ratio(E_V512DFmode)")]
697 (const_int INVALID_ATTRIBUTE)))
699 ;; The index of operand[] to get the merge op.
700 (define_attr "merge_op_idx" ""
701 (cond [(eq_attr "type" "vlde,vimov,vfmov,vldm,vlds,vmalu,vldux,vldox,vicmp,\
702 vialu,vshift,viminmax,vimul,vidiv,vsalu,vext,viwalu,\
703 viwmul,vnshift,vaalu,vsmul,vsshift,vnclip,vmsfs,\
704 vmiota,vmidx,vfalu,vfmul,vfminmax,vfdiv,vfwalu,vfwmul,\
705 vfsqrt,vfrecp,vfsgnj,vfcmp,vfcvtitof,vfcvtftoi,vfwcvtitof,\
706 vfwcvtftoi,vfwcvtftof,vfncvtitof,vfncvtftoi,vfncvtftof,vfclass,\
707 vired,viwred,vfredu,vfredo,vfwredu,vfwredo,vimovxv,vfmovfv,\
708 vslideup,vslidedown,vislide1up,vislide1down,vfslide1up,vfslide1down,\
709 vgather,vldff,viwmuladd,vfwmuladd,vlsegde,vlsegds,vlsegdux,vlsegdox,vlsegdff,\
710 vandn,vbrev,vbrev8,vrev8,vrol,vror,vwsll,vclmul,vclmulh")
713 (eq_attr "type" "vimerge,vfmerge,vcompress,vghsh,vgmul,vaesef,vaesem,vaesdf,vaesdm,\
714 vaeskf1,vaeskf2,vaesz,vsha2ms,vsha2ch,vsha2cl,vsm4k,vsm4r,vsm3me,vsm3c")
717 (eq_attr "type" "vimuladd,vfmuladd")
719 (const_int INVALID_ATTRIBUTE)))
721 ;; The index of operand[] represents the machine mode of the instruction.
722 (define_attr "mode_idx" ""
723 (cond [(eq_attr "type" "vlde,vste,vldm,vstm,vlds,vsts,vldux,vldox,vldff,vldr,vstr,\
724 vlsegde,vlsegds,vlsegdux,vlsegdox,vlsegdff,vialu,vext,vicalu,\
725 vshift,vicmp,viminmax,vimul,vidiv,vimuladd,vimerge,vimov,\
726 vsalu,vaalu,vsmul,vsshift,vfalu,vfmul,vfdiv,vfmuladd,vfsqrt,vfrecp,\
727 vfcmp,vfminmax,vfsgnj,vfclass,vfmerge,vfmov,\
728 vfcvtitof,vfncvtitof,vfncvtftoi,vfncvtftof,vmalu,vmiota,vmidx,\
729 vimovxv,vfmovfv,vslideup,vslidedown,vislide1up,vislide1down,vfslide1up,vfslide1down,\
730 vgather,vcompress,vmov,vnclip,vnshift")
733 (eq_attr "type" "vimovvx,vfmovvf")
736 (eq_attr "type" "vssegte,vmpop,vmffs")
739 (eq_attr "type" "vstux,vstox,vssegts,vssegtux,vssegtox,vfcvtftoi,vfwcvtitof,vfwcvtftoi,
740 vfwcvtftof,vmsfs,vired,viwred,vfredu,vfredo,vfwredu,vfwredo")
743 (eq_attr "type" "viwalu,viwmul,viwmuladd,vfwalu,vfwmul,vfwmuladd")
745 (const_int INVALID_ATTRIBUTE)))
747 ;; The index of operand[] to get the avl op.
748 (define_attr "vl_op_idx" ""
749 (cond [(eq_attr "type" "vlde,vste,vimov,vfmov,vldm,vstm,vmalu,vsts,vstux,\
750 vstox,vext,vmsfs,vmiota,vfsqrt,vfrecp,vfcvtitof,vldff,\
751 vfcvtftoi,vfwcvtitof,vfwcvtftoi,vfwcvtftof,vfncvtitof,\
752 vfncvtftoi,vfncvtftof,vfclass,vimovxv,vfmovfv,vcompress,\
753 vlsegde,vssegts,vssegtux,vssegtox,vlsegdff,vbrev,vbrev8,vrev8,\
754 vghsh,vaeskf1,vaeskf2,vsha2ms,vsha2ch,vsha2cl,vsm4k,vsm3me,vsm3c")
757 ;; If operands[3] of "vlds" is not vector mode, it is pred_broadcast.
758 ;; wheras it is pred_strided_load if operands[3] is vector mode.
759 (eq_attr "type" "vlds")
760 (if_then_else (match_test "VECTOR_MODE_P (GET_MODE (operands[3]))")
764 (eq_attr "type" "vldux,vldox,vialu,vshift,viminmax,vimul,vidiv,vsalu,\
765 viwalu,viwmul,vnshift,vimerge,vaalu,vsmul,\
766 vsshift,vnclip,vfalu,vfmul,vfminmax,vfdiv,vfwalu,vfwmul,\
767 vfsgnj,vfmerge,vired,viwred,vfredu,vfredo,vfwredu,vfwredo,\
768 vslideup,vslidedown,vislide1up,vislide1down,vfslide1up,vfslide1down,\
769 vgather,viwmuladd,vfwmuladd,vlsegds,vlsegdux,vlsegdox,vandn,vrol,\
770 vror,vwsll,vclmul,vclmulh")
773 (eq_attr "type" "vicmp,vimuladd,vfcmp,vfmuladd")
776 (eq_attr "type" "vmpop,vmffs,vmidx,vssegte,vclz,vctz,vgmul,vaesef,vaesem,vaesdf,vaesdm,\
779 (const_int INVALID_ATTRIBUTE)))
781 ;; The tail policy op value.
783 (cond [(eq_attr "type" "vlde,vimov,vfmov,vext,vmiota,vfsqrt,vfrecp,\
784 vfcvtitof,vfcvtftoi,vfwcvtitof,vfwcvtftoi,vfwcvtftof,\
785 vfncvtitof,vfncvtftoi,vfncvtftof,vfclass,vimovxv,vfmovfv,\
786 vcompress,vldff,vlsegde,vlsegdff,vbrev,vbrev8,vrev8,vghsh,\
787 vaeskf1,vaeskf2,vsha2ms,vsha2ch,vsha2cl,vsm4k,vsm3me,vsm3c")
788 (symbol_ref "riscv_vector::get_ta(operands[5])")
790 ;; If operands[3] of "vlds" is not vector mode, it is pred_broadcast.
791 ;; wheras it is pred_strided_load if operands[3] is vector mode.
792 (eq_attr "type" "vlds")
793 (if_then_else (match_test "VECTOR_MODE_P (GET_MODE (operands[3]))")
794 (symbol_ref "riscv_vector::get_ta(operands[6])")
795 (symbol_ref "riscv_vector::get_ta(operands[5])"))
797 (eq_attr "type" "vldux,vldox,vialu,vshift,viminmax,vimul,vidiv,vsalu,\
798 viwalu,viwmul,vnshift,vimerge,vaalu,vsmul,\
799 vsshift,vnclip,vfalu,vfmul,vfminmax,vfdiv,\
800 vfwalu,vfwmul,vfsgnj,vfmerge,vired,viwred,vfredu,\
801 vfredo,vfwredu,vfwredo,vslideup,vslidedown,vislide1up,\
802 vislide1down,vfslide1up,vfslide1down,vgather,viwmuladd,vfwmuladd,\
803 vlsegds,vlsegdux,vlsegdox,vandn,vrol,vror,vwsll,vclmul,vclmulh")
804 (symbol_ref "riscv_vector::get_ta(operands[6])")
806 (eq_attr "type" "vimuladd,vfmuladd")
807 (symbol_ref "riscv_vector::get_ta(operands[7])")
809 (eq_attr "type" "vmidx,vgmul,vaesef,vaesem,vaesdf,vaesdm,vaesz,vsm4r")
810 (symbol_ref "riscv_vector::get_ta(operands[4])")]
811 (const_int INVALID_ATTRIBUTE)))
813 ;; The mask policy op value.
815 (cond [(eq_attr "type" "vlde,vext,vmiota,vfsqrt,vfrecp,vfcvtitof,vfcvtftoi,\
816 vfwcvtitof,vfwcvtftoi,vfwcvtftof,vfncvtitof,vfncvtftoi,\
817 vfncvtftof,vfclass,vldff,vlsegde,vlsegdff,vbrev,vbrev8,vrev8")
818 (symbol_ref "riscv_vector::get_ma(operands[6])")
820 ;; If operands[3] of "vlds" is not vector mode, it is pred_broadcast.
821 ;; wheras it is pred_strided_load if operands[3] is vector mode.
822 (eq_attr "type" "vlds")
823 (if_then_else (match_test "VECTOR_MODE_P (GET_MODE (operands[3]))")
824 (symbol_ref "riscv_vector::get_ma(operands[7])")
825 (symbol_ref "riscv_vector::get_ma(operands[6])"))
827 (eq_attr "type" "vldux,vldox,vialu,vshift,viminmax,vimul,vidiv,vsalu,\
828 viwalu,viwmul,vnshift,vaalu,vsmul,vsshift,\
829 vnclip,vicmp,vfalu,vfmul,vfminmax,vfdiv,\
830 vfwalu,vfwmul,vfsgnj,vfcmp,vslideup,vslidedown,\
831 vislide1up,vislide1down,vfslide1up,vfslide1down,vgather,\
832 viwmuladd,vfwmuladd,vlsegds,vlsegdux,vlsegdox,vandn,vrol,\
833 vror,vwsll,vclmul,vclmulh")
834 (symbol_ref "riscv_vector::get_ma(operands[7])")
836 (eq_attr "type" "vimuladd,vfmuladd")
837 (symbol_ref "riscv_vector::get_ma(operands[8])")
839 (eq_attr "type" "vmsfs,vmidx")
840 (symbol_ref "riscv_vector::get_ma(operands[5])")]
841 (const_int INVALID_ATTRIBUTE)))
843 ;; The avl type value.
844 (define_attr "avl_type_idx" ""
845 (cond [(eq_attr "type" "vlde,vldff,vste,vimov,vfmov,vext,vimerge,\
846 vfsqrt,vfrecp,vfmerge,vfcvtitof,vfcvtftoi,vfwcvtitof,\
847 vfwcvtftoi,vfwcvtftof,vfncvtitof,vfncvtftoi,vfncvtftof,\
848 vfclass,vired,viwred,vfredu,vfredo,vfwredu,vfwredo,\
849 vimovxv,vfmovfv,vlsegde,vlsegdff,vmiota,vbrev,vbrev8,vrev8")
851 (eq_attr "type" "vldm,vstm,vmalu,vmalu,vgmul,vaesef,vaesem,vaesdf,vaesdm,vaesz,\
855 ;; If operands[3] of "vlds" is not vector mode, it is pred_broadcast.
856 ;; wheras it is pred_strided_load if operands[3] is vector mode.
857 (eq_attr "type" "vlds")
858 (if_then_else (match_test "VECTOR_MODE_P (GET_MODE (operands[3]))")
862 (eq_attr "type" "vldux,vldox,vialu,vshift,viminmax,vimul,vidiv,vsalu,\
863 viwalu,viwmul,vnshift,vaalu,vsmul,vsshift,\
864 vnclip,vicmp,vfalu,vfmul,vfminmax,vfdiv,vfwalu,vfwmul,\
865 vfsgnj,vfcmp,vslideup,vslidedown,vislide1up,\
866 vislide1down,vfslide1up,vfslide1down,vgather,viwmuladd,vfwmuladd,\
867 vlsegds,vlsegdux,vlsegdox,vandn,vrol,vror,vwsll")
869 (eq_attr "type" "vstux,vstox,vssegts,vssegtux,vssegtox,vclmul,vclmulh")
872 (eq_attr "type" "vimuladd,vfmuladd")
875 (eq_attr "type" "vmsfs,vmidx,vcompress,vghsh,vaeskf1,vaeskf2,vsha2ms,vsha2ch,vsha2cl,\
879 (eq_attr "type" "vmpop,vmffs,vssegte,vclz,vctz")
881 (const_int INVALID_ATTRIBUTE)))
883 ;; Defines rounding mode of an fixed-point operation.
885 (define_attr "vxrm_mode" "rnu,rne,rdn,rod,none"
886 (cond [(eq_attr "type" "vaalu,vsmul,vsshift,vnclip")
888 [(match_test "INTVAL (operands[9]) == riscv_vector::VXRM_RNU")
891 (match_test "INTVAL (operands[9]) == riscv_vector::VXRM_RNE")
894 (match_test "INTVAL (operands[9]) == riscv_vector::VXRM_RDN")
897 (match_test "INTVAL (operands[9]) == riscv_vector::VXRM_ROD")
898 (const_string "rod")]
899 (const_string "none"))]
900 (const_string "none")))
902 ;; Defines rounding mode of an floating-point operation.
903 (define_attr "frm_mode" ""
904 (cond [(eq_attr "type" "vfalu,vfwalu,vfmul,vfdiv,vfwmul")
905 (symbol_ref "riscv_vector::FRM_DYN")]
906 (symbol_ref "riscv_vector::FRM_NONE")))
908 ;; -----------------------------------------------------------------
909 ;; ---- Miscellaneous Operations
910 ;; -----------------------------------------------------------------
912 (define_insn "@vundefined<mode>"
913 [(set (match_operand:V 0 "register_operand" "=vr")
914 (unspec:V [(reg:SI X0_REGNUM)] UNSPEC_VUNDEF))]
917 [(set_attr "type" "vector")])
919 (define_insn "@vundefined<mode>"
920 [(set (match_operand:VB 0 "register_operand" "=vr")
921 (unspec:VB [(reg:SI X0_REGNUM)] UNSPEC_VUNDEF))]
924 [(set_attr "type" "vector")])
926 (define_insn "@vundefined<mode>"
927 [(set (match_operand:VT 0 "register_operand" "=vr")
928 (unspec:VT [(reg:SI X0_REGNUM)] UNSPEC_VUNDEF))]
931 [(set_attr "type" "vector")])
933 (define_expand "@vreinterpret<mode>"
934 [(set (match_operand:V 0 "register_operand")
935 (match_operand 1 "vector_any_register_operand"))]
938 emit_move_insn (operands[0], gen_lowpart (<MODE>mode, operands[1]));
943 (define_expand "@vreinterpret<mode>"
944 [(set (match_operand:VB 0 "register_operand")
945 (match_operand 1 "vector_any_register_operand"))]
948 emit_move_insn (operands[0], gen_lowpart (<MODE>mode, operands[1]));
953 ;; This pattern is used to hold the AVL operand for
954 ;; RVV instructions that implicity use VLMAX AVL.
955 ;; RVV instruction implicitly use GPR that is ultimately
956 ;; defined by this pattern is safe for VSETVL pass emit
957 ;; a vsetvl instruction modify this register after RA.
960 ;; ... (across many blocks)
961 ;; vadd (implicit use a5) ====> emit: vsetvl a5,zero
964 ;; ... (across many blocks)
966 ;; ... (across many blocks)
967 ;; vadd (implicit use a6) ====> emit: vsetvl a6,zero
970 ;; ... (across many blocks)
971 ;; store mem,a5 (spill)
972 ;; ... (across many blocks)
973 ;; load a7,mem (spill)
974 ;; ... (across many blocks)
975 ;; vadd (implicit use a7) ====> emit: vsetvl a7,zero
976 ;; Such cases are all safe for VSETVL PASS to emit a vsetvl
977 ;; instruction that modifies the AVL operand.
978 (define_insn "@vlmax_avl<mode>"
979 [(set (match_operand:P 0 "register_operand" "=r")
980 (unspec:P [(match_operand:P 1 "const_int_operand" "i")] UNSPEC_VLMAX))]
983 [(set_attr "type" "vsetvl_pre")]
987 (define_insn "vxrmsi"
988 [(set (reg:SI VXRM_REGNUM)
989 (match_operand:SI 0 "const_int_operand" "i"))]
992 [(set_attr "type" "wrvxrm")
993 (set_attr "mode" "SI")])
996 (define_insn "fsrmsi_backup"
997 [(set (match_operand:SI 0 "register_operand" "=r,r")
999 (set (reg:SI FRM_REGNUM)
1000 (match_operand:SI 1 "reg_or_int_operand" "r,i"))]
1005 [(set_attr "type" "wrfrm,wrfrm")
1006 (set_attr "mode" "SI")]
1009 (define_insn "fsrmsi_restore"
1010 [(set (reg:SI FRM_REGNUM)
1011 (match_operand:SI 0 "reg_or_int_operand" "r,i"))]
1016 [(set_attr "type" "wrfrm,wrfrm")
1017 (set_attr "mode" "SI")]
1020 ;; The volatile fsrmsi restore is used for the exit point for the
1021 ;; dynamic mode switching. It will generate one volatile fsrm a5
1022 ;; which won't be eliminated.
1023 (define_insn "fsrmsi_restore_volatile"
1024 [(set (reg:SI FRM_REGNUM)
1025 (unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")]
1026 UNSPECV_FRM_RESTORE_EXIT))]
1029 [(set_attr "type" "wrfrm")
1030 (set_attr "mode" "SI")]
1034 (define_insn "frrmsi"
1035 [(set (match_operand:SI 0 "register_operand" "=r")
1036 (reg:SI FRM_REGNUM))]
1039 [(set_attr "type" "rdfrm")
1040 (set_attr "mode" "SI")]
1043 ;; -----------------------------------------------------------------
1044 ;; ---- Moves Operations
1045 ;; -----------------------------------------------------------------
1047 (define_expand "mov<mode>"
1048 [(set (match_operand:V 0 "reg_or_mem_operand")
1049 (match_operand:V 1 "general_operand"))]
1052 /* For whole register move, we transform the pattern into the format
1053 that excludes the clobber of scratch register.
1055 We include clobber of a scalar scratch register which is going to be
1056 used for emit of vsetvl instruction after reload_completed since we
1057 need vsetvl instruction to set VL/VTYPE global status for fractional
1061 [(set (match_operand:RVVMF8QI v24)
1062 (match_operand:RVVMF8QI (mem: a4)))
1063 (clobber (scratch:SI a5))]
1064 ====>> vsetvl a5,zero,e8,mf8
1065 ====>> vle8.v v24,(a4)
1069 - Clobber a scalar scratch register for each mov<mode>.
1071 - Classify the machine_mode mode = <MODE>mode into 2 class:
1072 Whole register move and fractional register move.
1074 - Transform and remove scratch clobber register for whole
1075 register move so that we can avoid occupying the scalar
1078 - We can not leave it to TARGET_SECONDARY_RELOAD since it happens
1079 before spilling. The clobber scratch is used by spilling fractional
1080 registers in IRA/LRA so it's too early. */
1082 if (riscv_vector::legitimize_move (operands[0], &operands[1]))
1086 ;; This pattern is used for code-gen for whole register load/stores.
1087 ;; Also applicable for all register moves.
1088 ;; Fractional vector modes load/store are not allowed to match this pattern.
1089 ;; Mask modes load/store are not allowed to match this pattern.
1090 ;; We seperate "*mov<mode>" into "*mov<mode>_whole" and "*mov<mode>_fract" because
1091 ;; we don't want to include fractional load/store in "*mov<mode>" which will
1092 ;; create unexpected patterns in LRA.
1095 ;; (insn 20 19 9 2 (set (reg/v:RVVMF4QI 97 v1 [ v1 ])
1096 ;; (reg:RVVMF4QI 134 [ _1 ])) "rvv.c":9:22 571 {*movvnx2qi_fract}
1098 ;; When the value of pseudo register 134 of the insn above is discovered already
1099 ;; spilled in the memory during LRA.
1100 ;; LRA will reload this pattern into a memory load instruction pattern.
1101 ;; Because RVVMF4QI is a fractional vector, we want LRA reload this pattern into
1102 ;; (insn 20 19 9 2 (parallel [
1103 ;; (set (reg:RVVMF4QI 98 v2 [orig:134 _1 ] [134])
1104 ;; (mem/c:RVVMF4QI (reg:SI 13 a3 [155]) [1 %sfp+[-2, -2] S[2, 2] A8]))
1105 ;; (clobber (reg:SI 14 a4 [149]))])
1106 ;; So that we could be able to emit vsetvl instruction using clobber sratch a4.
1107 ;; To let LRA generate the expected pattern, we should exclude fractional vector
1108 ;; load/store in "*mov<mode>_whole". Otherwise, it will reload this pattern into:
1109 ;; (insn 20 19 9 2 (set (reg:RVVMF4QI 98 v2 [orig:134 _1 ] [134])
1110 ;; (mem/c:RVVMF4QI (reg:SI 13 a3 [155]) [1 %sfp+[-2, -2] S[2, 2] A8])))
1111 ;; which is not the pattern we want.
1112 ;; According the facts above, we make "*mov<mode>_whole" includes load/store/move for whole
1113 ;; vector modes according to '-march' and "*mov<mode>_fract" only include fractional vector modes.
1114 (define_insn "*mov<mode>_whole"
1115 [(set (match_operand:V_WHOLE 0 "reg_or_mem_operand" "=vr, m,vr")
1116 (match_operand:V_WHOLE 1 "reg_or_mem_operand" " m,vr,vr"))]
1119 vl%m1re<sew>.v\t%0,%1
1122 [(set_attr "type" "vldr,vstr,vmov")
1123 (set_attr "mode" "<MODE>")])
1125 (define_insn "*mov<mode>_fract"
1126 [(set (match_operand:V_FRACT 0 "register_operand" "=vr")
1127 (match_operand:V_FRACT 1 "register_operand" " vr"))]
1130 [(set_attr "type" "vmov")
1131 (set_attr "mode" "<MODE>")])
1133 (define_expand "mov<mode>"
1134 [(set (match_operand:VB 0 "reg_or_mem_operand")
1135 (match_operand:VB 1 "general_operand"))]
1138 if (riscv_vector::legitimize_move (operands[0], &operands[1]))
1142 (define_insn "*mov<mode>"
1143 [(set (match_operand:VB 0 "register_operand" "=vr")
1144 (match_operand:VB 1 "register_operand" " vr"))]
1147 [(set_attr "type" "vmov")
1148 (set_attr "mode" "<MODE>")])
1150 (define_expand "@mov<V_FRACT:mode><P:mode>_lra"
1152 [(set (match_operand:V_FRACT 0 "reg_or_mem_operand")
1153 (match_operand:V_FRACT 1 "reg_or_mem_operand"))
1154 (clobber (match_scratch:P 2))])]
1155 "TARGET_VECTOR && (lra_in_progress || reload_completed)"
1158 (define_expand "@mov<VB:mode><P:mode>_lra"
1160 [(set (match_operand:VB 0 "reg_or_mem_operand")
1161 (match_operand:VB 1 "reg_or_mem_operand"))
1162 (clobber (match_scratch:P 2))])]
1163 "TARGET_VECTOR && (lra_in_progress || reload_completed)"
1166 (define_insn_and_split "*mov<V_FRACT:mode><P:mode>_lra"
1167 [(set (match_operand:V_FRACT 0 "reg_or_mem_operand" "=vr, m,vr")
1168 (match_operand:V_FRACT 1 "reg_or_mem_operand" " m,vr,vr"))
1169 (clobber (match_scratch:P 2 "=&r,&r,X"))]
1170 "TARGET_VECTOR && (lra_in_progress || reload_completed)"
1172 "&& reload_completed"
1175 if (REG_P (operands[0]) && REG_P (operands[1]))
1176 emit_insn (gen_rtx_SET (operands[0], operands[1]));
1179 riscv_vector::emit_vlmax_vsetvl (<V_FRACT:MODE>mode, operands[2]);
1180 riscv_vector::emit_vlmax_insn_lra (code_for_pred_mov (<V_FRACT:MODE>mode),
1181 riscv_vector::UNARY_OP, operands, operands[2]);
1185 [(set_attr "type" "vector")]
1188 (define_insn_and_split "*mov<VB:mode><P:mode>_lra"
1189 [(set (match_operand:VB 0 "reg_or_mem_operand" "=vr, m,vr")
1190 (match_operand:VB 1 "reg_or_mem_operand" " m,vr,vr"))
1191 (clobber (match_scratch:P 2 "=&r,&r,X"))]
1192 "TARGET_VECTOR && (lra_in_progress || reload_completed)"
1194 "&& reload_completed"
1197 if (REG_P (operands[0]) && REG_P (operands[1]))
1198 emit_insn (gen_rtx_SET (operands[0], operands[1]));
1201 riscv_vector::emit_vlmax_vsetvl (<VB:MODE>mode, operands[2]);
1202 riscv_vector::emit_vlmax_insn_lra (code_for_pred_mov (<VB:MODE>mode),
1203 riscv_vector::UNARY_MASK_OP, operands, operands[2]);
1207 [(set_attr "type" "vector")]
1210 ;; Define tuple modes data movement.
1211 ;; operands[2] is used to save the offset of each subpart.
1212 ;; operands[3] is used to calculate the address for each subpart.
1213 ;; operands[4] is VL of vsevli instruction.
1214 (define_expand "mov<mode>"
1215 [(parallel [(set (match_operand:VT 0 "reg_or_mem_operand")
1216 (match_operand:VT 1 "general_operand"))
1217 (clobber (match_dup 2))
1218 (clobber (match_dup 3))
1219 (clobber (match_dup 4))])]
1222 /* Need to force register if mem <- !reg. */
1223 if (MEM_P (operands[0]) && !REG_P (operands[1]))
1224 operands[1] = force_reg (<MODE>mode, operands[1]);
1226 if (GET_CODE (operands[1]) == CONST_VECTOR)
1228 riscv_vector::expand_tuple_move (operands);
1232 operands[2] = gen_rtx_SCRATCH (Pmode);
1233 operands[3] = gen_rtx_SCRATCH (Pmode);
1234 operands[4] = gen_rtx_SCRATCH (Pmode);
1237 (define_insn_and_split "*mov<VT:mode>_<P:mode>"
1238 [(set (match_operand:VT 0 "reg_or_mem_operand" "=vr,vr, m")
1239 (match_operand:VT 1 "reg_or_mem_operand" " vr, m,vr"))
1240 (clobber (match_scratch:P 2 "=X,&r,&r"))
1241 (clobber (match_scratch:P 3 "=X,&r,&r"))
1242 (clobber (match_scratch:P 4 "=X,&r,&r"))]
1245 "&& reload_completed"
1248 riscv_vector::expand_tuple_move (operands);
1251 [(set_attr "type" "vmov,vlde,vste")
1252 (set_attr "mode" "<VT:MODE>")
1253 (set (attr "avl_type_idx") (const_int INVALID_ATTRIBUTE))
1254 (set (attr "mode_idx") (const_int INVALID_ATTRIBUTE))])
1256 ;; -----------------------------------------------------------------
1257 ;; ---- VLS Moves Operations
1258 ;; -----------------------------------------------------------------
1260 (define_expand "mov<mode>"
1261 [(set (match_operand:VLS_AVL_IMM 0 "reg_or_mem_operand")
1262 (match_operand:VLS_AVL_IMM 1 "general_operand"))]
1265 if (riscv_vector::legitimize_move (operands[0], &operands[1]))
1269 (define_insn_and_split "*mov<mode>"
1270 [(set (match_operand:VLS_AVL_IMM 0 "reg_or_mem_operand" "=vr, m, vr")
1271 (match_operand:VLS_AVL_IMM 1 "reg_or_mem_operand" " m,vr, vr"))]
1273 && (register_operand (operands[0], <MODE>mode)
1274 || register_operand (operands[1], <MODE>mode))"
1279 "&& reload_completed
1280 && (!register_operand (operands[0], <MODE>mode)
1281 || !register_operand (operands[1], <MODE>mode))"
1284 bool ok_p = riscv_vector::legitimize_move (operands[0], &operands[1]);
1288 [(set_attr "type" "vmov")]
1291 (define_expand "mov<mode>"
1292 [(set (match_operand:VLS_AVL_REG 0 "reg_or_mem_operand")
1293 (match_operand:VLS_AVL_REG 1 "general_operand"))]
1296 bool ok_p = riscv_vector::legitimize_move (operands[0], &operands[1]);
1301 (define_expand "@mov<VLS_AVL_REG:mode><P:mode>_lra"
1303 [(set (match_operand:VLS_AVL_REG 0 "reg_or_mem_operand")
1304 (match_operand:VLS_AVL_REG 1 "reg_or_mem_operand"))
1305 (clobber (match_scratch:P 2))])]
1306 "TARGET_VECTOR && (lra_in_progress || reload_completed)"
1309 (define_insn_and_split "*mov<VLS_AVL_REG:mode><P:mode>_lra"
1310 [(set (match_operand:VLS_AVL_REG 0 "reg_or_mem_operand" "=vr, m,vr")
1311 (match_operand:VLS_AVL_REG 1 "reg_or_mem_operand" " m,vr,vr"))
1312 (clobber (match_scratch:P 2 "=&r,&r,X"))]
1313 "TARGET_VECTOR && (lra_in_progress || reload_completed)
1314 && (register_operand (operands[0], <VLS_AVL_REG:MODE>mode)
1315 || register_operand (operands[1], <VLS_AVL_REG:MODE>mode))"
1317 "&& reload_completed"
1320 if (REG_P (operands[0]) && REG_P (operands[1]))
1321 emit_insn (gen_rtx_SET (operands[0], operands[1]));
1324 emit_move_insn (operands[2], gen_int_mode (GET_MODE_NUNITS (<VLS_AVL_REG:MODE>mode),
1327 = GET_MODE_CLASS (<VLS_AVL_REG:MODE>mode) == MODE_VECTOR_BOOL
1328 ? riscv_vector::UNARY_MASK_OP
1329 : riscv_vector::UNARY_OP;
1330 riscv_vector::emit_nonvlmax_insn (code_for_pred_mov (<VLS_AVL_REG:MODE>mode),
1331 insn_flags, operands, operands[2]);
1335 [(set_attr "type" "vmov")]
1338 (define_insn "*mov<mode>_vls"
1339 [(set (match_operand:VLS 0 "register_operand" "=vr")
1340 (match_operand:VLS 1 "register_operand" " vr"))]
1343 [(set_attr "type" "vmov")
1344 (set_attr "mode" "<MODE>")])
1346 (define_insn "*mov<mode>_vls"
1347 [(set (match_operand:VLSB 0 "register_operand" "=vr")
1348 (match_operand:VLSB 1 "register_operand" " vr"))]
1351 [(set_attr "type" "vmov")
1352 (set_attr "mode" "<MODE>")])
1354 ;; According to RVV ISA:
1355 ;; If an element accessed by a vector memory instruction is not naturally aligned to the size of the element,
1356 ;; either the element is transferred successfully or an address misaligned exception is raised on that element.
1357 (define_expand "movmisalign<mode>"
1358 [(set (match_operand:V_VLS 0 "nonimmediate_operand")
1359 (match_operand:V_VLS 1 "general_operand"))]
1360 "TARGET_VECTOR && TARGET_VECTOR_MISALIGN_SUPPORTED"
1362 emit_move_insn (operands[0], operands[1]);
1367 ;; -----------------------------------------------------------------
1368 ;; ---- Duplicate Operations
1369 ;; -----------------------------------------------------------------
1371 (define_expand "vec_duplicate<mode>"
1372 [(set (match_operand:V_VLS 0 "register_operand")
1373 (vec_duplicate:V_VLS
1374 (match_operand:<VEL> 1 "direct_broadcast_operand")))]
1377 /* Early expand DImode broadcast in RV32 system to avoid RA reload
1378 generate (set (reg) (vec_duplicate:DI)). */
1379 if (maybe_gt (GET_MODE_SIZE (<VEL>mode), GET_MODE_SIZE (Pmode)))
1381 riscv_vector::emit_vlmax_insn (code_for_pred_broadcast (<MODE>mode),
1382 riscv_vector::UNARY_OP, operands);
1385 /* Otherwise, allow it fall into general vec_duplicate pattern
1386 which allow us to have vv->vx combine optimization in later pass. */
1389 ;; According to GCC internal:
1390 ;; This pattern only handles duplicates of non-constant inputs.
1391 ;; Constant vectors go through the movm pattern instead.
1392 ;; So "direct_broadcast_operand" can only be mem or reg, no CONSTANT.
1393 (define_insn_and_split "*vec_duplicate<mode>"
1394 [(set (match_operand:V_VLS 0 "register_operand")
1395 (vec_duplicate:V_VLS
1396 (match_operand:<VEL> 1 "direct_broadcast_operand")))]
1397 "TARGET_VECTOR && can_create_pseudo_p ()"
1402 riscv_vector::emit_vlmax_insn (code_for_pred_broadcast (<MODE>mode),
1403 riscv_vector::UNARY_OP, operands);
1406 [(set_attr "type" "vector")]
1409 ;; -----------------------------------------------------------------
1410 ;; ---- 6. Configuration-Setting Instructions
1411 ;; -----------------------------------------------------------------
1413 ;; - 6.1 vsetvli/vsetivl/vsetvl instructions
1414 ;; -----------------------------------------------------------------
1416 ;; we dont't define vsetvli as unspec_volatile which has side effects.
1417 ;; This instruction can be scheduled by the instruction scheduler.
1418 ;; This means these instructions will be deleted when
1419 ;; there is no instructions using vl or vtype in the following.
1420 ;; rd | rs1 | AVL value | Effect on vl
1421 ;; - | !x0 | x[rs1] | Normal stripmining
1422 ;; !x0 | x0 | ~0 | Set vl to VLMAX
1424 ;; operands[1]: AVL.
1426 ;; operands[3]: LMUL
1427 ;; operands[4]: Tail policy 0 or 1 (undisturbed/agnostic)
1428 ;; operands[5]: Mask policy 0 or 1 (undisturbed/agnostic)
1430 ;; We define 2 types of "vsetvl*" instruction patterns:
1432 ;; - "@vsetvl<mode>" is a parallel format which has side effects.
1434 ;; - "@vsetvl<mode>_no_side_effects" has no side effects.
1436 ;; - "@vsetvl<mode>" is used by "vsetvl" intrinsics and "insert-vsetvl" PASS.
1438 ;; - "@vsetvl<mode>_no_side_effects" is used by GCC standard patterns.
1440 ;; - "@vsetvl<mode>" includes VL/VTYPE global registers status (define set)
1441 ;; and each RVV instruction includes VL/VTYPE global registers status (use)
1442 ;; so that we can guarantee each RVV instruction can execute with correct
1443 ;; VL/VTYPE global registers status after "insert-vsetvl" PASS.
1445 ;; - "@vsetvl<mode>_no_side_effects" has no side effects and excludes VL/VTYPE
1446 ;; global registers status (define set). It's only used by GCC standard pattern
1447 ;; expansion. For example: "mov<mode>" pattern for fractional vector modes which
1448 ;; need to set VL/VTYPE. Then we could manually call this pattern to gain benefits
1449 ;; from the optimization of each GCC internal PASS.
1451 ;; 1. void foo (float *in, float *out)
1453 ;; vfloat32mf2_t v = *(vfloat32mf2_t*)in;
1454 ;; *(vfloat32mf2_t*)out = v;
1456 ;; We could eliminate the second "vsetvl" by calling "@vsetvl<mode>_no_side_effects".
1458 ;; "@vsetvl<mode>": ;; "@vsetvl<mode>_no_side_effects":
1459 ;; vsetvli a4,zero,e32,mf2,ta,ma ;; vsetvli a4,zero,e32,mf2,ta,ma
1460 ;; vle32.v v24,(a0) ;; vle32.v v24,(a0)
1461 ;; vsetvli a4,zero,e32,mf2,ta,ma ;; --
1462 ;; vse32.v v24,(a1) ;; vse32.v v24,(a1)
1465 ;; 2. void foo (int8_t *in, int8_t *out, int M)
1467 ;; for (int i = 0; i < M; i++){
1468 ;; vint8mf2_t v = *(vint8mf2_t*)(in + i);
1469 ;; *(vint8mf2_t*)(out + i) = v;
1473 ;; Hoist "vsetvl" instruction in LICM:
1474 ;; "@vsetvl<mode>": ;; "@vsetvl<mode>_no_side_effects":
1475 ;; - ;; vsetvli a4,zero,e32,mf2,ta,ma
1477 ;; vsetvli a4,zero,e32,mf2,ta,ma ;; -
1478 ;; vle32.v v24,(a0) ;; vle32.v v24,(a0)
1479 ;; vsetvli a4,zero,e32,mf2,ta,ma ;; -
1480 ;; vse32.v v24,(a1) ;; vse32.v v24,(a1)
1482 ;; However, it may produce wrong codegen if we exclude VL/VTYPE in "vsevl<mode>".
1483 ;; 3. void foo (int8_t *in, int8_t *out, int32_t *in2, int32_t *out2, int M)
1485 ;; for (int i = 0; i < M; i++){
1486 ;; vint8mf2_t v = *(vint8mf2_t*)(in + i);
1487 ;; vint32mf2_t v2 = *(vint32mf2_t*)(in + i + i);
1488 ;; *(vint8mf2_t*)(out + i) = v;
1489 ;; *(vint32mf2_t*)(out + i + i) = v2;
1493 ;; vsetvli a6,zero,e8,mf2,ta,ma
1494 ;; vsetvli a2,zero,e32,mf2,ta,ma
1502 ;; Both vle8.v and vle32.v are using the wrong VL/VTYPE status.
1503 ;; We leave it to "insert-vsetvl" PASS to correct this situation.
1505 ;; The "insert-vsetvl" PASS mechanism:
1506 ;; 1. Before "insert-vsetvl" PASS, only RVV instructions are generated
1507 ;; by GCC standard pattern expansion has the corresponding "vsetvl".
1508 ;; We exploit each GCC internal optimization pass to optimize the "vsetvl".
1509 ;; 2. Correct the VL/VTYPE status for each GCC standard pattern RVV instructions.
1510 ;; Insert vsetvl for each RVV instructions that has no VL/VTYPE status if necessary.
1511 ;; For example: RVV intrinsics.
1512 ;; 3. Optimize "vsetvl" instructions.
1514 (define_insn "@vsetvl<mode>"
1515 [(set (match_operand:P 0 "register_operand" "=r")
1516 (unspec:P [(match_operand:P 1 "vector_length_operand" "rK")
1517 (match_operand 2 "const_int_operand" "i")
1518 (match_operand 3 "const_int_operand" "i")
1519 (match_operand 4 "const_int_operand" "i")
1520 (match_operand 5 "const_int_operand" "i")] UNSPEC_VSETVL))
1521 (set (reg:SI VL_REGNUM)
1522 (unspec:SI [(match_dup 1)
1524 (match_dup 3)] UNSPEC_VSETVL))
1525 (set (reg:SI VTYPE_REGNUM)
1526 (unspec:SI [(match_dup 2)
1529 (match_dup 5)] UNSPEC_VSETVL))]
1531 "vset%i1vli\t%0,%1,e%2,%m3,t%p4,m%p5"
1532 [(set_attr "type" "vsetvl")
1533 (set_attr "mode" "<MODE>")
1534 (set (attr "sew") (symbol_ref "INTVAL (operands[2])"))
1535 (set (attr "vlmul") (symbol_ref "INTVAL (operands[3])"))
1536 (set (attr "ta") (symbol_ref "INTVAL (operands[4])"))
1537 (set (attr "ma") (symbol_ref "INTVAL (operands[5])"))])
1539 ;; vsetvl zero,zero,vtype instruction.
1540 ;; This pattern has no side effects and does not set X0 register.
1541 (define_insn "vsetvl_vtype_change_only"
1542 [(set (reg:SI VTYPE_REGNUM)
1544 [(match_operand 0 "const_int_operand" "i")
1545 (match_operand 1 "const_int_operand" "i")
1546 (match_operand 2 "const_int_operand" "i")
1547 (match_operand 3 "const_int_operand" "i")] UNSPEC_VSETVL))]
1549 "vsetvli\tzero,zero,e%0,%m1,t%p2,m%p3"
1550 [(set_attr "type" "vsetvl")
1551 (set_attr "mode" "SI")
1552 (set (attr "sew") (symbol_ref "INTVAL (operands[0])"))
1553 (set (attr "vlmul") (symbol_ref "INTVAL (operands[1])"))
1554 (set (attr "ta") (symbol_ref "INTVAL (operands[2])"))
1555 (set (attr "ma") (symbol_ref "INTVAL (operands[3])"))])
1557 ;; vsetvl zero,rs1,vtype instruction.
1558 ;; The reason we need this pattern since we should avoid setting X0 register
1559 ;; in vsetvl instruction pattern.
1560 (define_insn "@vsetvl_discard_result<mode>"
1561 [(set (reg:SI VL_REGNUM)
1562 (unspec:SI [(match_operand:P 0 "vector_length_operand" "rK")
1563 (match_operand 1 "const_int_operand" "i")
1564 (match_operand 2 "const_int_operand" "i")] UNSPEC_VSETVL))
1565 (set (reg:SI VTYPE_REGNUM)
1566 (unspec:SI [(match_dup 1)
1568 (match_operand 3 "const_int_operand" "i")
1569 (match_operand 4 "const_int_operand" "i")] UNSPEC_VSETVL))]
1571 "vset%i0vli\tzero,%0,e%1,%m2,t%p3,m%p4"
1572 [(set_attr "type" "vsetvl")
1573 (set_attr "mode" "<MODE>")
1574 (set (attr "sew") (symbol_ref "INTVAL (operands[1])"))
1575 (set (attr "vlmul") (symbol_ref "INTVAL (operands[2])"))
1576 (set (attr "ta") (symbol_ref "INTVAL (operands[3])"))
1577 (set (attr "ma") (symbol_ref "INTVAL (operands[4])"))])
1579 ;; It's emit by vsetvl/vsetvlmax intrinsics with no side effects.
1580 ;; Since we have many optmization passes from "expand" to "reload_completed",
1581 ;; such pattern can allow us gain benefits of these optimizations.
1582 (define_insn_and_split "@vsetvl<mode>_no_side_effects"
1583 [(set (match_operand:P 0 "register_operand" "=r")
1584 (unspec:P [(match_operand:P 1 "vector_length_operand" "rK")
1585 (match_operand 2 "const_int_operand" "i")
1586 (match_operand 3 "const_int_operand" "i")
1587 (match_operand 4 "const_int_operand" "i")
1588 (match_operand 5 "const_int_operand" "i")] UNSPEC_VSETVL))]
1591 "&& epilogue_completed"
1594 (unspec:P [(match_dup 1) (match_dup 2) (match_dup 3)
1595 (match_dup 4) (match_dup 5)] UNSPEC_VSETVL))
1596 (set (reg:SI VL_REGNUM)
1597 (unspec:SI [(match_dup 1) (match_dup 2) (match_dup 3)] UNSPEC_VSETVL))
1598 (set (reg:SI VTYPE_REGNUM)
1599 (unspec:SI [(match_dup 2) (match_dup 3) (match_dup 4)
1600 (match_dup 5)] UNSPEC_VSETVL))])]
1602 [(set_attr "type" "vsetvl")
1603 (set_attr "mode" "SI")])
1605 ;; This pattern use to combine bellow two insns and then further remove
1606 ;; unnecessary sign_extend operations:
1607 ;; (set (reg:DI 134 [ _1 ])
1609 ;; (const_int 19 [0x13])
1610 ;; (const_int 8 [0x8])
1611 ;; (const_int 5 [0x5])
1612 ;; (const_int 2 [0x2]) repeated x2
1613 ;; ] UNSPEC_VSETVL))
1614 ;; (set (reg/v:DI 135 [ <retval> ])
1615 ;; (sign_extend:DI (subreg:SI (reg:DI 134 [ _1 ]) 0)))
1617 ;; The reason we can remove signe_extend is because currently the vl value
1618 ;; returned by the vsetvl instruction ranges from 0 to 65536 (uint16_t), and
1619 ;; bits 17 to 63 (including 31) are always 0, so there is no change after
1620 ;; sign_extend. Note that for HI and QI modes we cannot do this.
1621 ;; Of course, if the range of instructions returned by vsetvl later expands
1622 ;; to 32bits, then this combine pattern needs to be removed. But that could be
1623 ;; a long time from now.
1624 (define_insn_and_split "*vsetvldi_no_side_effects_si_extend"
1625 [(set (match_operand:DI 0 "register_operand")
1628 (unspec:DI [(match_operand:P 1 "vector_length_operand")
1629 (match_operand 2 "const_int_operand")
1630 (match_operand 3 "const_int_operand")
1631 (match_operand 4 "const_int_operand")
1632 (match_operand 5 "const_int_operand")] UNSPEC_VSETVL) 0)))]
1633 "TARGET_VECTOR && TARGET_64BIT"
1637 (unspec:DI [(match_dup 1)
1641 (match_dup 5)] UNSPEC_VSETVL))]
1643 [(set_attr "type" "vsetvl")
1644 (set_attr "mode" "SI")])
1646 ;; RVV machine description matching format
1648 ;; [(set (match_operand:MODE 0)
1649 ;; (if_then_else:MODE
1650 ;; (unspec:<MODE:VM>
1651 ;; [(match_operand:<VM> 1 "vector_mask_operand")
1652 ;; (match_operand N + 4 "vector_length_operand")
1653 ;; (match_operand N + 5 "const_int_operand")
1654 ;; (match_operand N + 6 "const_int_operand")
1655 ;; (reg:SI VL_REGNUM)
1656 ;; (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
1657 ;; (instruction operation:MODE
1662 ;; (match_operand N + 3)
1663 ;; (match_operand:MODE 2 "vector_reg_or_const0_operand")))]
1665 ;; (unspec:[........] UNSPEC_VPREDICATE) is a predicate wrapper.
1666 ;; Include mask predicate && length predicate && vector policy.
1668 ;; -------------------------------------------------------------------------------
1669 ;; ---- Predicated Mov
1670 ;; -------------------------------------------------------------------------------
1672 ;; - 7.4. Vector Unit-Stride Instructions
1673 ;; - 11.15 Vector Integer Merge Instructions
1674 ;; - 11.16 Vector Integer Move Instructions
1675 ;; - 13.16 Vector Floating-Point Move Instruction
1676 ;; - 15.1 Vector Mask-Register Logical Instructions
1677 ;; -------------------------------------------------------------------------------
1679 ;; vle.v/vse.v/vmv.v.v.
1680 ;; For vle.v/vmv.v.v, we may need merge and mask operand.
1681 ;; For vse.v, we don't need merge operand, so it should always match "vu".
1682 ;; constraint alternative 0 ~ 1 match vle.v.
1683 ;; constraint alternative 2 match vse.v.
1684 ;; constraint alternative 3 match vmv.v.v.
1686 ;; If operand 3 is a const_vector, then it is left to pred_braordcast patterns.
1687 (define_expand "@pred_mov<mode>"
1688 [(set (match_operand:V_VLS 0 "nonimmediate_operand")
1691 [(match_operand:<VM> 1 "vector_mask_operand")
1692 (match_operand 4 "vector_length_operand")
1693 (match_operand 5 "const_int_operand")
1694 (match_operand 6 "const_int_operand")
1695 (match_operand 7 "const_int_operand")
1697 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
1698 (match_operand:V_VLS 3 "vector_move_operand")
1699 (match_operand:V_VLS 2 "vector_merge_operand")))]
1703 ;; vle.v/vse.v,vmv.v.v
1704 (define_insn_and_split "*pred_mov<mode>"
1705 [(set (match_operand:V_VLS 0 "nonimmediate_operand" "=vr, vr, vd, m, vr, vr")
1708 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1, Wc1, vm, vmWc1, Wc1, Wc1")
1709 (match_operand 4 "vector_length_operand" " rK, rK, rK, rK, rK, rK")
1710 (match_operand 5 "const_int_operand" " i, i, i, i, i, i")
1711 (match_operand 6 "const_int_operand" " i, i, i, i, i, i")
1712 (match_operand 7 "const_int_operand" " i, i, i, i, i, i")
1714 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
1715 (match_operand:V_VLS 3 "reg_or_mem_operand" " m, m, m, vr, vr, vr")
1716 (match_operand:V_VLS 2 "vector_merge_operand" " 0, vu, vu, vu, vu, 0")))]
1718 && (register_operand (operands[0], <MODE>mode)
1719 || register_operand (operands[3], <MODE>mode)))"
1721 vle<sew>.v\t%0,%3%p1
1723 vle<sew>.v\t%0,%3,%1.t
1724 vse<sew>.v\t%3,%0%p1
1727 "&& register_operand (operands[0], <MODE>mode)
1728 && register_operand (operands[3], <MODE>mode)
1729 && satisfies_constraint_vu (operands[2])
1730 && INTVAL (operands[7]) == riscv_vector::VLMAX"
1731 [(set (match_dup 0) (match_dup 3))]
1733 [(set_attr "type" "vlde,vlde,vlde,vste,vimov,vimov")
1734 (set_attr "mode" "<MODE>")])
1736 ;; Dedicated pattern for vse.v instruction since we can't reuse pred_mov pattern to include
1737 ;; memory operand as input which will produce inferior codegen.
1738 (define_insn "@pred_store<mode>"
1739 [(set (match_operand:V 0 "memory_operand" "+m")
1742 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1")
1743 (match_operand 3 "vector_length_operand" " rK")
1744 (match_operand 4 "const_int_operand" " i")
1746 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
1747 (match_operand:V 2 "register_operand" " vr")
1750 "vse<sew>.v\t%2,%0%p1"
1751 [(set_attr "type" "vste")
1752 (set_attr "mode" "<MODE>")
1753 (set (attr "avl_type_idx") (const_int 4))
1754 (set_attr "vl_op_idx" "3")])
1756 ;; vlm.v/vsm.v/vmclr.m/vmset.m.
1757 ;; constraint alternative 0 match vlm.v.
1758 ;; constraint alternative 1 match vsm.v.
1759 ;; constraint alternative 3 match vmclr.m.
1760 ;; constraint alternative 4 match vmset.m.
1761 (define_insn_and_split "@pred_mov<mode>"
1762 [(set (match_operand:VB_VLS 0 "nonimmediate_operand" "=vr, m, vr, vr, vr")
1763 (if_then_else:VB_VLS
1765 [(match_operand:VB_VLS 1 "vector_all_trues_mask_operand" "Wc1, Wc1, Wc1, Wc1, Wc1")
1766 (match_operand 4 "vector_length_operand" " rK, rK, rK, rK, rK")
1767 (match_operand 5 "const_int_operand" " i, i, i, i, i")
1769 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
1770 (match_operand:VB_VLS 3 "vector_move_operand" " m, vr, vr, Wc0, Wc1")
1771 (match_operand:VB_VLS 2 "vector_undef_operand" " vu, vu, vu, vu, vu")))]
1779 "&& register_operand (operands[0], <MODE>mode)
1780 && register_operand (operands[3], <MODE>mode)
1781 && INTVAL (operands[5]) == riscv_vector::VLMAX"
1782 [(set (match_dup 0) (match_dup 3))]
1784 [(set_attr "type" "vldm,vstm,vmalu,vmalu,vmalu")
1785 (set_attr "mode" "<MODE>")])
1787 ;; Dedicated pattern for vsm.v instruction since we can't reuse pred_mov pattern to include
1788 ;; memory operand as input which will produce inferior codegen.
1789 (define_insn "@pred_store<mode>"
1790 [(set (match_operand:VB 0 "memory_operand" "+m")
1793 [(match_operand:VB 1 "vector_all_trues_mask_operand" "Wc1")
1794 (match_operand 3 "vector_length_operand" " rK")
1795 (match_operand 4 "const_int_operand" " i")
1797 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
1798 (match_operand:VB 2 "register_operand" " vr")
1802 [(set_attr "type" "vstm")
1803 (set_attr "mode" "<MODE>")
1804 (set (attr "avl_type_idx") (const_int 4))
1805 (set_attr "vl_op_idx" "3")])
1807 (define_insn "@pred_merge<mode>"
1808 [(set (match_operand:V_VLS 0 "register_operand" "=vd,vd,vd,vd")
1811 [(match_operand 5 "vector_length_operand" " rK,rK,rK,rK")
1812 (match_operand 6 "const_int_operand" " i, i, i, i")
1813 (match_operand 7 "const_int_operand" " i, i, i, i")
1815 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
1817 (match_operand:V_VLS 3 "vector_arith_operand" " vr,vr,vi,vi")
1818 (match_operand:V_VLS 2 "register_operand" " vr,vr,vr,vr")
1819 (match_operand:<VM> 4 "register_operand" " vm,vm,vm,vm"))
1820 (match_operand:V_VLS 1 "vector_merge_operand" " vu, 0,vu, 0")))]
1822 "vmerge.v%o3m\t%0,%2,%v3,%4"
1823 [(set_attr "type" "vimerge")
1824 (set_attr "mode" "<MODE>")])
1826 (define_insn "@pred_merge<mode>_scalar"
1827 [(set (match_operand:V_VLSI_QHS 0 "register_operand" "=vd,vd")
1828 (if_then_else:V_VLSI_QHS
1830 [(match_operand 5 "vector_length_operand" " rK,rK")
1831 (match_operand 6 "const_int_operand" " i, i")
1832 (match_operand 7 "const_int_operand" " i, i")
1834 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
1835 (vec_merge:V_VLSI_QHS
1836 (vec_duplicate:V_VLSI_QHS
1837 (match_operand:<VEL> 3 "register_operand" " r, r"))
1838 (match_operand:V_VLSI_QHS 2 "register_operand" " vr,vr")
1839 (match_operand:<VM> 4 "register_operand" " vm,vm"))
1840 (match_operand:V_VLSI_QHS 1 "vector_merge_operand" " vu, 0")))]
1842 "vmerge.vxm\t%0,%2,%3,%4"
1843 [(set_attr "type" "vimerge")
1844 (set_attr "mode" "<MODE>")])
1846 (define_expand "@pred_merge<mode>_scalar"
1847 [(set (match_operand:V_VLSI_D 0 "register_operand")
1848 (if_then_else:V_VLSI_D
1850 [(match_operand 5 "vector_length_operand")
1851 (match_operand 6 "const_int_operand")
1852 (match_operand 7 "const_int_operand")
1854 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
1856 (vec_duplicate:V_VLSI_D
1857 (match_operand:<VEL> 3 "reg_or_int_operand"))
1858 (match_operand:V_VLSI_D 2 "register_operand")
1859 (match_operand:<VM> 4 "register_operand"))
1860 (match_operand:V_VLSI_D 1 "vector_merge_operand")))]
1863 if (riscv_vector::sew64_scalar_helper (
1865 /* scalar op */&operands[3],
1866 /* vl */operands[5],
1868 riscv_vector::simm5_p (operands[3]),
1869 [] (rtx *operands, rtx boardcast_scalar) {
1870 emit_insn (gen_pred_merge<mode> (operands[0], operands[1],
1871 operands[2], boardcast_scalar, operands[4], operands[5],
1872 operands[6], operands[7]));
1874 (riscv_vector::avl_type) INTVAL (operands[7])))
1878 (define_insn "*pred_merge<mode>_scalar"
1879 [(set (match_operand:V_VLSI_D 0 "register_operand" "=vd,vd")
1880 (if_then_else:V_VLSI_D
1882 [(match_operand 5 "vector_length_operand" " rK,rK")
1883 (match_operand 6 "const_int_operand" " i, i")
1884 (match_operand 7 "const_int_operand" " i, i")
1886 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
1888 (vec_duplicate:V_VLSI_D
1889 (match_operand:<VEL> 3 "register_operand" " r, r"))
1890 (match_operand:V_VLSI_D 2 "register_operand" " vr,vr")
1891 (match_operand:<VM> 4 "register_operand" " vm,vm"))
1892 (match_operand:V_VLSI_D 1 "vector_merge_operand" " vu, 0")))]
1894 "vmerge.vxm\t%0,%2,%3,%4"
1895 [(set_attr "type" "vimerge")
1896 (set_attr "mode" "<MODE>")])
1898 (define_insn "*pred_merge<mode>_extended_scalar"
1899 [(set (match_operand:V_VLSI_D 0 "register_operand" "=vd,vd")
1900 (if_then_else:V_VLSI_D
1902 [(match_operand 5 "vector_length_operand" " rK,rK")
1903 (match_operand 6 "const_int_operand" " i, i")
1904 (match_operand 7 "const_int_operand" " i, i")
1906 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
1908 (vec_duplicate:V_VLSI_D
1910 (match_operand:<VSUBEL> 3 "register_operand" " r, r")))
1911 (match_operand:V_VLSI_D 2 "register_operand" " vr,vr")
1912 (match_operand:<VM> 4 "register_operand" " vm,vm"))
1913 (match_operand:V_VLSI_D 1 "vector_merge_operand" " vu, 0")))]
1914 "TARGET_VECTOR && !TARGET_64BIT"
1915 "vmerge.vxm\t%0,%2,%3,%4"
1916 [(set_attr "type" "vimerge")
1917 (set_attr "mode" "<MODE>")])
1919 ;; -------------------------------------------------------------------------------
1920 ;; ---- Predicated Broadcast
1921 ;; -------------------------------------------------------------------------------
1923 ;; - 7.5. Vector Strided Instructions (zero stride)
1924 ;; - 11.16 Vector Integer Move Instructions (vmv.v.x)
1925 ;; - 13.16 Vector Floating-Point Move Instruction (vfmv.v.f)
1926 ;; - 16.1 Integer Scalar Move Instructions (vmv.s.x)
1927 ;; - 16.2 Floating-Point Scalar Move Instructions (vfmv.s.f)
1928 ;; -------------------------------------------------------------------------------
1930 ;; According to RVV ISA, vector-scalar instruction doesn't support
1931 ;; operand fetched from 2 consecutive registers, so we should use
1932 ;; vlse.v which is a memory access to broadcast a DImode scalar into a vector.
1934 ;; Since the optimization flow in GCC is as follows:
1935 ;; expand --> LICM (Loop invariant) --> split.
1936 ;; To use LICM optimization, we postpone generation of vlse.v to split stage since
1937 ;; a memory access instruction can not be optimized by LICM (Loop invariant).
1938 (define_expand "@pred_broadcast<mode>"
1939 [(set (match_operand:V_VLS 0 "register_operand")
1942 [(match_operand:<VM> 1 "vector_broadcast_mask_operand")
1943 (match_operand 4 "vector_length_operand")
1944 (match_operand 5 "const_int_operand")
1945 (match_operand 6 "const_int_operand")
1946 (match_operand 7 "const_int_operand")
1948 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
1949 (vec_duplicate:V_VLS
1950 (match_operand:<VEL> 3 "direct_broadcast_operand"))
1951 (match_operand:V_VLS 2 "vector_merge_operand")))]
1954 /* Handle vmv.s.x instruction (Wb1 mask) which has memory scalar. */
1955 if (satisfies_constraint_Wdm (operands[3]))
1957 if (satisfies_constraint_Wb1 (operands[1]))
1959 /* Case 1: vmv.s.x (TA, x == memory) ==> vlse.v (TA) */
1960 if (satisfies_constraint_vu (operands[2]))
1961 operands[1] = CONSTM1_RTX (<VM>mode);
1962 else if (GET_MODE_BITSIZE (<VEL>mode) > GET_MODE_BITSIZE (Pmode))
1964 /* Case 2: vmv.s.x (TU, x == memory) ==>
1965 vl = 0 or 1; + vlse.v (TU) in RV32 system */
1966 operands[4] = riscv_vector::gen_avl_for_scalar_move (operands[4]);
1967 operands[1] = CONSTM1_RTX (<VM>mode);
1970 /* Case 3: load x (memory) to register. */
1971 operands[3] = force_reg (<VEL>mode, operands[3]);
1974 else if (GET_MODE_BITSIZE (<VEL>mode) > GET_MODE_BITSIZE (Pmode)
1975 && (immediate_operand (operands[3], Pmode)
1976 || (CONST_POLY_INT_P (operands[3])
1977 && known_ge (rtx_to_poly_int64 (operands[3]), 0U)
1978 && known_le (rtx_to_poly_int64 (operands[3]), GET_MODE_SIZE (<MODE>mode)))))
1980 rtx tmp = gen_reg_rtx (Pmode);
1981 poly_int64 value = rtx_to_poly_int64 (operands[3]);
1982 emit_move_insn (tmp, gen_int_mode (value, Pmode));
1983 operands[3] = gen_rtx_SIGN_EXTEND (<VEL>mode, tmp);
1986 operands[3] = force_reg (<VEL>mode, operands[3]);
1989 (define_insn_and_split "*pred_broadcast<mode>"
1990 [(set (match_operand:V_VLSI 0 "register_operand" "=vr, vr, vd, vd, vr, vr, vr, vr")
1991 (if_then_else:V_VLSI
1993 [(match_operand:<VM> 1 "vector_broadcast_mask_operand" "Wc1,Wc1, vm, vm,Wc1,Wc1,Wb1,Wb1")
1994 (match_operand 4 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK, rK")
1995 (match_operand 5 "const_int_operand" " i, i, i, i, i, i, i, i")
1996 (match_operand 6 "const_int_operand" " i, i, i, i, i, i, i, i")
1997 (match_operand 7 "const_int_operand" " i, i, i, i, i, i, i, i")
1999 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2000 (vec_duplicate:V_VLSI
2001 (match_operand:<VEL> 3 "direct_broadcast_operand" " r, r,Wdm,Wdm,Wdm,Wdm, r, r"))
2002 (match_operand:V_VLSI 2 "vector_merge_operand" "vu, 0, vu, 0, vu, 0, vu, 0")))]
2007 vlse<sew>.v\t%0,%3,zero,%1.t
2008 vlse<sew>.v\t%0,%3,zero,%1.t
2009 vlse<sew>.v\t%0,%3,zero
2010 vlse<sew>.v\t%0,%3,zero
2013 "(register_operand (operands[3], <VEL>mode)
2014 || CONST_POLY_INT_P (operands[3]))
2015 && GET_MODE_BITSIZE (<VEL>mode) > GET_MODE_BITSIZE (Pmode)"
2017 (if_then_else:V_VLSI (unspec:<VM> [(match_dup 1) (match_dup 4)
2018 (match_dup 5) (match_dup 6) (match_dup 7)
2019 (reg:SI VL_REGNUM) (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2020 (vec_duplicate:V_VLSI (match_dup 3))
2023 gcc_assert (can_create_pseudo_p ());
2024 if (CONST_POLY_INT_P (operands[3]))
2026 rtx tmp = gen_reg_rtx (<VEL>mode);
2027 emit_move_insn (tmp, operands[3]);
2030 rtx m = assign_stack_local (<VEL>mode, GET_MODE_SIZE (<VEL>mode),
2031 GET_MODE_ALIGNMENT (<VEL>mode));
2032 m = validize_mem (m);
2033 emit_move_insn (m, operands[3]);
2034 m = gen_rtx_MEM (<VEL>mode, force_reg (Pmode, XEXP (m, 0)));
2037 /* For SEW = 64 in RV32 system, we expand vmv.s.x:
2041 if (satisfies_constraint_Wb1 (operands[1]))
2043 operands[4] = riscv_vector::gen_avl_for_scalar_move (operands[4]);
2044 operands[1] = CONSTM1_RTX (<VM>mode);
2047 [(set_attr "type" "vimov,vimov,vlds,vlds,vlds,vlds,vimovxv,vimovxv")
2048 (set_attr "mode" "<MODE>")])
2050 (define_insn "*pred_broadcast<mode>"
2051 [(set (match_operand:V_VLSF_ZVFHMIN 0 "register_operand" "=vr, vr, vr, vr, vr, vr, vr, vr")
2052 (if_then_else:V_VLSF_ZVFHMIN
2054 [(match_operand:<VM> 1 "vector_broadcast_mask_operand" "Wc1,Wc1, vm, vm,Wc1,Wc1,Wb1,Wb1")
2055 (match_operand 4 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK, rK")
2056 (match_operand 5 "const_int_operand" " i, i, i, i, i, i, i, i")
2057 (match_operand 6 "const_int_operand" " i, i, i, i, i, i, i, i")
2058 (match_operand 7 "const_int_operand" " i, i, i, i, i, i, i, i")
2060 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2061 (vec_duplicate:V_VLSF_ZVFHMIN
2062 (match_operand:<VEL> 3 "direct_broadcast_operand" " f, f,Wdm,Wdm,Wdm,Wdm, f, f"))
2063 (match_operand:V_VLSF_ZVFHMIN 2 "vector_merge_operand" "vu, 0, vu, 0, vu, 0, vu, 0")))]
2068 vlse<sew>.v\t%0,%3,zero,%1.t
2069 vlse<sew>.v\t%0,%3,zero,%1.t
2070 vlse<sew>.v\t%0,%3,zero
2071 vlse<sew>.v\t%0,%3,zero
2074 [(set_attr "type" "vfmov,vfmov,vlds,vlds,vlds,vlds,vfmovfv,vfmovfv")
2075 (set_attr "mode" "<MODE>")])
2077 (define_insn "*pred_broadcast<mode>_extended_scalar"
2078 [(set (match_operand:V_VLSI_D 0 "register_operand" "=vr, vr, vr, vr")
2079 (if_then_else:V_VLSI_D
2081 [(match_operand:<VM> 1 "vector_broadcast_mask_operand" "Wc1,Wc1,Wb1,Wb1")
2082 (match_operand 4 "vector_length_operand" " rK, rK, rK, rK")
2083 (match_operand 5 "const_int_operand" " i, i, i, i")
2084 (match_operand 6 "const_int_operand" " i, i, i, i")
2085 (match_operand 7 "const_int_operand" " i, i, i, i")
2087 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2088 (vec_duplicate:V_VLSI_D
2090 (match_operand:<VSUBEL> 3 "register_operand" " r, r, r, r")))
2091 (match_operand:V_VLSI_D 2 "vector_merge_operand" "vu, 0, vu, 0")))]
2092 "TARGET_VECTOR && !TARGET_64BIT"
2098 [(set_attr "type" "vimov,vimov,vimovxv,vimovxv")
2099 (set_attr "mode" "<MODE>")])
2101 (define_insn "*pred_broadcast<mode>_zero"
2102 [(set (match_operand:V_VLS 0 "register_operand" "=vr, vr")
2105 [(match_operand:<VM> 1 "vector_least_significant_set_mask_operand" "Wb1, Wb1")
2106 (match_operand 4 "vector_length_operand" " rK, rK")
2107 (match_operand 5 "const_int_operand" " i, i")
2108 (match_operand 6 "const_int_operand" " i, i")
2109 (match_operand 7 "const_int_operand" " i, i")
2111 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2112 (match_operand:V_VLS 3 "vector_const_0_operand" "Wc0, Wc0")
2113 (match_operand:V_VLS 2 "vector_merge_operand" " vu, 0")))]
2116 [(set_attr "type" "vimovxv,vimovxv")
2117 (set_attr "mode" "<MODE>")])
2119 ;; Because (vec_duplicate imm) will be converted to (const_vector imm),
2120 ;; This pattern is used to handle this case.
2121 (define_insn "*pred_broadcast<mode>_imm"
2122 [(set (match_operand:V_VLS 0 "register_operand" "=vr, vr")
2125 [(match_operand:<VM> 1 "vector_all_trues_mask_operand" " Wc1, Wc1")
2126 (match_operand 4 "vector_length_operand" " rK, rK")
2127 (match_operand 5 "const_int_operand" " i, i")
2128 (match_operand 6 "const_int_operand" " i, i")
2129 (match_operand 7 "const_int_operand" " i, i")
2131 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2132 (match_operand:V_VLS 3 "vector_const_int_or_double_0_operand" "viWc0, viWc0")
2133 (match_operand:V_VLS 2 "vector_merge_operand" " vu, 0")))]
2136 [(set_attr "type" "vimov,vimov")
2137 (set_attr "mode" "<MODE>")])
2139 ;; -------------------------------------------------------------------------------
2140 ;; ---- Predicated Strided loads/stores
2141 ;; -------------------------------------------------------------------------------
2143 ;; - 7.5. Vector Strided Instructions
2144 ;; -------------------------------------------------------------------------------
2146 (define_insn "@pred_strided_load<mode>"
2147 [(set (match_operand:V 0 "register_operand" "=vr, vr, vd, vr, vr, vd")
2150 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1, Wc1, vm, vmWc1, Wc1, vm")
2151 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK, rK, rK")
2152 (match_operand 6 "const_int_operand" " i, i, i, i, i, i")
2153 (match_operand 7 "const_int_operand" " i, i, i, i, i, i")
2154 (match_operand 8 "const_int_operand" " i, i, i, i, i, i")
2156 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2158 [(match_operand:V 3 "memory_operand" " m, m, m, m, m, m")
2159 (match_operand 4 "<V:stride_predicate>" "<V:stride_load_constraint>")] UNSPEC_STRIDED)
2160 (match_operand:V 2 "vector_merge_operand" " 0, vu, vu, 0, vu, vu")))]
2163 vlse<sew>.v\t%0,%3,%z4%p1
2164 vlse<sew>.v\t%0,%3,%z4
2165 vlse<sew>.v\t%0,%3,%z4,%1.t
2166 vle<sew>.v\t%0,%3%p1
2168 vle<sew>.v\t%0,%3,%1.t"
2169 [(set_attr "type" "vlds")
2170 (set_attr "mode" "<MODE>")])
2172 (define_insn "@pred_strided_store<mode>"
2173 [(set (match_operand:V 0 "memory_operand" "+m, m")
2176 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1, vmWc1")
2177 (match_operand 4 "vector_length_operand" " rK, rK")
2178 (match_operand 5 "const_int_operand" " i, i")
2180 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2182 [(match_operand 2 "<V:stride_predicate>" "<V:stride_store_constraint>")
2183 (match_operand:V 3 "register_operand" " vr, vr")] UNSPEC_STRIDED)
2187 vsse<sew>.v\t%3,%0,%z2%p1
2188 vse<sew>.v\t%3,%0%p1"
2189 [(set_attr "type" "vsts")
2190 (set_attr "mode" "<MODE>")
2191 (set (attr "avl_type_idx") (const_int 5))])
2193 ;; -------------------------------------------------------------------------------
2194 ;; ---- Predicated indexed loads/stores
2195 ;; -------------------------------------------------------------------------------
2197 ;; - 7.6. Vector Indexed Instructions
2198 ;; -------------------------------------------------------------------------------
2200 ;; DEST eew is same as SOURCE eew, DEST register can overlap SOURCE.
2201 (define_insn "@pred_indexed_<order>load<mode>_same_eew"
2202 [(set (match_operand:VINDEXED 0 "register_operand" "=vd, vr,vd, vr")
2203 (if_then_else:VINDEXED
2205 [(match_operand:<VM> 1 "vector_mask_operand" " vm,Wc1,vm,Wc1")
2206 (match_operand 5 "vector_length_operand" " rK, rK,rK, rK")
2207 (match_operand 6 "const_int_operand" " i, i, i, i")
2208 (match_operand 7 "const_int_operand" " i, i, i, i")
2209 (match_operand 8 "const_int_operand" " i, i, i, i")
2211 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2213 [(match_operand 3 "pmode_reg_or_0_operand" " rJ, rJ,rJ, rJ")
2215 (match_operand:<VINDEX> 4 "register_operand" " vr, vr,vr, vr")] ORDER)
2216 (match_operand:VINDEXED 2 "vector_merge_operand" " vu, vu, 0, 0")))]
2218 "vl<order>xei<sew>.v\t%0,(%z3),%4%p1"
2219 [(set_attr "type" "vld<order>x")
2220 (set_attr "mode" "<MODE>")])
2222 ;; DEST eew is greater than SOURCE eew.
2223 (define_insn "@pred_indexed_<order>load<mode>_x2_greater_eew"
2224 [(set (match_operand:VEEWEXT2 0 "register_operand" "=vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, ?&vr, ?&vr")
2225 (if_then_else:VEEWEXT2
2227 [(match_operand:<VM> 1 "vector_mask_operand" " vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1,vmWc1,vmWc1")
2228 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK")
2229 (match_operand 6 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
2230 (match_operand 7 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
2231 (match_operand 8 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
2233 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2235 [(match_operand 3 "pmode_reg_or_0_operand" " rJ, rJ, rJ, rJ, rJ, rJ, rJ, rJ, rJ, rJ, rJ, rJ, rJ, rJ")
2237 (match_operand:<VINDEX_DOUBLE_TRUNC> 4 "register_operand" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84, vr, vr")] ORDER)
2238 (match_operand:VEEWEXT2 2 "vector_merge_operand" " vu, vu, 0, 0, vu, vu, 0, 0, vu, vu, 0, 0, vu, 0")))]
2240 "vl<order>xei<double_trunc_sew>.v\t%0,(%z3),%4%p1"
2241 [(set_attr "type" "vld<order>x")
2242 (set_attr "mode" "<MODE>")
2243 (set_attr "group_overlap" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84,none,none")])
2245 (define_insn "@pred_indexed_<order>load<mode>_x4_greater_eew"
2246 [(set (match_operand:VEEWEXT4 0 "register_operand" "=vd, vr, vd, vr, vd, vr, vd, vr, ?&vr, ?&vr")
2247 (if_then_else:VEEWEXT4
2249 [(match_operand:<VM> 1 "vector_mask_operand" " vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1,vmWc1,vmWc1")
2250 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK, rK, rK, rK")
2251 (match_operand 6 "const_int_operand" " i, i, i, i, i, i, i, i, i, i")
2252 (match_operand 7 "const_int_operand" " i, i, i, i, i, i, i, i, i, i")
2253 (match_operand 8 "const_int_operand" " i, i, i, i, i, i, i, i, i, i")
2255 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2257 [(match_operand 3 "pmode_reg_or_0_operand" " rJ, rJ, rJ, rJ, rJ, rJ, rJ, rJ, rJ, rJ")
2259 (match_operand:<VINDEX_QUAD_TRUNC> 4 "register_operand" "W43,W43,W43,W43,W86,W86,W86,W86, vr, vr")] ORDER)
2260 (match_operand:VEEWEXT4 2 "vector_merge_operand" " vu, vu, 0, 0, vu, vu, 0, 0, vu, 0")))]
2262 "vl<order>xei<quad_trunc_sew>.v\t%0,(%z3),%4%p1"
2263 [(set_attr "type" "vld<order>x")
2264 (set_attr "mode" "<MODE>")
2265 (set_attr "group_overlap" "W43,W43,W43,W43,W86,W86,W86,W86,none,none")])
2267 (define_insn "@pred_indexed_<order>load<mode>_x8_greater_eew"
2268 [(set (match_operand:VEEWEXT8 0 "register_operand" "=vd, vr, vd, vr, ?&vr, ?&vr")
2269 (if_then_else:VEEWEXT8
2271 [(match_operand:<VM> 1 "vector_mask_operand" " vm,Wc1, vm,Wc1,vmWc1,vmWc1")
2272 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK, rK, rK")
2273 (match_operand 6 "const_int_operand" " i, i, i, i, i, i")
2274 (match_operand 7 "const_int_operand" " i, i, i, i, i, i")
2275 (match_operand 8 "const_int_operand" " i, i, i, i, i, i")
2277 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2279 [(match_operand 3 "pmode_reg_or_0_operand" " rJ, rJ, rJ, rJ, rJ, rJ")
2281 (match_operand:<VINDEX_OCT_TRUNC> 4 "register_operand" "W87,W87,W87,W87, vr, vr")] ORDER)
2282 (match_operand:VEEWEXT8 2 "vector_merge_operand" " vu, vu, 0, 0, vu, 0")))]
2284 "vl<order>xei<oct_trunc_sew>.v\t%0,(%z3),%4%p1"
2285 [(set_attr "type" "vld<order>x")
2286 (set_attr "mode" "<MODE>")
2287 (set_attr "group_overlap" "W87,W87,W87,W87,none,none")])
2289 ;; DEST eew is smaller than SOURCE eew.
2290 (define_insn "@pred_indexed_<order>load<mode>_x2_smaller_eew"
2291 [(set (match_operand:VEEWTRUNC2 0 "register_operand" "=vd, vd, vr, vr, &vr, &vr")
2292 (if_then_else:VEEWTRUNC2
2294 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1,vmWc1,vmWc1")
2295 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK, rK, rK")
2296 (match_operand 6 "const_int_operand" " i, i, i, i, i, i")
2297 (match_operand 7 "const_int_operand" " i, i, i, i, i, i")
2298 (match_operand 8 "const_int_operand" " i, i, i, i, i, i")
2300 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2302 [(match_operand 3 "pmode_reg_or_0_operand" " rJ, rJ, rJ, rJ, rJ, rJ")
2304 (match_operand:<VINDEX_DOUBLE_EXT> 4 "register_operand" " 0, 0, 0, 0, vr, vr")] ORDER)
2305 (match_operand:VEEWTRUNC2 2 "vector_merge_operand" " vu, 0, vu, 0, vu, 0")))]
2307 "vl<order>xei<double_ext_sew>.v\t%0,(%z3),%4%p1"
2308 [(set_attr "type" "vld<order>x")
2309 (set_attr "mode" "<MODE>")])
2311 (define_insn "@pred_indexed_<order>load<mode>_x4_smaller_eew"
2312 [(set (match_operand:VEEWTRUNC4 0 "register_operand" "=vd, vd, vr, vr, &vr, &vr")
2313 (if_then_else:VEEWTRUNC4
2315 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1,vmWc1,vmWc1")
2316 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK, rK, rK")
2317 (match_operand 6 "const_int_operand" " i, i, i, i, i, i")
2318 (match_operand 7 "const_int_operand" " i, i, i, i, i, i")
2319 (match_operand 8 "const_int_operand" " i, i, i, i, i, i")
2321 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2323 [(match_operand 3 "pmode_reg_or_0_operand" " rJ, rJ, rJ, rJ, rJ, rJ")
2325 (match_operand:<VINDEX_QUAD_EXT> 4 "register_operand" " 0, 0, 0, 0, vr, vr")] ORDER)
2326 (match_operand:VEEWTRUNC4 2 "vector_merge_operand" " vu, 0, vu, 0, vu, 0")))]
2328 "vl<order>xei<quad_ext_sew>.v\t%0,(%z3),%4%p1"
2329 [(set_attr "type" "vld<order>x")
2330 (set_attr "mode" "<MODE>")])
2332 (define_insn "@pred_indexed_<order>load<mode>_x8_smaller_eew"
2333 [(set (match_operand:VEEWTRUNC8 0 "register_operand" "=vd, vd, vr, vr, &vr, &vr")
2334 (if_then_else:VEEWTRUNC8
2336 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1,vmWc1,vmWc1")
2337 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK, rK, rK")
2338 (match_operand 6 "const_int_operand" " i, i, i, i, i, i")
2339 (match_operand 7 "const_int_operand" " i, i, i, i, i, i")
2340 (match_operand 8 "const_int_operand" " i, i, i, i, i, i")
2342 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2344 [(match_operand 3 "pmode_reg_or_0_operand" " rJ, rJ, rJ, rJ, rJ, rJ")
2346 (match_operand:<VINDEX_OCT_EXT> 4 "register_operand" " 0, 0, 0, 0, vr, vr")] ORDER)
2347 (match_operand:VEEWTRUNC8 2 "vector_merge_operand" " vu, 0, vu, 0, vu, 0")))]
2349 "vl<order>xei<oct_ext_sew>.v\t%0,(%z3),%4%p1"
2350 [(set_attr "type" "vld<order>x")
2351 (set_attr "mode" "<MODE>")])
2353 (define_insn "@pred_indexed_<order>store<RATIO64:mode><RATIO64I:mode>"
2354 [(set (mem:BLK (scratch))
2357 [(match_operand:<VM> 0 "vector_mask_operand" "vmWc1")
2358 (match_operand 4 "vector_length_operand" " rK")
2359 (match_operand 5 "const_int_operand" " i")
2361 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2362 (match_operand 1 "pmode_reg_or_0_operand" " rJ")
2363 (match_operand:RATIO64I 2 "register_operand" " vr")
2364 (match_operand:RATIO64 3 "register_operand" " vr")] ORDER))]
2366 "vs<order>xei<RATIO64I:sew>.v\t%3,(%z1),%2%p0"
2367 [(set_attr "type" "vst<order>x")
2368 (set_attr "mode" "<RATIO64:MODE>")])
2370 (define_insn "@pred_indexed_<order>store<RATIO32:mode><RATIO32I:mode>"
2371 [(set (mem:BLK (scratch))
2374 [(match_operand:<VM> 0 "vector_mask_operand" "vmWc1")
2375 (match_operand 4 "vector_length_operand" " rK")
2376 (match_operand 5 "const_int_operand" " i")
2378 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2379 (match_operand 1 "pmode_reg_or_0_operand" " rJ")
2380 (match_operand:RATIO32I 2 "register_operand" " vr")
2381 (match_operand:RATIO32 3 "register_operand" " vr")] ORDER))]
2383 "vs<order>xei<RATIO32I:sew>.v\t%3,(%z1),%2%p0"
2384 [(set_attr "type" "vst<order>x")
2385 (set_attr "mode" "<RATIO32:MODE>")])
2387 (define_insn "@pred_indexed_<order>store<RATIO16:mode><RATIO16I:mode>"
2388 [(set (mem:BLK (scratch))
2391 [(match_operand:<VM> 0 "vector_mask_operand" "vmWc1")
2392 (match_operand 4 "vector_length_operand" " rK")
2393 (match_operand 5 "const_int_operand" " i")
2395 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2396 (match_operand 1 "pmode_reg_or_0_operand" " rJ")
2397 (match_operand:RATIO16I 2 "register_operand" " vr")
2398 (match_operand:RATIO16 3 "register_operand" " vr")] ORDER))]
2400 "vs<order>xei<RATIO16I:sew>.v\t%3,(%z1),%2%p0"
2401 [(set_attr "type" "vst<order>x")
2402 (set_attr "mode" "<RATIO16:MODE>")])
2404 (define_insn "@pred_indexed_<order>store<RATIO8:mode><RATIO8I:mode>"
2405 [(set (mem:BLK (scratch))
2408 [(match_operand:<VM> 0 "vector_mask_operand" "vmWc1")
2409 (match_operand 4 "vector_length_operand" " rK")
2410 (match_operand 5 "const_int_operand" " i")
2412 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2413 (match_operand 1 "pmode_reg_or_0_operand" " rJ")
2414 (match_operand:RATIO8I 2 "register_operand" " vr")
2415 (match_operand:RATIO8 3 "register_operand" " vr")] ORDER))]
2417 "vs<order>xei<RATIO8I:sew>.v\t%3,(%z1),%2%p0"
2418 [(set_attr "type" "vst<order>x")
2419 (set_attr "mode" "<RATIO8:MODE>")])
2421 (define_insn "@pred_indexed_<order>store<RATIO4:mode><RATIO4I:mode>"
2422 [(set (mem:BLK (scratch))
2425 [(match_operand:<VM> 0 "vector_mask_operand" "vmWc1")
2426 (match_operand 4 "vector_length_operand" " rK")
2427 (match_operand 5 "const_int_operand" " i")
2429 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2430 (match_operand 1 "pmode_reg_or_0_operand" " rJ")
2431 (match_operand:RATIO4I 2 "register_operand" " vr")
2432 (match_operand:RATIO4 3 "register_operand" " vr")] ORDER))]
2434 "vs<order>xei<RATIO4I:sew>.v\t%3,(%z1),%2%p0"
2435 [(set_attr "type" "vst<order>x")
2436 (set_attr "mode" "<RATIO4:MODE>")])
2438 (define_insn "@pred_indexed_<order>store<RATIO2:mode><RATIO2I:mode>"
2439 [(set (mem:BLK (scratch))
2442 [(match_operand:<VM> 0 "vector_mask_operand" "vmWc1")
2443 (match_operand 4 "vector_length_operand" " rK")
2444 (match_operand 5 "const_int_operand" " i")
2446 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2447 (match_operand 1 "pmode_reg_or_0_operand" " rJ")
2448 (match_operand:RATIO2I 2 "register_operand" " vr")
2449 (match_operand:RATIO2 3 "register_operand" " vr")] ORDER))]
2451 "vs<order>xei<RATIO2I:sew>.v\t%3,(%z1),%2%p0"
2452 [(set_attr "type" "vst<order>x")
2453 (set_attr "mode" "<RATIO2:MODE>")])
2455 (define_insn "@pred_indexed_<order>store<RATIO1:mode><RATIO1:mode>"
2456 [(set (mem:BLK (scratch))
2459 [(match_operand:<VM> 0 "vector_mask_operand" "vmWc1")
2460 (match_operand 4 "vector_length_operand" " rK")
2461 (match_operand 5 "const_int_operand" " i")
2463 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2464 (match_operand 1 "pmode_reg_or_0_operand" " rJ")
2465 (match_operand:RATIO1 2 "register_operand" " vr")
2466 (match_operand:RATIO1 3 "register_operand" " vr")] ORDER))]
2468 "vs<order>xei<RATIO1:sew>.v\t%3,(%z1),%2%p0"
2469 [(set_attr "type" "vst<order>x")
2470 (set_attr "mode" "<RATIO1:MODE>")])
2472 ;; -------------------------------------------------------------------------------
2473 ;; ---- Predicated integer binary operations
2474 ;; -------------------------------------------------------------------------------
2476 ;; - 11.1 Vector Single-Width Integer Add and Subtract
2477 ;; - 11.4 Vector Integer Add-with-Carry/Subtract-with-Borrow Instructions
2478 ;; - 11.5 Vector Bitwise Logical Instructions
2479 ;; - 11.6 Vector Single-Width Bit Shift Instructions
2480 ;; - 11.9 Vector Integer Min/Max Instructions
2481 ;; - 11.10 Vector Single-Width Integer Multiply Instructions
2482 ;; - 11.11 Vector Integer Divide Instructions
2483 ;; -------------------------------------------------------------------------------
2485 (define_insn "@pred_<optab><mode>"
2486 [(set (match_operand:V_VLSI 0 "register_operand" "=vd, vd, vr, vr, vd, vd, vr, vr, vd, vd, vr, vr")
2487 (if_then_else:V_VLSI
2489 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1, vm, vm,Wc1,Wc1, vm, vm,Wc1,Wc1")
2490 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK")
2491 (match_operand 6 "const_int_operand" " i, i, i, i, i, i, i, i, i, i, i, i")
2492 (match_operand 7 "const_int_operand" " i, i, i, i, i, i, i, i, i, i, i, i")
2493 (match_operand 8 "const_int_operand" " i, i, i, i, i, i, i, i, i, i, i, i")
2495 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2496 (any_int_binop:V_VLSI
2497 (match_operand:V_VLSI 3 "<binop_rhs1_predicate>" "<binop_rhs1_constraint>")
2498 (match_operand:V_VLSI 4 "<binop_rhs2_predicate>" "<binop_rhs2_constraint>"))
2499 (match_operand:V_VLSI 2 "vector_merge_operand" "vu,0,vu,0,vu,0,vu,0,vu,0,vu,0")))]
2502 v<insn>.vv\t%0,%3,%4%p1
2503 v<insn>.vv\t%0,%3,%4%p1
2504 v<insn>.vv\t%0,%3,%4%p1
2505 v<insn>.vv\t%0,%3,%4%p1
2506 v<binop_vi_variant_insn>\t%0,<binop_vi_variant_op>%p1
2507 v<binop_vi_variant_insn>\t%0,<binop_vi_variant_op>%p1
2508 v<binop_vi_variant_insn>\t%0,<binop_vi_variant_op>%p1
2509 v<binop_vi_variant_insn>\t%0,<binop_vi_variant_op>%p1
2510 v<binop_reverse_vi_variant_insn>\t%0,<binop_reverse_vi_variant_op>%p1
2511 v<binop_reverse_vi_variant_insn>\t%0,<binop_reverse_vi_variant_op>%p1
2512 v<binop_reverse_vi_variant_insn>\t%0,<binop_reverse_vi_variant_op>%p1
2513 v<binop_reverse_vi_variant_insn>\t%0,<binop_reverse_vi_variant_op>%p1"
2514 [(set_attr "type" "<int_binop_insn_type>")
2515 (set_attr "mode" "<MODE>")])
2517 ;; vx instructions patterns.
2518 ;; Note: Unlike vv patterns, we should split them since they are variant.
2519 ;; For vsll.vx/vsra.vx/vsrl.vx the scalar mode should be Pmode wheras the
2520 ;; scalar mode is inner mode of the RVV mode for other vx patterns.
2521 (define_insn "@pred_<optab><mode>_scalar"
2522 [(set (match_operand:V_VLSI 0 "register_operand" "=vd,vd, vr, vr,vd,vd, vr, vr")
2523 (if_then_else:V_VLSI
2525 [(match_operand:<VM> 1 "vector_mask_operand" "vm,vm,Wc1,Wc1,vm,vm,Wc1,Wc1")
2526 (match_operand 5 "vector_length_operand" "rK,rK, rK, rK,rK,rK, rK, rK")
2527 (match_operand 6 "const_int_operand" " i, i, i, i, i, i, i, i")
2528 (match_operand 7 "const_int_operand" " i, i, i, i, i, i, i, i")
2529 (match_operand 8 "const_int_operand" " i, i, i, i, i, i, i, i")
2531 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2533 (match_operand:V_VLSI 3 "register_operand" "vr,vr, vr, vr,vr,vr, vr, vr")
2534 (match_operand 4 "pmode_reg_or_uimm5_operand" " r, r, r, r, K, K, K, K"))
2535 (match_operand:V_VLSI 2 "vector_merge_operand" "vu, 0, vu, 0,vu, 0, vu, 0")))]
2537 "v<insn>.v%o4\t%0,%3,%4%p1"
2538 [(set_attr "type" "vshift")
2539 (set_attr "mode" "<MODE>")])
2541 ;; Handle GET_MODE_INNER (mode) = QImode, HImode, SImode.
2542 (define_insn "@pred_<optab><mode>_scalar"
2543 [(set (match_operand:V_VLSI_QHS 0 "register_operand" "=vd,vd, vr, vr")
2544 (if_then_else:V_VLSI_QHS
2546 [(match_operand:<VM> 1 "vector_mask_operand" "vm,vm,Wc1,Wc1")
2547 (match_operand 5 "vector_length_operand" "rK,rK, rK, rK")
2548 (match_operand 6 "const_int_operand" " i, i, i, i")
2549 (match_operand 7 "const_int_operand" " i, i, i, i")
2550 (match_operand 8 "const_int_operand" " i, i, i, i")
2552 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2553 (any_commutative_binop:V_VLSI_QHS
2554 (vec_duplicate:V_VLSI_QHS
2555 (match_operand:<VEL> 4 "reg_or_0_operand" "rJ,rJ, rJ, rJ"))
2556 (match_operand:V_VLSI_QHS 3 "register_operand" "vr,vr, vr, vr"))
2557 (match_operand:V_VLSI_QHS 2 "vector_merge_operand" "vu, 0, vu, 0")))]
2559 "v<insn>.vx\t%0,%3,%z4%p1"
2560 [(set_attr "type" "<int_binop_insn_type>")
2561 (set_attr "mode" "<MODE>")])
2563 (define_insn "@pred_<optab><mode>_scalar"
2564 [(set (match_operand:V_VLSI_QHS 0 "register_operand" "=vd,vd, vr, vr")
2565 (if_then_else:V_VLSI_QHS
2567 [(match_operand:<VM> 1 "vector_mask_operand" "vm,vm,Wc1,Wc1")
2568 (match_operand 5 "vector_length_operand" "rK,rK, rK, rK")
2569 (match_operand 6 "const_int_operand" " i, i, i, i")
2570 (match_operand 7 "const_int_operand" " i, i, i, i")
2571 (match_operand 8 "const_int_operand" " i, i, i, i")
2573 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2574 (any_non_commutative_binop:V_VLSI_QHS
2575 (match_operand:V_VLSI_QHS 3 "register_operand" "vr,vr, vr, vr")
2576 (vec_duplicate:V_VLSI_QHS
2577 (match_operand:<VEL> 4 "reg_or_0_operand" "rJ,rJ, rJ, rJ")))
2578 (match_operand:V_VLSI_QHS 2 "vector_merge_operand" "vu, 0, vu, 0")))]
2580 "v<insn>.vx\t%0,%3,%z4%p1"
2581 [(set_attr "type" "<int_binop_insn_type>")
2582 (set_attr "mode" "<MODE>")])
2584 (define_insn "@pred_sub<mode>_reverse_scalar"
2585 [(set (match_operand:V_VLSI_QHS 0 "register_operand" "=vd,vd, vr, vr")
2586 (if_then_else:V_VLSI_QHS
2588 [(match_operand:<VM> 1 "vector_mask_operand" "vm,vm,Wc1,Wc1")
2589 (match_operand 5 "vector_length_operand" "rK,rK, rK, rK")
2590 (match_operand 6 "const_int_operand" " i, i, i, i")
2591 (match_operand 7 "const_int_operand" " i, i, i, i")
2592 (match_operand 8 "const_int_operand" " i, i, i, i")
2594 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2596 (vec_duplicate:V_VLSI_QHS
2597 (match_operand:<VEL> 4 "reg_or_0_operand" "rJ,rJ, rJ, rJ"))
2598 (match_operand:V_VLSI_QHS 3 "register_operand" "vr,vr, vr, vr"))
2599 (match_operand:V_VLSI_QHS 2 "vector_merge_operand" "vu, 0, vu, 0")))]
2601 "vrsub.vx\t%0,%3,%z4%p1"
2602 [(set_attr "type" "vialu")
2603 (set_attr "mode" "<MODE>")])
2605 ;; Handle GET_MODE_INNER (mode) = DImode. We need to split them since
2606 ;; we need to deal with SEW = 64 in RV32 system.
2607 (define_expand "@pred_<optab><mode>_scalar"
2608 [(set (match_operand:V_VLSI_D 0 "register_operand")
2609 (if_then_else:V_VLSI_D
2611 [(match_operand:<VM> 1 "vector_mask_operand")
2612 (match_operand 5 "vector_length_operand")
2613 (match_operand 6 "const_int_operand")
2614 (match_operand 7 "const_int_operand")
2615 (match_operand 8 "const_int_operand")
2617 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2618 (any_commutative_binop:V_VLSI_D
2619 (vec_duplicate:V_VLSI_D
2620 (match_operand:<VEL> 4 "reg_or_int_operand"))
2621 (match_operand:V_VLSI_D 3 "register_operand"))
2622 (match_operand:V_VLSI_D 2 "vector_merge_operand")))]
2625 if (riscv_vector::sew64_scalar_helper (
2627 /* scalar op */&operands[4],
2628 /* vl */operands[5],
2630 riscv_vector::has_vi_variant_p (<CODE>, operands[4]),
2631 [] (rtx *operands, rtx boardcast_scalar) {
2632 emit_insn (gen_pred_<optab><mode> (operands[0], operands[1],
2633 operands[2], operands[3], boardcast_scalar, operands[5],
2634 operands[6], operands[7], operands[8]));
2636 (riscv_vector::avl_type) INTVAL (operands[8])))
2640 (define_insn "*pred_<optab><mode>_scalar"
2641 [(set (match_operand:V_VLSI_D 0 "register_operand" "=vd,vd, vr, vr")
2642 (if_then_else:V_VLSI_D
2644 [(match_operand:<VM> 1 "vector_mask_operand" "vm,vm,Wc1,Wc1")
2645 (match_operand 5 "vector_length_operand" "rK,rK, rK, rK")
2646 (match_operand 6 "const_int_operand" " i, i, i, i")
2647 (match_operand 7 "const_int_operand" " i, i, i, i")
2648 (match_operand 8 "const_int_operand" " i, i, i, i")
2650 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2651 (any_commutative_binop:V_VLSI_D
2652 (vec_duplicate:V_VLSI_D
2653 (match_operand:<VEL> 4 "reg_or_0_operand" "rJ,rJ, rJ, rJ"))
2654 (match_operand:V_VLSI_D 3 "register_operand" "vr,vr, vr, vr"))
2655 (match_operand:V_VLSI_D 2 "vector_merge_operand" "vu, 0, vu, 0")))]
2657 "v<insn>.vx\t%0,%3,%z4%p1"
2658 [(set_attr "type" "<int_binop_insn_type>")
2659 (set_attr "mode" "<MODE>")])
2661 (define_insn "*pred_<optab><mode>_extended_scalar"
2662 [(set (match_operand:V_VLSI_D 0 "register_operand" "=vd,vd, vr, vr")
2663 (if_then_else:V_VLSI_D
2665 [(match_operand:<VM> 1 "vector_mask_operand" "vm,vm,Wc1,Wc1")
2666 (match_operand 5 "vector_length_operand" "rK,rK, rK, rK")
2667 (match_operand 6 "const_int_operand" " i, i, i, i")
2668 (match_operand 7 "const_int_operand" " i, i, i, i")
2669 (match_operand 8 "const_int_operand" " i, i, i, i")
2671 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2672 (any_commutative_binop:V_VLSI_D
2673 (vec_duplicate:V_VLSI_D
2675 (match_operand:<VSUBEL> 4 "reg_or_0_operand" "rJ,rJ, rJ, rJ")))
2676 (match_operand:V_VLSI_D 3 "register_operand" "vr,vr, vr, vr"))
2677 (match_operand:V_VLSI_D 2 "vector_merge_operand" "vu, 0, vu, 0")))]
2678 "TARGET_VECTOR && !TARGET_64BIT"
2679 "v<insn>.vx\t%0,%3,%z4%p1"
2680 [(set_attr "type" "<int_binop_insn_type>")
2681 (set_attr "mode" "<MODE>")])
2683 (define_expand "@pred_<optab><mode>_scalar"
2684 [(set (match_operand:V_VLSI_D 0 "register_operand")
2685 (if_then_else:V_VLSI_D
2687 [(match_operand:<VM> 1 "vector_mask_operand")
2688 (match_operand 5 "vector_length_operand")
2689 (match_operand 6 "const_int_operand")
2690 (match_operand 7 "const_int_operand")
2691 (match_operand 8 "const_int_operand")
2693 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2694 (any_non_commutative_binop:V_VLSI_D
2695 (match_operand:V_VLSI_D 3 "register_operand")
2696 (vec_duplicate:V_VLSI_D
2697 (match_operand:<VEL> 4 "reg_or_int_operand")))
2698 (match_operand:V_VLSI_D 2 "vector_merge_operand")))]
2701 if (riscv_vector::sew64_scalar_helper (
2703 /* scalar op */&operands[4],
2704 /* vl */operands[5],
2706 riscv_vector::has_vi_variant_p (<CODE>, operands[4]),
2707 [] (rtx *operands, rtx boardcast_scalar) {
2708 emit_insn (gen_pred_<optab><mode> (operands[0], operands[1],
2709 operands[2], operands[3], boardcast_scalar, operands[5],
2710 operands[6], operands[7], operands[8]));
2712 (riscv_vector::avl_type) INTVAL (operands[8])))
2716 (define_insn "*pred_<optab><mode>_scalar"
2717 [(set (match_operand:V_VLSI_D 0 "register_operand" "=vd,vd, vr, vr")
2718 (if_then_else:V_VLSI_D
2720 [(match_operand:<VM> 1 "vector_mask_operand" "vm,vm,Wc1,Wc1")
2721 (match_operand 5 "vector_length_operand" "rK,rK, rK, rK")
2722 (match_operand 6 "const_int_operand" " i, i, i, i")
2723 (match_operand 7 "const_int_operand" " i, i, i, i")
2724 (match_operand 8 "const_int_operand" " i, i, i, i")
2726 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2727 (any_non_commutative_binop:V_VLSI_D
2728 (match_operand:V_VLSI_D 3 "register_operand" "vr,vr, vr, vr")
2729 (vec_duplicate:V_VLSI_D
2730 (match_operand:<VEL> 4 "reg_or_0_operand" "rJ,rJ, rJ, rJ")))
2731 (match_operand:V_VLSI_D 2 "vector_merge_operand" "vu, 0, vu, 0")))]
2733 "v<insn>.vx\t%0,%3,%z4%p1"
2734 [(set_attr "type" "<int_binop_insn_type>")
2735 (set_attr "mode" "<MODE>")])
2737 (define_insn "*pred_<optab><mode>_extended_scalar"
2738 [(set (match_operand:V_VLSI_D 0 "register_operand" "=vd,vd, vr, vr")
2739 (if_then_else:V_VLSI_D
2741 [(match_operand:<VM> 1 "vector_mask_operand" "vm,vm,Wc1,Wc1")
2742 (match_operand 5 "vector_length_operand" "rK,rK, rK, rK")
2743 (match_operand 6 "const_int_operand" " i, i, i, i")
2744 (match_operand 7 "const_int_operand" " i, i, i, i")
2745 (match_operand 8 "const_int_operand" " i, i, i, i")
2747 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2748 (any_non_commutative_binop:V_VLSI_D
2749 (match_operand:V_VLSI_D 3 "register_operand" "vr,vr, vr, vr")
2750 (vec_duplicate:V_VLSI_D
2752 (match_operand:<VSUBEL> 4 "reg_or_0_operand" "rJ,rJ, rJ, rJ"))))
2753 (match_operand:V_VLSI_D 2 "vector_merge_operand" "vu, 0, vu, 0")))]
2754 "TARGET_VECTOR && !TARGET_64BIT"
2755 "v<insn>.vx\t%0,%3,%z4%p1"
2756 [(set_attr "type" "<int_binop_insn_type>")
2757 (set_attr "mode" "<MODE>")])
2759 (define_expand "@pred_sub<mode>_reverse_scalar"
2760 [(set (match_operand:V_VLSI_D 0 "register_operand")
2761 (if_then_else:V_VLSI_D
2763 [(match_operand:<VM> 1 "vector_mask_operand")
2764 (match_operand 5 "vector_length_operand")
2765 (match_operand 6 "const_int_operand")
2766 (match_operand 7 "const_int_operand")
2767 (match_operand 8 "const_int_operand")
2769 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2771 (vec_duplicate:V_VLSI_D
2772 (match_operand:<VEL> 4 "reg_or_int_operand"))
2773 (match_operand:V_VLSI_D 3 "register_operand"))
2774 (match_operand:V_VLSI_D 2 "vector_merge_operand")))]
2777 if (riscv_vector::sew64_scalar_helper (
2779 /* scalar op */&operands[4],
2780 /* vl */operands[5],
2782 riscv_vector::neg_simm5_p (operands[4]),
2783 [] (rtx *operands, rtx boardcast_scalar) {
2784 emit_insn (gen_pred_sub<mode> (operands[0], operands[1],
2785 operands[2], boardcast_scalar, operands[3], operands[5],
2786 operands[6], operands[7], operands[8]));
2788 (riscv_vector::avl_type) INTVAL (operands[8])))
2792 (define_insn "*pred_sub<mode>_reverse_scalar"
2793 [(set (match_operand:V_VLSI_D 0 "register_operand" "=vd,vd, vr, vr")
2794 (if_then_else:V_VLSI_D
2796 [(match_operand:<VM> 1 "vector_mask_operand" "vm,vm,Wc1,Wc1")
2797 (match_operand 5 "vector_length_operand" "rK,rK, rK, rK")
2798 (match_operand 6 "const_int_operand" " i, i, i, i")
2799 (match_operand 7 "const_int_operand" " i, i, i, i")
2800 (match_operand 8 "const_int_operand" " i, i, i, i")
2802 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2804 (vec_duplicate:V_VLSI_D
2805 (match_operand:<VEL> 4 "reg_or_0_operand" "rJ,rJ, rJ, rJ"))
2806 (match_operand:V_VLSI_D 3 "register_operand" "vr,vr, vr, vr"))
2807 (match_operand:V_VLSI_D 2 "vector_merge_operand" "vu, 0, vu, 0")))]
2809 "vrsub.vx\t%0,%3,%z4%p1"
2810 [(set_attr "type" "vialu")
2811 (set_attr "mode" "<MODE>")])
2813 (define_insn "*pred_sub<mode>_extended_reverse_scalar"
2814 [(set (match_operand:V_VLSI_D 0 "register_operand" "=vd,vd, vr, vr")
2815 (if_then_else:V_VLSI_D
2817 [(match_operand:<VM> 1 "vector_mask_operand" "vm,vm,Wc1,Wc1")
2818 (match_operand 5 "vector_length_operand" "rK,rK, rK, rK")
2819 (match_operand 6 "const_int_operand" " i, i, i, i")
2820 (match_operand 7 "const_int_operand" " i, i, i, i")
2821 (match_operand 8 "const_int_operand" " i, i, i, i")
2823 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2825 (vec_duplicate:V_VLSI_D
2827 (match_operand:<VSUBEL> 4 "reg_or_0_operand" "rJ,rJ, rJ, rJ")))
2828 (match_operand:V_VLSI_D 3 "register_operand" "vr,vr, vr, vr"))
2829 (match_operand:V_VLSI_D 2 "vector_merge_operand" "vu, 0, vu, 0")))]
2830 "TARGET_VECTOR && !TARGET_64BIT"
2831 "vrsub.vx\t%0,%3,%z4%p1"
2832 [(set_attr "type" "vialu")
2833 (set_attr "mode" "<MODE>")])
2835 ;; Multiply High instructions.
2836 (define_insn "@pred_mulh<v_su><mode>"
2837 [(set (match_operand:VFULLI 0 "register_operand" "=vd,vd, vr, vr")
2838 (if_then_else:VFULLI
2840 [(match_operand:<VM> 1 "vector_mask_operand" "vm,vm,Wc1,Wc1")
2841 (match_operand 5 "vector_length_operand" "rK,rK, rK, rK")
2842 (match_operand 6 "const_int_operand" " i, i, i, i")
2843 (match_operand 7 "const_int_operand" " i, i, i, i")
2844 (match_operand 8 "const_int_operand" " i, i, i, i")
2846 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2848 [(match_operand:VFULLI 3 "register_operand" "vr,vr, vr, vr")
2849 (match_operand:VFULLI 4 "register_operand" "vr,vr, vr, vr")] VMULH)
2850 (match_operand:VFULLI 2 "vector_merge_operand" "vu, 0, vu, 0")))]
2852 "vmulh<v_su>.vv\t%0,%3,%4%p1"
2853 [(set_attr "type" "vimul")
2854 (set_attr "mode" "<MODE>")])
2856 (define_insn "@pred_mulh<v_su><mode>_scalar"
2857 [(set (match_operand:VI_QHS 0 "register_operand" "=vd,vd, vr, vr")
2858 (if_then_else:VI_QHS
2860 [(match_operand:<VM> 1 "vector_mask_operand" "vm,vm,Wc1,Wc1")
2861 (match_operand 5 "vector_length_operand" "rK,rK, rK, rK")
2862 (match_operand 6 "const_int_operand" " i, i, i, i")
2863 (match_operand 7 "const_int_operand" " i, i, i, i")
2864 (match_operand 8 "const_int_operand" " i, i, i, i")
2866 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2868 [(vec_duplicate:VI_QHS
2869 (match_operand:<VEL> 4 "reg_or_0_operand" "rJ,rJ, rJ, rJ"))
2870 (match_operand:VI_QHS 3 "register_operand" "vr,vr, vr, vr")] VMULH)
2871 (match_operand:VI_QHS 2 "vector_merge_operand" "vu, 0, vu, 0")))]
2873 "vmulh<v_su>.vx\t%0,%3,%z4%p1"
2874 [(set_attr "type" "vimul")
2875 (set_attr "mode" "<MODE>")])
2877 (define_expand "@pred_mulh<v_su><mode>_scalar"
2878 [(set (match_operand:VFULLI_D 0 "register_operand")
2879 (if_then_else:VFULLI_D
2881 [(match_operand:<VM> 1 "vector_mask_operand")
2882 (match_operand 5 "vector_length_operand")
2883 (match_operand 6 "const_int_operand")
2884 (match_operand 7 "const_int_operand")
2885 (match_operand 8 "const_int_operand")
2887 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2889 [(vec_duplicate:VFULLI_D
2890 (match_operand:<VEL> 4 "reg_or_int_operand"))
2891 (match_operand:VFULLI_D 3 "register_operand")] VMULH)
2892 (match_operand:VFULLI_D 2 "vector_merge_operand")))]
2895 if (riscv_vector::sew64_scalar_helper (
2897 /* scalar op */&operands[4],
2898 /* vl */operands[5],
2901 [] (rtx *operands, rtx boardcast_scalar) {
2902 emit_insn (gen_pred_mulh<v_su><mode> (operands[0], operands[1],
2903 operands[2], operands[3], boardcast_scalar, operands[5],
2904 operands[6], operands[7], operands[8]));
2906 (riscv_vector::avl_type) INTVAL (operands[8])))
2910 (define_insn "*pred_mulh<v_su><mode>_scalar"
2911 [(set (match_operand:VFULLI_D 0 "register_operand" "=vd,vd, vr, vr")
2912 (if_then_else:VFULLI_D
2914 [(match_operand:<VM> 1 "vector_mask_operand" "vm,vm,Wc1,Wc1")
2915 (match_operand 5 "vector_length_operand" "rK,rK, rK, rK")
2916 (match_operand 6 "const_int_operand" " i, i, i, i")
2917 (match_operand 7 "const_int_operand" " i, i, i, i")
2918 (match_operand 8 "const_int_operand" " i, i, i, i")
2920 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2922 [(vec_duplicate:VFULLI_D
2923 (match_operand:<VEL> 4 "reg_or_0_operand" "rJ,rJ, rJ, rJ"))
2924 (match_operand:VFULLI_D 3 "register_operand" "vr,vr, vr, vr")] VMULH)
2925 (match_operand:VFULLI_D 2 "vector_merge_operand" "vu, 0, vu, 0")))]
2927 "vmulh<v_su>.vx\t%0,%3,%z4%p1"
2928 [(set_attr "type" "vimul")
2929 (set_attr "mode" "<MODE>")])
2931 (define_insn "*pred_mulh<v_su><mode>_extended_scalar"
2932 [(set (match_operand:VFULLI_D 0 "register_operand" "=vd,vd, vr, vr")
2933 (if_then_else:VFULLI_D
2935 [(match_operand:<VM> 1 "vector_mask_operand" "vm,vm,Wc1,Wc1")
2936 (match_operand 5 "vector_length_operand" "rK,rK, rK, rK")
2937 (match_operand 6 "const_int_operand" " i, i, i, i")
2938 (match_operand 7 "const_int_operand" " i, i, i, i")
2939 (match_operand 8 "const_int_operand" " i, i, i, i")
2941 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2943 [(vec_duplicate:VFULLI_D
2945 (match_operand:<VSUBEL> 4 "reg_or_0_operand" "rJ,rJ, rJ, rJ")))
2946 (match_operand:VFULLI_D 3 "register_operand" "vr,vr, vr, vr")] VMULH)
2947 (match_operand:VFULLI_D 2 "vector_merge_operand" "vu, 0, vu, 0")))]
2948 "TARGET_VECTOR && !TARGET_64BIT"
2949 "vmulh<v_su>.vx\t%0,%3,%z4%p1"
2950 [(set_attr "type" "vimul")
2951 (set_attr "mode" "<MODE>")])
2953 ;; Vector Integer Add-with-Carry / Subtract-with-Borrow Instructions
2954 (define_insn "@pred_adc<mode>"
2955 [(set (match_operand:VI 0 "register_operand" "=vd,vd,vd,vd")
2958 [(match_operand 5 "vector_length_operand" "rK,rK,rK,rK")
2959 (match_operand 6 "const_int_operand" " i, i, i, i")
2960 (match_operand 7 "const_int_operand" " i, i, i, i")
2962 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2965 (match_operand:VI 2 "register_operand" "vr,vr,vr,vr")
2966 (match_operand:VI 3 "vector_arith_operand" "vr,vr,vi,vi"))
2967 (match_operand:<VM> 4 "register_operand" "vm,vm,vm,vm")] UNSPEC_VADC)
2968 (match_operand:VI 1 "vector_merge_operand" "vu, 0,vu, 0")))]
2970 "vadc.v%o3m\t%0,%2,%v3,%4"
2971 [(set_attr "type" "vicalu")
2972 (set_attr "mode" "<MODE>")
2973 (set_attr "merge_op_idx" "1")
2974 (set_attr "vl_op_idx" "5")
2975 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[6])"))
2976 (set (attr "avl_type_idx") (const_int 7))])
2978 (define_insn "@pred_sbc<mode>"
2979 [(set (match_operand:VI 0 "register_operand" "=vd,vd")
2982 [(match_operand 5 "vector_length_operand" "rK,rK")
2983 (match_operand 6 "const_int_operand" " i, i")
2984 (match_operand 7 "const_int_operand" " i, i")
2986 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
2989 (match_operand:VI 2 "register_operand" "vr,vr")
2990 (match_operand:VI 3 "register_operand" "vr,vr"))
2991 (match_operand:<VM> 4 "register_operand" "vm,vm")] UNSPEC_VSBC)
2992 (match_operand:VI 1 "vector_merge_operand" "vu, 0")))]
2994 "vsbc.vvm\t%0,%2,%3,%4"
2995 [(set_attr "type" "vicalu")
2996 (set_attr "mode" "<MODE>")
2997 (set_attr "merge_op_idx" "1")
2998 (set_attr "vl_op_idx" "5")
2999 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[6])"))
3000 (set (attr "avl_type_idx") (const_int 7))])
3002 (define_insn "@pred_adc<mode>_scalar"
3003 [(set (match_operand:VI_QHS 0 "register_operand" "=vd,vd")
3004 (if_then_else:VI_QHS
3006 [(match_operand 5 "vector_length_operand" "rK,rK")
3007 (match_operand 6 "const_int_operand" " i, i")
3008 (match_operand 7 "const_int_operand" " i, i")
3010 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
3013 (vec_duplicate:VI_QHS
3014 (match_operand:<VEL> 3 "register_operand" " r, r"))
3015 (match_operand:VI_QHS 2 "register_operand" "vr,vr"))
3016 (match_operand:<VM> 4 "register_operand" "vm,vm")] UNSPEC_VADC)
3017 (match_operand:VI_QHS 1 "vector_merge_operand" "vu, 0")))]
3019 "vadc.vxm\t%0,%2,%3,%4"
3020 [(set_attr "type" "vicalu")
3021 (set_attr "mode" "<MODE>")
3022 (set_attr "merge_op_idx" "1")
3023 (set_attr "vl_op_idx" "5")
3024 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[6])"))
3025 (set (attr "avl_type_idx") (const_int 7))])
3027 (define_insn "@pred_sbc<mode>_scalar"
3028 [(set (match_operand:VI_QHS 0 "register_operand" "=vd,vd")
3029 (if_then_else:VI_QHS
3031 [(match_operand 5 "vector_length_operand" "rK,rK")
3032 (match_operand 6 "const_int_operand" " i, i")
3033 (match_operand 7 "const_int_operand" " i, i")
3035 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
3038 (match_operand:VI_QHS 2 "register_operand" "vr,vr")
3039 (vec_duplicate:VI_QHS
3040 (match_operand:<VEL> 3 "reg_or_0_operand" "rJ,rJ")))
3041 (match_operand:<VM> 4 "register_operand" "vm,vm")] UNSPEC_VSBC)
3042 (match_operand:VI_QHS 1 "vector_merge_operand" "vu, 0")))]
3044 "vsbc.vxm\t%0,%2,%z3,%4"
3045 [(set_attr "type" "vicalu")
3046 (set_attr "mode" "<MODE>")
3047 (set_attr "merge_op_idx" "1")
3048 (set_attr "vl_op_idx" "5")
3049 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[6])"))
3050 (set (attr "avl_type_idx") (const_int 7))])
3052 (define_expand "@pred_adc<mode>_scalar"
3053 [(set (match_operand:VI_D 0 "register_operand")
3056 [(match_operand 5 "vector_length_operand")
3057 (match_operand 6 "const_int_operand")
3058 (match_operand 7 "const_int_operand")
3060 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
3064 (match_operand:<VEL> 3 "reg_or_int_operand"))
3065 (match_operand:VI_D 2 "register_operand"))
3066 (match_operand:<VM> 4 "register_operand")] UNSPEC_VADC)
3067 (match_operand:VI_D 1 "vector_merge_operand")))]
3070 if (riscv_vector::sew64_scalar_helper (
3072 /* scalar op */&operands[3],
3073 /* vl */operands[5],
3075 riscv_vector::simm5_p (operands[3]),
3076 [] (rtx *operands, rtx boardcast_scalar) {
3077 emit_insn (gen_pred_adc<mode> (operands[0], operands[1],
3078 operands[2], boardcast_scalar, operands[4], operands[5],
3079 operands[6], operands[7]));
3081 (riscv_vector::avl_type) INTVAL (operands[7])))
3085 (define_insn "*pred_adc<mode>_scalar"
3086 [(set (match_operand:VI_D 0 "register_operand" "=vd,vd")
3089 [(match_operand 5 "vector_length_operand" "rK,rK")
3090 (match_operand 6 "const_int_operand" " i, i")
3091 (match_operand 7 "const_int_operand" " i, i")
3093 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
3097 (match_operand:<VEL> 3 "reg_or_0_operand" "rJ,rJ"))
3098 (match_operand:VI_D 2 "register_operand" "vr,vr"))
3099 (match_operand:<VM> 4 "register_operand" "vm,vm")] UNSPEC_VADC)
3100 (match_operand:VI_D 1 "vector_merge_operand" "vu, 0")))]
3102 "vadc.vxm\t%0,%2,%z3,%4"
3103 [(set_attr "type" "vicalu")
3104 (set_attr "mode" "<MODE>")
3105 (set_attr "merge_op_idx" "1")
3106 (set_attr "vl_op_idx" "5")
3107 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[6])"))
3108 (set (attr "avl_type_idx") (const_int 7))])
3110 (define_insn "*pred_adc<mode>_extended_scalar"
3111 [(set (match_operand:VI_D 0 "register_operand" "=vd,vd")
3114 [(match_operand 5 "vector_length_operand" "rK,rK")
3115 (match_operand 6 "const_int_operand" " i, i")
3116 (match_operand 7 "const_int_operand" " i, i")
3118 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
3123 (match_operand:<VSUBEL> 3 "reg_or_0_operand" "rJ,rJ")))
3124 (match_operand:VI_D 2 "register_operand" "vr,vr"))
3125 (match_operand:<VM> 4 "register_operand" "vm,vm")] UNSPEC_VADC)
3126 (match_operand:VI_D 1 "vector_merge_operand" "vu, 0")))]
3127 "TARGET_VECTOR && !TARGET_64BIT"
3128 "vadc.vxm\t%0,%2,%z3,%4"
3129 [(set_attr "type" "vicalu")
3130 (set_attr "mode" "<MODE>")
3131 (set_attr "merge_op_idx" "1")
3132 (set_attr "vl_op_idx" "5")
3133 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[6])"))
3134 (set (attr "avl_type_idx") (const_int 7))])
3136 (define_expand "@pred_sbc<mode>_scalar"
3137 [(set (match_operand:VI_D 0 "register_operand")
3140 [(match_operand 5 "vector_length_operand")
3141 (match_operand 6 "const_int_operand")
3142 (match_operand 7 "const_int_operand")
3144 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
3147 (match_operand:VI_D 2 "register_operand")
3149 (match_operand:<VEL> 3 "reg_or_int_operand")))
3150 (match_operand:<VM> 4 "register_operand")] UNSPEC_VSBC)
3151 (match_operand:VI_D 1 "vector_merge_operand")))]
3154 if (riscv_vector::sew64_scalar_helper (
3156 /* scalar op */&operands[3],
3157 /* vl */operands[5],
3160 [] (rtx *operands, rtx boardcast_scalar) {
3161 emit_insn (gen_pred_sbc<mode> (operands[0], operands[1],
3162 operands[2], boardcast_scalar, operands[4], operands[5],
3163 operands[6], operands[7]));
3165 (riscv_vector::avl_type) INTVAL (operands[7])))
3169 (define_insn "*pred_sbc<mode>_scalar"
3170 [(set (match_operand:VI_D 0 "register_operand" "=vd,vd")
3173 [(match_operand 5 "vector_length_operand" "rK,rK")
3174 (match_operand 6 "const_int_operand" " i, i")
3175 (match_operand 7 "const_int_operand" " i, i")
3177 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
3180 (match_operand:VI_D 2 "register_operand" "vr,vr")
3182 (match_operand:<VEL> 3 "reg_or_0_operand" "rJ,rJ")))
3183 (match_operand:<VM> 4 "register_operand" "vm,vm")] UNSPEC_VSBC)
3184 (match_operand:VI_D 1 "vector_merge_operand" "vu, 0")))]
3186 "vsbc.vxm\t%0,%2,%z3,%4"
3187 [(set_attr "type" "vicalu")
3188 (set_attr "mode" "<MODE>")
3189 (set_attr "merge_op_idx" "1")
3190 (set_attr "vl_op_idx" "5")
3191 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[6])"))
3192 (set (attr "avl_type_idx") (const_int 7))])
3194 (define_insn "*pred_sbc<mode>_extended_scalar"
3195 [(set (match_operand:VI_D 0 "register_operand" "=vd,vd")
3198 [(match_operand 5 "vector_length_operand" "rK,rK")
3199 (match_operand 6 "const_int_operand" " i, i")
3200 (match_operand 7 "const_int_operand" " i, i")
3202 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
3205 (match_operand:VI_D 2 "register_operand" "vr,vr")
3208 (match_operand:<VSUBEL> 3 "reg_or_0_operand" "rJ,rJ"))))
3209 (match_operand:<VM> 4 "register_operand" "vm,vm")] UNSPEC_VSBC)
3210 (match_operand:VI_D 1 "vector_merge_operand" "vu, 0")))]
3211 "TARGET_VECTOR && !TARGET_64BIT"
3212 "vsbc.vxm\t%0,%2,%z3,%4"
3213 [(set_attr "type" "vicalu")
3214 (set_attr "mode" "<MODE>")
3215 (set_attr "merge_op_idx" "1")
3216 (set_attr "vl_op_idx" "5")
3217 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[6])"))
3218 (set (attr "avl_type_idx") (const_int 7))])
3220 (define_insn "@pred_madc<mode>"
3221 [(set (match_operand:<VM> 0 "register_operand" "=vr, &vr, &vr")
3224 (match_operand:VI 1 "register_operand" " %0, vr, vr")
3225 (match_operand:VI 2 "vector_arith_operand" "vrvi, vr, vi"))
3226 (match_operand:<VM> 3 "register_operand" " vm, vm, vm")
3228 [(match_operand 4 "vector_length_operand" " rK, rK, rK")
3229 (match_operand 5 "const_int_operand" " i, i, i")
3231 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)] UNSPEC_VMADC))]
3233 "vmadc.v%o2m\t%0,%1,%v2,%3"
3234 [(set_attr "type" "vicalu")
3235 (set_attr "mode" "<MODE>")
3236 (set_attr "vl_op_idx" "4")
3237 (set (attr "avl_type_idx") (const_int 5))])
3239 (define_insn "@pred_msbc<mode>"
3240 [(set (match_operand:<VM> 0 "register_operand" "=vr, vr, &vr")
3243 (match_operand:VI 1 "register_operand" " 0, vr, vr")
3244 (match_operand:VI 2 "register_operand" " vr, 0, vr"))
3245 (match_operand:<VM> 3 "register_operand" " vm, vm, vm")
3247 [(match_operand 4 "vector_length_operand" " rK, rK, rK")
3248 (match_operand 5 "const_int_operand" " i, i, i")
3250 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)] UNSPEC_VMSBC))]
3252 "vmsbc.vvm\t%0,%1,%2,%3"
3253 [(set_attr "type" "vicalu")
3254 (set_attr "mode" "<MODE>")
3255 (set_attr "vl_op_idx" "4")
3256 (set (attr "avl_type_idx") (const_int 5))])
3258 (define_insn "@pred_madc<mode>_scalar"
3259 [(set (match_operand:<VM> 0 "register_operand" "=vr, &vr")
3262 (vec_duplicate:VI_QHS
3263 (match_operand:<VEL> 2 "register_operand" " r, r"))
3264 (match_operand:VI_QHS 1 "register_operand" " 0, vr"))
3265 (match_operand:<VM> 3 "register_operand" " vm, vm")
3267 [(match_operand 4 "vector_length_operand" " rK, rK")
3268 (match_operand 5 "const_int_operand" " i, i")
3270 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)] UNSPEC_VMADC))]
3272 "vmadc.vxm\t%0,%1,%2,%3"
3273 [(set_attr "type" "vicalu")
3274 (set_attr "mode" "<MODE>")
3275 (set_attr "vl_op_idx" "4")
3276 (set (attr "avl_type_idx") (const_int 5))])
3278 (define_insn "@pred_msbc<mode>_scalar"
3279 [(set (match_operand:<VM> 0 "register_operand" "=vr, &vr")
3282 (vec_duplicate:VI_QHS
3283 (match_operand:<VEL> 2 "reg_or_0_operand" " rJ, rJ"))
3284 (match_operand:VI_QHS 1 "register_operand" " 0, vr"))
3285 (match_operand:<VM> 3 "register_operand" " vm, vm")
3287 [(match_operand 4 "vector_length_operand" " rK, rK")
3288 (match_operand 5 "const_int_operand" " i, i")
3290 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)] UNSPEC_VMSBC))]
3292 "vmsbc.vxm\t%0,%1,%z2,%3"
3293 [(set_attr "type" "vicalu")
3294 (set_attr "mode" "<MODE>")
3295 (set_attr "vl_op_idx" "4")
3296 (set (attr "avl_type_idx") (const_int 5))])
3298 (define_expand "@pred_madc<mode>_scalar"
3299 [(set (match_operand:<VM> 0 "register_operand")
3303 (match_operand:<VEL> 2 "reg_or_int_operand"))
3304 (match_operand:VI_D 1 "register_operand"))
3305 (match_operand:<VM> 3 "register_operand")
3307 [(match_operand 4 "vector_length_operand")
3308 (match_operand 5 "const_int_operand")
3310 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)] UNSPEC_VMADC))]
3313 if (riscv_vector::sew64_scalar_helper (
3315 /* scalar op */&operands[2],
3316 /* vl */operands[4],
3318 riscv_vector::simm5_p (operands[2]),
3319 [] (rtx *operands, rtx boardcast_scalar) {
3320 emit_insn (gen_pred_madc<mode> (operands[0], operands[1],
3321 boardcast_scalar, operands[3], operands[4], operands[5]));
3323 (riscv_vector::avl_type) INTVAL (operands[5])))
3327 (define_insn "*pred_madc<mode>_scalar"
3328 [(set (match_operand:<VM> 0 "register_operand" "=vr, &vr")
3332 (match_operand:<VEL> 2 "reg_or_0_operand" " rJ, rJ"))
3333 (match_operand:VI_D 1 "register_operand" " 0, vr"))
3334 (match_operand:<VM> 3 "register_operand" " vm, vm")
3336 [(match_operand 4 "vector_length_operand" " rK, rK")
3337 (match_operand 5 "const_int_operand" " i, i")
3339 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)] UNSPEC_VMADC))]
3341 "vmadc.vxm\t%0,%1,%z2,%3"
3342 [(set_attr "type" "vicalu")
3343 (set_attr "mode" "<MODE>")
3344 (set_attr "vl_op_idx" "4")
3345 (set (attr "avl_type_idx") (const_int 5))])
3347 (define_insn "*pred_madc<mode>_extended_scalar"
3348 [(set (match_operand:<VM> 0 "register_operand" "=vr, &vr")
3353 (match_operand:<VSUBEL> 2 "reg_or_0_operand" " rJ, rJ")))
3354 (match_operand:VI_D 1 "register_operand" " 0, vr"))
3355 (match_operand:<VM> 3 "register_operand" " vm, vm")
3357 [(match_operand 4 "vector_length_operand" " rK, rK")
3358 (match_operand 5 "const_int_operand" " i, i")
3360 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)] UNSPEC_VMADC))]
3361 "TARGET_VECTOR && !TARGET_64BIT"
3362 "vmadc.vxm\t%0,%1,%z2,%3"
3363 [(set_attr "type" "vicalu")
3364 (set_attr "mode" "<MODE>")
3365 (set_attr "vl_op_idx" "4")
3366 (set (attr "avl_type_idx") (const_int 5))])
3368 (define_expand "@pred_msbc<mode>_scalar"
3369 [(set (match_operand:<VM> 0 "register_operand")
3373 (match_operand:<VEL> 2 "reg_or_int_operand"))
3374 (match_operand:VI_D 1 "register_operand"))
3375 (match_operand:<VM> 3 "register_operand")
3377 [(match_operand 4 "vector_length_operand")
3378 (match_operand 5 "const_int_operand")
3380 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)] UNSPEC_VMSBC))]
3383 if (riscv_vector::sew64_scalar_helper (
3385 /* scalar op */&operands[2],
3386 /* vl */operands[4],
3389 [] (rtx *operands, rtx boardcast_scalar) {
3390 emit_insn (gen_pred_msbc<mode> (operands[0], operands[1],
3391 boardcast_scalar, operands[3], operands[4], operands[5]));
3393 (riscv_vector::avl_type) INTVAL (operands[5])))
3397 (define_insn "*pred_msbc<mode>_scalar"
3398 [(set (match_operand:<VM> 0 "register_operand" "=vr, &vr")
3402 (match_operand:<VEL> 2 "reg_or_0_operand" " rJ, rJ"))
3403 (match_operand:VI_D 1 "register_operand" " 0, vr"))
3404 (match_operand:<VM> 3 "register_operand" " vm, vm")
3406 [(match_operand 4 "vector_length_operand" " rK, rK")
3407 (match_operand 5 "const_int_operand" " i, i")
3409 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)] UNSPEC_VMSBC))]
3411 "vmsbc.vxm\t%0,%1,%z2,%3"
3412 [(set_attr "type" "vicalu")
3413 (set_attr "mode" "<MODE>")
3414 (set_attr "vl_op_idx" "4")
3415 (set (attr "avl_type_idx") (const_int 5))])
3417 (define_insn "*pred_msbc<mode>_extended_scalar"
3418 [(set (match_operand:<VM> 0 "register_operand" "=vr, &vr")
3423 (match_operand:<VSUBEL> 2 "reg_or_0_operand" " rJ, rJ")))
3424 (match_operand:VI_D 1 "register_operand" " 0, vr"))
3425 (match_operand:<VM> 3 "register_operand" " vm, vm")
3427 [(match_operand 4 "vector_length_operand" " rK, rK")
3428 (match_operand 5 "const_int_operand" " i, i")
3430 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)] UNSPEC_VMSBC))]
3431 "TARGET_VECTOR && !TARGET_64BIT"
3432 "vmsbc.vxm\t%0,%1,%z2,%3"
3433 [(set_attr "type" "vicalu")
3434 (set_attr "mode" "<MODE>")
3435 (set_attr "vl_op_idx" "4")
3436 (set (attr "avl_type_idx") (const_int 5))])
3438 (define_insn "@pred_madc<mode>_overflow"
3439 [(set (match_operand:<VM> 0 "register_operand" "=vr, &vr, &vr")
3442 (match_operand:VI 1 "register_operand" " %0, vr, vr")
3443 (match_operand:VI 2 "vector_arith_operand" "vrvi, vr, vi"))
3445 [(match_operand 3 "vector_length_operand" " rK, rK, rK")
3446 (match_operand 4 "const_int_operand" " i, i, i")
3448 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)] UNSPEC_OVERFLOW))]
3450 "vmadc.v%o2\t%0,%1,%v2"
3451 [(set_attr "type" "vicalu")
3452 (set_attr "mode" "<MODE>")
3453 (set_attr "vl_op_idx" "3")
3454 (set (attr "avl_type_idx") (const_int 4))])
3456 (define_insn "@pred_msbc<mode>_overflow"
3457 [(set (match_operand:<VM> 0 "register_operand" "=vr, vr, &vr, &vr")
3460 (match_operand:VI 1 "register_operand" " 0, vr, vr, vr")
3461 (match_operand:VI 2 "register_operand" " vr, 0, vr, vi"))
3463 [(match_operand 3 "vector_length_operand" " rK, rK, rK, rK")
3464 (match_operand 4 "const_int_operand" " i, i, i, i")
3466 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)] UNSPEC_OVERFLOW))]
3468 "vmsbc.vv\t%0,%1,%2"
3469 [(set_attr "type" "vicalu")
3470 (set_attr "mode" "<MODE>")
3471 (set_attr "vl_op_idx" "3")
3472 (set (attr "avl_type_idx") (const_int 4))])
3474 (define_insn "@pred_madc<mode>_overflow_scalar"
3475 [(set (match_operand:<VM> 0 "register_operand" "=vr, &vr")
3478 (vec_duplicate:VI_QHS
3479 (match_operand:<VEL> 2 "reg_or_0_operand" " rJ, rJ"))
3480 (match_operand:VI_QHS 1 "register_operand" " 0, vr"))
3482 [(match_operand 3 "vector_length_operand" " rK, rK")
3483 (match_operand 4 "const_int_operand" " i, i")
3485 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)] UNSPEC_OVERFLOW))]
3487 "vmadc.vx\t%0,%1,%z2"
3488 [(set_attr "type" "vicalu")
3489 (set_attr "mode" "<MODE>")
3490 (set_attr "vl_op_idx" "3")
3491 (set (attr "avl_type_idx") (const_int 4))])
3493 (define_insn "@pred_msbc<mode>_overflow_scalar"
3494 [(set (match_operand:<VM> 0 "register_operand" "=vr, &vr")
3497 (vec_duplicate:VI_QHS
3498 (match_operand:<VEL> 2 "reg_or_0_operand" " rJ, rJ"))
3499 (match_operand:VI_QHS 1 "register_operand" " 0, vr"))
3501 [(match_operand 3 "vector_length_operand" " rK, rK")
3502 (match_operand 4 "const_int_operand" " i, i")
3504 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)] UNSPEC_OVERFLOW))]
3506 "vmsbc.vx\t%0,%1,%z2"
3507 [(set_attr "type" "vicalu")
3508 (set_attr "mode" "<MODE>")
3509 (set_attr "vl_op_idx" "3")
3510 (set (attr "avl_type_idx") (const_int 4))])
3512 (define_expand "@pred_madc<mode>_overflow_scalar"
3513 [(set (match_operand:<VM> 0 "register_operand")
3517 (match_operand:<VEL> 2 "reg_or_int_operand"))
3518 (match_operand:VI_D 1 "register_operand"))
3520 [(match_operand 3 "vector_length_operand")
3521 (match_operand 4 "const_int_operand")
3523 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)] UNSPEC_OVERFLOW))]
3526 if (riscv_vector::sew64_scalar_helper (
3528 /* scalar op */&operands[2],
3529 /* vl */operands[3],
3531 riscv_vector::simm5_p (operands[2]),
3532 [] (rtx *operands, rtx boardcast_scalar) {
3533 emit_insn (gen_pred_madc<mode>_overflow (operands[0], operands[1],
3534 boardcast_scalar, operands[3], operands[4]));
3536 (riscv_vector::avl_type) INTVAL (operands[4])))
3540 (define_insn "*pred_madc<mode>_overflow_scalar"
3541 [(set (match_operand:<VM> 0 "register_operand" "=vr, &vr")
3545 (match_operand:<VEL> 2 "reg_or_0_operand" " rJ, rJ"))
3546 (match_operand:VI_D 1 "register_operand" " 0, vr"))
3548 [(match_operand 3 "vector_length_operand" " rK, rK")
3549 (match_operand 4 "const_int_operand" " i, i")
3551 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)] UNSPEC_OVERFLOW))]
3553 "vmadc.vx\t%0,%1,%z2"
3554 [(set_attr "type" "vicalu")
3555 (set_attr "mode" "<MODE>")
3556 (set_attr "vl_op_idx" "3")
3557 (set (attr "avl_type_idx") (const_int 4))])
3559 (define_insn "*pred_madc<mode>_overflow_extended_scalar"
3560 [(set (match_operand:<VM> 0 "register_operand" "=vr, &vr")
3565 (match_operand:<VSUBEL> 2 "reg_or_0_operand" " rJ, rJ")))
3566 (match_operand:VI_D 1 "register_operand" " 0, vr"))
3568 [(match_operand 3 "vector_length_operand" " rK, rK")
3569 (match_operand 4 "const_int_operand" " i, i")
3571 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)] UNSPEC_OVERFLOW))]
3572 "TARGET_VECTOR && !TARGET_64BIT"
3573 "vmadc.vx\t%0,%1,%z2"
3574 [(set_attr "type" "vicalu")
3575 (set_attr "mode" "<MODE>")
3576 (set_attr "vl_op_idx" "3")
3577 (set (attr "avl_type_idx") (const_int 4))])
3579 (define_expand "@pred_msbc<mode>_overflow_scalar"
3580 [(set (match_operand:<VM> 0 "register_operand")
3584 (match_operand:<VEL> 2 "reg_or_int_operand"))
3585 (match_operand:VI_D 1 "register_operand"))
3587 [(match_operand 3 "vector_length_operand")
3588 (match_operand 4 "const_int_operand")
3590 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)] UNSPEC_OVERFLOW))]
3593 if (riscv_vector::sew64_scalar_helper (
3595 /* scalar op */&operands[2],
3596 /* vl */operands[3],
3599 [] (rtx *operands, rtx boardcast_scalar) {
3600 emit_insn (gen_pred_msbc<mode>_overflow (operands[0], operands[1],
3601 boardcast_scalar, operands[3], operands[4]));
3603 (riscv_vector::avl_type) INTVAL (operands[4])))
3607 (define_insn "*pred_msbc<mode>_overflow_scalar"
3608 [(set (match_operand:<VM> 0 "register_operand" "=vr, &vr")
3612 (match_operand:<VEL> 2 "reg_or_0_operand" " rJ, rJ"))
3613 (match_operand:VI_D 1 "register_operand" " 0, vr"))
3615 [(match_operand 3 "vector_length_operand" " rK, rK")
3616 (match_operand 4 "const_int_operand" " i, i")
3618 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)] UNSPEC_OVERFLOW))]
3620 "vmsbc.vx\t%0,%1,%z2"
3621 [(set_attr "type" "vicalu")
3622 (set_attr "mode" "<MODE>")
3623 (set_attr "vl_op_idx" "3")
3624 (set (attr "avl_type_idx") (const_int 4))])
3626 (define_insn "*pred_msbc<mode>_overflow_extended_scalar"
3627 [(set (match_operand:<VM> 0 "register_operand" "=vr, &vr")
3632 (match_operand:<VSUBEL> 2 "reg_or_0_operand" " rJ, rJ")))
3633 (match_operand:VI_D 1 "register_operand" " 0, vr"))
3635 [(match_operand 3 "vector_length_operand" " rK, rK")
3636 (match_operand 4 "const_int_operand" " i, i")
3638 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)] UNSPEC_OVERFLOW))]
3639 "TARGET_VECTOR && !TARGET_64BIT"
3640 "vmsbc.vx\t%0,%1,%z2"
3641 [(set_attr "type" "vicalu")
3642 (set_attr "mode" "<MODE>")
3643 (set_attr "vl_op_idx" "3")
3644 (set (attr "avl_type_idx") (const_int 4))])
3646 ;; -------------------------------------------------------------------------------
3647 ;; ---- Predicated integer unary operations
3648 ;; -------------------------------------------------------------------------------
3651 ;; -------------------------------------------------------------------------------
3653 (define_insn "@pred_<optab><mode>"
3654 [(set (match_operand:V_VLSI 0 "register_operand" "=vd,vd, vr, vr")
3655 (if_then_else:V_VLSI
3657 [(match_operand:<VM> 1 "vector_mask_operand" "vm,vm,Wc1,Wc1")
3658 (match_operand 4 "vector_length_operand" "rK,rK, rK, rK")
3659 (match_operand 5 "const_int_operand" " i, i, i, i")
3660 (match_operand 6 "const_int_operand" " i, i, i, i")
3661 (match_operand 7 "const_int_operand" " i, i, i, i")
3663 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
3664 (any_int_unop:V_VLSI
3665 (match_operand:V_VLSI 3 "register_operand" "vr,vr, vr, vr"))
3666 (match_operand:V_VLSI 2 "vector_merge_operand" "vu, 0, vu, 0")))]
3668 "v<insn>.v\t%0,%3%p1"
3669 [(set_attr "type" "vialu")
3670 (set_attr "mode" "<MODE>")
3671 (set_attr "vl_op_idx" "4")
3672 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[5])"))
3673 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[6])"))
3674 (set (attr "avl_type_idx") (const_int 7))])
3676 ;; -------------------------------------------------------------------------------
3677 ;; ---- Predicated integer widening binary operations
3678 ;; -------------------------------------------------------------------------------
3680 ;; - 11.2 Vector Widening Integer Add/Subtract
3681 ;; - 11.3 Vector Integer Extension
3682 ;; - 11.12 Vector Widening Integer Multiply Instructions
3683 ;; -------------------------------------------------------------------------------
3685 ;; Vector Double-Widening Sign-extend and Zero-extend.
3686 (define_insn "@pred_<optab><mode>_vf2"
3687 [(set (match_operand:VWEXTI 0 "register_operand" "=vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, ?&vr, ?&vr")
3688 (if_then_else:VWEXTI
3690 [(match_operand:<VM> 1 "vector_mask_operand" " vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1,vmWc1,vmWc1")
3691 (match_operand 4 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK")
3692 (match_operand 5 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
3693 (match_operand 6 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
3694 (match_operand 7 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
3696 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
3698 (match_operand:<V_DOUBLE_TRUNC> 3 "register_operand" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84, vr, vr"))
3699 (match_operand:VWEXTI 2 "vector_merge_operand" " vu, vu, 0, 0, vu, vu, 0, 0, vu, vu, 0, 0, vu, 0")))]
3701 "v<sz>ext.vf2\t%0,%3%p1"
3702 [(set_attr "type" "vext")
3703 (set_attr "mode" "<MODE>")
3704 (set_attr "group_overlap" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84,none,none")])
3706 ;; Vector Quad-Widening Sign-extend and Zero-extend.
3707 (define_insn "@pred_<optab><mode>_vf4"
3708 [(set (match_operand:VQEXTI 0 "register_operand" "=vd, vr, vd, vr, vd, vr, vd, vr, ?&vr, ?&vr")
3709 (if_then_else:VQEXTI
3711 [(match_operand:<VM> 1 "vector_mask_operand" " vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1,vmWc1,vmWc1")
3712 (match_operand 4 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK, rK, rK, rK")
3713 (match_operand 5 "const_int_operand" " i, i, i, i, i, i, i, i, i, i")
3714 (match_operand 6 "const_int_operand" " i, i, i, i, i, i, i, i, i, i")
3715 (match_operand 7 "const_int_operand" " i, i, i, i, i, i, i, i, i, i")
3717 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
3719 (match_operand:<V_QUAD_TRUNC> 3 "register_operand" "W43,W43,W43,W43,W86,W86,W86,W86, vr, vr"))
3720 (match_operand:VQEXTI 2 "vector_merge_operand" " vu, vu, 0, 0, vu, vu, 0, 0, vu, 0")))]
3722 "v<sz>ext.vf4\t%0,%3%p1"
3723 [(set_attr "type" "vext")
3724 (set_attr "mode" "<MODE>")
3725 (set_attr "group_overlap" "W43,W43,W43,W43,W86,W86,W86,W86,none,none")])
3727 ;; Vector Oct-Widening Sign-extend and Zero-extend.
3728 (define_insn "@pred_<optab><mode>_vf8"
3729 [(set (match_operand:VOEXTI 0 "register_operand" "=vd, vr, vd, vr, ?&vr, ?&vr")
3730 (if_then_else:VOEXTI
3732 [(match_operand:<VM> 1 "vector_mask_operand" " vm,Wc1, vm,Wc1,vmWc1,vmWc1")
3733 (match_operand 4 "vector_length_operand" " rK, rK, rK, rK, rK, rK")
3734 (match_operand 5 "const_int_operand" " i, i, i, i, i, i")
3735 (match_operand 6 "const_int_operand" " i, i, i, i, i, i")
3736 (match_operand 7 "const_int_operand" " i, i, i, i, i, i")
3738 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
3740 (match_operand:<V_OCT_TRUNC> 3 "register_operand" "W87,W87,W87,W87, vr, vr"))
3741 (match_operand:VOEXTI 2 "vector_merge_operand" " vu, vu, 0, 0, vu, 0")))]
3743 "v<sz>ext.vf8\t%0,%3%p1"
3744 [(set_attr "type" "vext")
3745 (set_attr "mode" "<MODE>")
3746 (set_attr "group_overlap" "W87,W87,W87,W87,none,none")])
3748 ;; Vector Widening Add/Subtract/Multiply.
3749 (define_insn "@pred_dual_widen_<any_widen_binop:optab><any_extend:su><mode>"
3750 [(set (match_operand:VWEXTI 0 "register_operand" "=&vr,&vr")
3751 (if_then_else:VWEXTI
3753 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
3754 (match_operand 5 "vector_length_operand" " rK, rK")
3755 (match_operand 6 "const_int_operand" " i, i")
3756 (match_operand 7 "const_int_operand" " i, i")
3757 (match_operand 8 "const_int_operand" " i, i")
3759 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
3760 (any_widen_binop:VWEXTI
3762 (match_operand:<V_DOUBLE_TRUNC> 3 "register_operand" " vr, vr"))
3764 (match_operand:<V_DOUBLE_TRUNC> 4 "register_operand" " vr, vr")))
3765 (match_operand:VWEXTI 2 "vector_merge_operand" " vu, 0")))]
3767 "vw<any_widen_binop:insn><any_extend:u>.vv\t%0,%3,%4%p1"
3768 [(set_attr "type" "vi<widen_binop_insn_type>")
3769 (set_attr "mode" "<V_DOUBLE_TRUNC>")])
3771 (define_insn "@pred_dual_widen_<any_widen_binop:optab><any_extend:su><mode>_scalar"
3772 [(set (match_operand:VWEXTI 0 "register_operand" "=vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, ?&vr, ?&vr")
3773 (if_then_else:VWEXTI
3775 [(match_operand:<VM> 1 "vector_mask_operand" " vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1,vmWc1,vmWc1")
3776 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK")
3777 (match_operand 6 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
3778 (match_operand 7 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
3779 (match_operand 8 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
3781 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
3782 (any_widen_binop:VWEXTI
3784 (match_operand:<V_DOUBLE_TRUNC> 3 "register_operand" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84, vr, vr"))
3786 (vec_duplicate:<V_DOUBLE_TRUNC>
3787 (match_operand:<VSUBEL> 4 "reg_or_0_operand" " rJ, rJ, rJ, rJ, rJ, rJ, rJ, rJ, rJ, rJ, rJ, rJ, rJ, rJ"))))
3788 (match_operand:VWEXTI 2 "vector_merge_operand" " vu, vu, 0, 0, vu, vu, 0, 0, vu, vu, 0, 0, vu, 0")))]
3790 "vw<any_widen_binop:insn><any_extend:u>.vx\t%0,%3,%z4%p1"
3791 [(set_attr "type" "vi<widen_binop_insn_type>")
3792 (set_attr "mode" "<V_DOUBLE_TRUNC>")
3793 (set_attr "group_overlap" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84,none,none")])
3795 (define_insn "@pred_single_widen_sub<any_extend:su><mode>"
3796 [(set (match_operand:VWEXTI 0 "register_operand" "=vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, &vr, &vr, ?&vr, ?&vr")
3797 (if_then_else:VWEXTI
3799 [(match_operand:<VM> 1 "vector_mask_operand" " vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1,vmWc1,vmWc1,vmWc1,vmWc1")
3800 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK")
3801 (match_operand 6 "const_int_operand" " i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i")
3802 (match_operand 7 "const_int_operand" " i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i")
3803 (match_operand 8 "const_int_operand" " i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i")
3805 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
3807 (match_operand:VWEXTI 3 "register_operand" " vr, vr, vr, vr, vr, vr, vr, vr, vr, vr, vr, vr, 0, 0, vr, vr")
3809 (match_operand:<V_DOUBLE_TRUNC> 4 "register_operand" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84, vr, vr, vr, vr")))
3810 (match_operand:VWEXTI 2 "vector_merge_operand" " vu, vu, 0, 0, vu, vu, 0, 0, vu, vu, 0, 0, vu, 0, vu, 0")))]
3812 "vwsub<any_extend:u>.wv\t%0,%3,%4%p1"
3813 [(set_attr "type" "viwalu")
3814 (set_attr "mode" "<V_DOUBLE_TRUNC>")
3815 (set_attr "group_overlap" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84,W0,W0,none,none")])
3817 (define_insn "@pred_single_widen_add<any_extend:su><mode>"
3818 [(set (match_operand:VWEXTI 0 "register_operand" "=vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, &vr, &vr, ?&vr, ?&vr")
3819 (if_then_else:VWEXTI
3821 [(match_operand:<VM> 1 "vector_mask_operand" " vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1,vmWc1,vmWc1,vmWc1,vmWc1")
3822 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK")
3823 (match_operand 6 "const_int_operand" " i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i")
3824 (match_operand 7 "const_int_operand" " i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i")
3825 (match_operand 8 "const_int_operand" " i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i")
3827 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
3830 (match_operand:<V_DOUBLE_TRUNC> 4 "register_operand" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84, vr, vr, vr, vr"))
3831 (match_operand:VWEXTI 3 "register_operand" " vr, vr, vr, vr, vr, vr, vr, vr, vr, vr, vr, vr, 0, 0, vr, vr"))
3832 (match_operand:VWEXTI 2 "vector_merge_operand" " vu, vu, 0, 0, vu, vu, 0, 0, vu, vu, 0, 0, vu, 0, vu, 0")))]
3834 "vwadd<any_extend:u>.wv\t%0,%3,%4%p1"
3835 [(set_attr "type" "viwalu")
3836 (set_attr "mode" "<V_DOUBLE_TRUNC>")
3837 (set_attr "group_overlap" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84,W0,W0,none,none")])
3839 (define_insn "@pred_single_widen_<plus_minus:optab><any_extend:su><mode>_scalar"
3840 [(set (match_operand:VWEXTI 0 "register_operand" "=vr, vr")
3841 (if_then_else:VWEXTI
3843 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
3844 (match_operand 5 "vector_length_operand" " rK, rK")
3845 (match_operand 6 "const_int_operand" " i, i")
3846 (match_operand 7 "const_int_operand" " i, i")
3847 (match_operand 8 "const_int_operand" " i, i")
3849 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
3851 (match_operand:VWEXTI 3 "register_operand" " vr, vr")
3853 (vec_duplicate:<V_DOUBLE_TRUNC>
3854 (match_operand:<VSUBEL> 4 "reg_or_0_operand" " rJ, rJ"))))
3855 (match_operand:VWEXTI 2 "vector_merge_operand" " vu, 0")))]
3857 "vw<plus_minus:insn><any_extend:u>.wx\t%0,%3,%z4%p1"
3858 [(set_attr "type" "vi<widen_binop_insn_type>")
3859 (set_attr "mode" "<V_DOUBLE_TRUNC>")])
3861 (define_insn "@pred_widen_mulsu<mode>"
3862 [(set (match_operand:VWEXTI 0 "register_operand" "=&vr,&vr")
3863 (if_then_else:VWEXTI
3865 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
3866 (match_operand 5 "vector_length_operand" " rK, rK")
3867 (match_operand 6 "const_int_operand" " i, i")
3868 (match_operand 7 "const_int_operand" " i, i")
3869 (match_operand 8 "const_int_operand" " i, i")
3871 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
3874 (match_operand:<V_DOUBLE_TRUNC> 3 "register_operand" " vr, vr"))
3876 (match_operand:<V_DOUBLE_TRUNC> 4 "register_operand" " vr, vr")))
3877 (match_operand:VWEXTI 2 "vector_merge_operand" " vu, 0")))]
3879 "vwmulsu.vv\t%0,%3,%4%p1"
3880 [(set_attr "type" "viwmul")
3881 (set_attr "mode" "<V_DOUBLE_TRUNC>")])
3883 (define_insn "@pred_widen_mulsu<mode>_scalar"
3884 [(set (match_operand:VWEXTI 0 "register_operand" "=vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, ?&vr, ?&vr")
3885 (if_then_else:VWEXTI
3887 [(match_operand:<VM> 1 "vector_mask_operand" " vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1,vmWc1,vmWc1")
3888 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK")
3889 (match_operand 6 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
3890 (match_operand 7 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
3891 (match_operand 8 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
3893 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
3896 (match_operand:<V_DOUBLE_TRUNC> 3 "register_operand" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84, vr, vr"))
3898 (vec_duplicate:<V_DOUBLE_TRUNC>
3899 (match_operand:<VSUBEL> 4 "reg_or_0_operand" " rJ, rJ, rJ, rJ, rJ, rJ, rJ, rJ, rJ, rJ, rJ, rJ, rJ, rJ"))))
3900 (match_operand:VWEXTI 2 "vector_merge_operand" " vu, vu, 0, 0, vu, vu, 0, 0, vu, vu, 0, 0, vu, 0")))]
3902 "vwmulsu.vx\t%0,%3,%z4%p1"
3903 [(set_attr "type" "viwmul")
3904 (set_attr "mode" "<V_DOUBLE_TRUNC>")
3905 (set_attr "group_overlap" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84,none,none")])
3908 (define_insn "@pred_<optab><mode>"
3909 [(set (match_operand:VWEXTI 0 "register_operand" "=vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, ?&vr, ?&vr")
3910 (if_then_else:VWEXTI
3912 [(match_operand:<VM> 1 "vector_mask_operand" " vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1,vmWc1,vmWc1")
3913 (match_operand 4 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK")
3914 (match_operand 5 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
3915 (match_operand 6 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
3916 (match_operand 7 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
3918 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
3921 (match_operand:<V_DOUBLE_TRUNC> 3 "register_operand" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84, vr, vr"))
3922 (vec_duplicate:VWEXTI
3923 (reg:<VEL> X0_REGNUM)))
3924 (match_operand:VWEXTI 2 "vector_merge_operand" " vu, vu, 0, 0, vu, vu, 0, 0, vu, vu, 0, 0, vu, 0")))]
3926 "vwcvt<u>.x.x.v\t%0,%3%p1"
3927 [(set_attr "type" "viwalu")
3928 (set_attr "mode" "<V_DOUBLE_TRUNC>")
3929 (set_attr "vl_op_idx" "4")
3930 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[5])"))
3931 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[6])"))
3932 (set (attr "avl_type_idx") (const_int 7))
3933 (set_attr "group_overlap" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84,none,none")])
3935 ;; -------------------------------------------------------------------------------
3936 ;; ---- Predicated integer Narrowing operations
3937 ;; -------------------------------------------------------------------------------
3939 ;; - 11.7 Vector Narrowing Integer Right Shift Instructions
3940 ;; -------------------------------------------------------------------------------
3942 ;; The destination EEW is smaller than the source EEW and the overlap is in the
3943 ;; lowest-numbered part of the source register group
3944 ;; e.g, when LMUL = 1, vnsrl.wi v0,v0,3 is legal but a destination of v1 is not.
3945 (define_insn "@pred_narrow_<optab><mode>"
3946 [(set (match_operand:<V_DOUBLE_TRUNC> 0 "register_operand" "=vd,vd, vr, vr,vd, vr, &vr, &vr, vd, vr, &vr, &vr")
3947 (if_then_else:<V_DOUBLE_TRUNC>
3949 [(match_operand:<VM> 1 "vector_mask_operand" " vm,vm,Wc1,Wc1,vm,Wc1,vmWc1,vmWc1, vm,Wc1,vmWc1,vmWc1")
3950 (match_operand 5 "vector_length_operand" " rK,rK, rK, rK,rK, rK, rK, rK, rK, rK, rK, rK")
3951 (match_operand 6 "const_int_operand" " i, i, i, i, i, i, i, i, i, i, i, i")
3952 (match_operand 7 "const_int_operand" " i, i, i, i, i, i, i, i, i, i, i, i")
3953 (match_operand 8 "const_int_operand" " i, i, i, i, i, i, i, i, i, i, i, i")
3955 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
3956 (truncate:<V_DOUBLE_TRUNC>
3958 (match_operand:VWEXTI 3 "register_operand" " vr,vr, vr, vr, 0, 0, vr, vr, 0, 0, vr, vr")
3959 (match_operand:<V_DOUBLE_TRUNC> 4 "vector_shift_operand" " 0, 0, 0, 0,vr, vr, vr, vr, vk, vk, vk, vk")))
3960 (match_operand:<V_DOUBLE_TRUNC> 2 "vector_merge_operand" " 0,vu, 0, vu,vu, vu, vu, 0, vu, vu, vu, 0")))]
3962 "vn<insn>.w%o4\t%0,%3,%v4%p1"
3963 [(set_attr "type" "vnshift")
3964 (set_attr "mode" "<V_DOUBLE_TRUNC>")])
3966 (define_insn "@pred_narrow_<optab><mode>_scalar"
3967 [(set (match_operand:<V_DOUBLE_TRUNC> 0 "register_operand" "=vd, vd, vr, vr, &vr, &vr")
3968 (if_then_else:<V_DOUBLE_TRUNC>
3970 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1,vmWc1,vmWc1")
3971 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK, rK, rK")
3972 (match_operand 6 "const_int_operand" " i, i, i, i, i, i")
3973 (match_operand 7 "const_int_operand" " i, i, i, i, i, i")
3974 (match_operand 8 "const_int_operand" " i, i, i, i, i, i")
3976 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
3977 (truncate:<V_DOUBLE_TRUNC>
3979 (match_operand:VWEXTI 3 "register_operand" " 0, 0, 0, 0, vr, vr")
3980 (match_operand 4 "pmode_reg_or_uimm5_operand" " rK, rK, rK, rK, rK, rK")))
3981 (match_operand:<V_DOUBLE_TRUNC> 2 "vector_merge_operand" " vu, 0, vu, 0, vu, 0")))]
3983 "vn<insn>.w%o4\t%0,%3,%4%p1"
3984 [(set_attr "type" "vnshift")
3985 (set_attr "mode" "<V_DOUBLE_TRUNC>")])
3988 (define_insn "@pred_trunc<mode>"
3989 [(set (match_operand:<V_DOUBLE_TRUNC> 0 "register_operand" "=vd, vd, vr, vr, &vr, &vr")
3990 (if_then_else:<V_DOUBLE_TRUNC>
3992 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1,vmWc1,vmWc1")
3993 (match_operand 4 "vector_length_operand" " rK, rK, rK, rK, rK, rK")
3994 (match_operand 5 "const_int_operand" " i, i, i, i, i, i")
3995 (match_operand 6 "const_int_operand" " i, i, i, i, i, i")
3996 (match_operand 7 "const_int_operand" " i, i, i, i, i, i")
3998 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
3999 (truncate:<V_DOUBLE_TRUNC>
4000 (match_operand:VWEXTI 3 "register_operand" " 0, 0, 0, 0, vr, vr"))
4001 (match_operand:<V_DOUBLE_TRUNC> 2 "vector_merge_operand" " vu, 0, vu, 0, vu, 0")))]
4003 "vncvt.x.x.w\t%0,%3%p1"
4004 [(set_attr "type" "vnshift")
4005 (set_attr "mode" "<V_DOUBLE_TRUNC>")
4006 (set_attr "vl_op_idx" "4")
4007 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[5])"))
4008 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[6])"))
4009 (set (attr "avl_type_idx") (const_int 7))])
4011 ;; -------------------------------------------------------------------------------
4012 ;; ---- Predicated fixed-point operations
4013 ;; -------------------------------------------------------------------------------
4015 ;; - 12.1 Vector Single-Width Saturating Add and Subtract
4016 ;; - 12.2 Vector Single-Width Aaveraging Add and Subtract
4017 ;; - 12.3 Vector Single-Width Fractional Multiply with Rounding and Saturation
4018 ;; - 12.4 Vector Single-Width Scaling Shift Instructions
4019 ;; - 12.5 Vector Narrowing Fixed-Point Clip Instructions
4020 ;; -------------------------------------------------------------------------------
4022 ;; Saturating Add and Subtract
4023 (define_insn "@pred_<optab><mode>"
4024 [(set (match_operand:VI 0 "register_operand" "=vd, vd, vr, vr, vd, vd, vr, vr")
4027 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1, vm, vm,Wc1,Wc1")
4028 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK, rK")
4029 (match_operand 6 "const_int_operand" " i, i, i, i, i, i, i, i")
4030 (match_operand 7 "const_int_operand" " i, i, i, i, i, i, i, i")
4031 (match_operand 8 "const_int_operand" " i, i, i, i, i, i, i, i")
4033 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4034 (any_sat_int_binop:VI
4035 (match_operand:VI 3 "<binop_rhs1_predicate>" " vr, vr, vr, vr, vr, vr, vr, vr")
4036 (match_operand:VI 4 "<binop_rhs2_predicate>" "<binop_rhs2_constraint>"))
4037 (match_operand:VI 2 "vector_merge_operand" " vu, 0, vu, 0, vu, 0, vu, 0")))]
4040 v<insn>.vv\t%0,%3,%4%p1
4041 v<insn>.vv\t%0,%3,%4%p1
4042 v<insn>.vv\t%0,%3,%4%p1
4043 v<insn>.vv\t%0,%3,%4%p1
4044 v<binop_vi_variant_insn>\t%0,<binop_vi_variant_op>%p1
4045 v<binop_vi_variant_insn>\t%0,<binop_vi_variant_op>%p1
4046 v<binop_vi_variant_insn>\t%0,<binop_vi_variant_op>%p1
4047 v<binop_vi_variant_insn>\t%0,<binop_vi_variant_op>%p1"
4048 [(set_attr "type" "<int_binop_insn_type>")
4049 (set_attr "mode" "<MODE>")])
4051 ;; Handle GET_MODE_INNER (mode) = QImode, HImode, SImode.
4052 (define_insn "@pred_<optab><mode>_scalar"
4053 [(set (match_operand:VI_QHS 0 "register_operand" "=vd, vd, vr, vr")
4054 (if_then_else:VI_QHS
4056 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
4057 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
4058 (match_operand 6 "const_int_operand" " i, i, i, i")
4059 (match_operand 7 "const_int_operand" " i, i, i, i")
4060 (match_operand 8 "const_int_operand" " i, i, i, i")
4062 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4063 (sat_int_plus_binop:VI_QHS
4064 (vec_duplicate:VI_QHS
4065 (match_operand:<VEL> 4 "register_operand" " r, r, r, r"))
4066 (match_operand:VI_QHS 3 "register_operand" " vr, vr, vr, vr"))
4067 (match_operand:VI_QHS 2 "vector_merge_operand" " vu, 0, vu, 0")))]
4069 "v<insn>.vx\t%0,%3,%4%p1"
4070 [(set_attr "type" "<int_binop_insn_type>")
4071 (set_attr "mode" "<MODE>")])
4073 (define_insn "@pred_<optab><mode>_scalar"
4074 [(set (match_operand:VI_QHS 0 "register_operand" "=vd, vd, vr, vr")
4075 (if_then_else:VI_QHS
4077 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
4078 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
4079 (match_operand 6 "const_int_operand" " i, i, i, i")
4080 (match_operand 7 "const_int_operand" " i, i, i, i")
4081 (match_operand 8 "const_int_operand" " i, i, i, i")
4083 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4084 (sat_int_minus_binop:VI_QHS
4085 (match_operand:VI_QHS 3 "register_operand" " vr, vr, vr, vr")
4086 (vec_duplicate:VI_QHS
4087 (match_operand:<VEL> 4 "register_operand" " r, r, r, r")))
4088 (match_operand:VI_QHS 2 "vector_merge_operand" " vu, 0, vu, 0")))]
4090 "v<insn>.vx\t%0,%3,%4%p1"
4091 [(set_attr "type" "<int_binop_insn_type>")
4092 (set_attr "mode" "<MODE>")])
4094 (define_expand "@pred_<optab><mode>_scalar"
4095 [(set (match_operand:VI_D 0 "register_operand")
4098 [(match_operand:<VM> 1 "vector_mask_operand")
4099 (match_operand 5 "vector_length_operand")
4100 (match_operand 6 "const_int_operand")
4101 (match_operand 7 "const_int_operand")
4102 (match_operand 8 "const_int_operand")
4104 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4105 (sat_int_plus_binop:VI_D
4107 (match_operand:<VEL> 4 "reg_or_int_operand"))
4108 (match_operand:VI_D 3 "register_operand"))
4109 (match_operand:VI_D 2 "vector_merge_operand")))]
4112 if (riscv_vector::sew64_scalar_helper (
4114 /* scalar op */&operands[4],
4115 /* vl */operands[5],
4117 riscv_vector::has_vi_variant_p (<CODE>, operands[4]),
4118 [] (rtx *operands, rtx boardcast_scalar) {
4119 emit_insn (gen_pred_<optab><mode> (operands[0], operands[1],
4120 operands[2], operands[3], boardcast_scalar, operands[5],
4121 operands[6], operands[7], operands[8]));
4123 (riscv_vector::avl_type) INTVAL (operands[8])))
4127 (define_insn "*pred_<optab><mode>_scalar"
4128 [(set (match_operand:VI_D 0 "register_operand" "=vd, vd, vr, vr")
4131 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
4132 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
4133 (match_operand 6 "const_int_operand" " i, i, i, i")
4134 (match_operand 7 "const_int_operand" " i, i, i, i")
4135 (match_operand 8 "const_int_operand" " i, i, i, i")
4137 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4138 (sat_int_plus_binop:VI_D
4140 (match_operand:<VEL> 4 "register_operand" " r, r, r, r"))
4141 (match_operand:VI_D 3 "register_operand" " vr, vr, vr, vr"))
4142 (match_operand:VI_D 2 "vector_merge_operand" " vu, 0, vu, 0")))]
4144 "v<insn>.vx\t%0,%3,%4%p1"
4145 [(set_attr "type" "<int_binop_insn_type>")
4146 (set_attr "mode" "<MODE>")])
4148 (define_insn "*pred_<optab><mode>_extended_scalar"
4149 [(set (match_operand:VI_D 0 "register_operand" "=vd, vd, vr, vr")
4152 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
4153 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
4154 (match_operand 6 "const_int_operand" " i, i, i, i")
4155 (match_operand 7 "const_int_operand" " i, i, i, i")
4156 (match_operand 8 "const_int_operand" " i, i, i, i")
4158 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4159 (sat_int_plus_binop:VI_D
4162 (match_operand:<VSUBEL> 4 "register_operand" " r, r, r, r")))
4163 (match_operand:VI_D 3 "register_operand" " vr, vr, vr, vr"))
4164 (match_operand:VI_D 2 "vector_merge_operand" " vu, 0, vu, 0")))]
4165 "TARGET_VECTOR && !TARGET_64BIT"
4166 "v<insn>.vx\t%0,%3,%4%p1"
4167 [(set_attr "type" "<int_binop_insn_type>")
4168 (set_attr "mode" "<MODE>")])
4170 (define_expand "@pred_<optab><mode>_scalar"
4171 [(set (match_operand:VI_D 0 "register_operand")
4174 [(match_operand:<VM> 1 "vector_mask_operand")
4175 (match_operand 5 "vector_length_operand")
4176 (match_operand 6 "const_int_operand")
4177 (match_operand 7 "const_int_operand")
4178 (match_operand 8 "const_int_operand")
4180 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4181 (sat_int_minus_binop:VI_D
4182 (match_operand:VI_D 3 "register_operand")
4184 (match_operand:<VEL> 4 "reg_or_int_operand")))
4185 (match_operand:VI_D 2 "vector_merge_operand")))]
4188 if (riscv_vector::sew64_scalar_helper (
4190 /* scalar op */&operands[4],
4191 /* vl */operands[5],
4193 riscv_vector::has_vi_variant_p (<CODE>, operands[4]),
4194 [] (rtx *operands, rtx boardcast_scalar) {
4195 emit_insn (gen_pred_<optab><mode> (operands[0], operands[1],
4196 operands[2], operands[3], boardcast_scalar, operands[5],
4197 operands[6], operands[7], operands[8]));
4199 (riscv_vector::avl_type) INTVAL (operands[8])))
4203 (define_insn "*pred_<optab><mode>_scalar"
4204 [(set (match_operand:VI_D 0 "register_operand" "=vd, vd, vr, vr")
4207 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
4208 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
4209 (match_operand 6 "const_int_operand" " i, i, i, i")
4210 (match_operand 7 "const_int_operand" " i, i, i, i")
4211 (match_operand 8 "const_int_operand" " i, i, i, i")
4213 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4214 (sat_int_minus_binop:VI_D
4215 (match_operand:VI_D 3 "register_operand" " vr, vr, vr, vr")
4217 (match_operand:<VEL> 4 "register_operand" " r, r, r, r")))
4218 (match_operand:VI_D 2 "vector_merge_operand" " vu, 0, vu, 0")))]
4220 "v<insn>.vx\t%0,%3,%4%p1"
4221 [(set_attr "type" "<int_binop_insn_type>")
4222 (set_attr "mode" "<MODE>")])
4224 (define_insn "*pred_<optab><mode>_extended_scalar"
4225 [(set (match_operand:VI_D 0 "register_operand" "=vd, vd, vr, vr")
4228 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
4229 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
4230 (match_operand 6 "const_int_operand" " i, i, i, i")
4231 (match_operand 7 "const_int_operand" " i, i, i, i")
4232 (match_operand 8 "const_int_operand" " i, i, i, i")
4234 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4235 (sat_int_minus_binop:VI_D
4236 (match_operand:VI_D 3 "register_operand" " vr, vr, vr, vr")
4239 (match_operand:<VSUBEL> 4 "register_operand" " r, r, r, r"))))
4240 (match_operand:VI_D 2 "vector_merge_operand" " vu, 0, vu, 0")))]
4241 "TARGET_VECTOR && !TARGET_64BIT"
4242 "v<insn>.vx\t%0,%3,%4%p1"
4243 [(set_attr "type" "<int_binop_insn_type>")
4244 (set_attr "mode" "<MODE>")])
4246 (define_insn "@pred_<sat_op><mode>"
4247 [(set (match_operand:VI 0 "register_operand" "=vd, vd, vr, vr")
4250 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
4251 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
4252 (match_operand 6 "const_int_operand" " i, i, i, i")
4253 (match_operand 7 "const_int_operand" " i, i, i, i")
4254 (match_operand 8 "const_int_operand" " i, i, i, i")
4255 (match_operand 9 "const_int_operand" " i, i, i, i")
4257 (reg:SI VTYPE_REGNUM)
4258 (reg:SI VXRM_REGNUM)] UNSPEC_VPREDICATE)
4260 [(match_operand:VI 3 "register_operand" " vr, vr, vr, vr")
4261 (match_operand:VI 4 "register_operand" " vr, vr, vr, vr")] VSAT_OP)
4262 (match_operand:VI 2 "vector_merge_operand" " vu, 0, vu, 0")))]
4264 "v<sat_op>.vv\t%0,%3,%4%p1"
4265 [(set_attr "type" "<sat_insn_type>")
4266 (set_attr "mode" "<MODE>")])
4268 ;; Handle GET_MODE_INNER (mode) = QImode, HImode, SImode.
4269 (define_insn "@pred_<sat_op><mode>_scalar"
4270 [(set (match_operand:VI_QHS 0 "register_operand" "=vd, vr, vd, vr")
4271 (if_then_else:VI_QHS
4273 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
4274 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
4275 (match_operand 6 "const_int_operand" " i, i, i, i")
4276 (match_operand 7 "const_int_operand" " i, i, i, i")
4277 (match_operand 8 "const_int_operand" " i, i, i, i")
4278 (match_operand 9 "const_int_operand" " i, i, i, i")
4280 (reg:SI VTYPE_REGNUM)
4281 (reg:SI VXRM_REGNUM)] UNSPEC_VPREDICATE)
4283 [(match_operand:VI_QHS 3 "register_operand" " vr, vr, vr, vr")
4284 (match_operand:<VEL> 4 "reg_or_0_operand" " rJ, rJ, rJ, rJ")] VSAT_ARITH_OP)
4285 (match_operand:VI_QHS 2 "vector_merge_operand" " vu, 0, vu, 0")))]
4287 "v<sat_op>.vx\t%0,%3,%z4%p1"
4288 [(set_attr "type" "<sat_insn_type>")
4289 (set_attr "mode" "<MODE>")])
4291 (define_insn "@pred_<sat_op><mode>_scalar"
4292 [(set (match_operand:VI 0 "register_operand" "=vd, vr, vd, vr")
4295 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
4296 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
4297 (match_operand 6 "const_int_operand" " i, i, i, i")
4298 (match_operand 7 "const_int_operand" " i, i, i, i")
4299 (match_operand 8 "const_int_operand" " i, i, i, i")
4300 (match_operand 9 "const_int_operand" " i, i, i, i")
4302 (reg:SI VTYPE_REGNUM)
4303 (reg:SI VXRM_REGNUM)] UNSPEC_VPREDICATE)
4305 [(match_operand:VI 3 "register_operand" " vr, vr, vr, vr")
4306 (match_operand 4 "pmode_reg_or_uimm5_operand" " rK, rK, rK, rK")] VSAT_SHIFT_OP)
4307 (match_operand:VI 2 "vector_merge_operand" " vu, 0, vu, 0")))]
4309 "v<sat_op>.v%o4\t%0,%3,%4%p1"
4310 [(set_attr "type" "<sat_insn_type>")
4311 (set_attr "mode" "<MODE>")])
4313 ;; Handle GET_MODE_INNER (mode) = DImode. We need to split them since
4314 ;; we need to deal with SEW = 64 in RV32 system.
4315 (define_expand "@pred_<sat_op><mode>_scalar"
4316 [(set (match_operand:VI_D 0 "register_operand")
4319 [(match_operand:<VM> 1 "vector_mask_operand")
4320 (match_operand 5 "vector_length_operand")
4321 (match_operand 6 "const_int_operand")
4322 (match_operand 7 "const_int_operand")
4323 (match_operand 8 "const_int_operand")
4324 (match_operand 9 "const_int_operand")
4326 (reg:SI VTYPE_REGNUM)
4327 (reg:SI VXRM_REGNUM)] UNSPEC_VPREDICATE)
4329 [(match_operand:VI_D 3 "register_operand")
4330 (match_operand:<VEL> 4 "reg_or_int_operand")] VSAT_ARITH_OP)
4331 (match_operand:VI_D 2 "vector_merge_operand")))]
4334 if (riscv_vector::sew64_scalar_helper (
4336 /* scalar op */&operands[4],
4337 /* vl */operands[5],
4340 [] (rtx *operands, rtx boardcast_scalar) {
4341 emit_insn (gen_pred_<sat_op><mode> (operands[0], operands[1],
4342 operands[2], operands[3], boardcast_scalar, operands[5],
4343 operands[6], operands[7], operands[8], operands[9]));
4345 (riscv_vector::avl_type) INTVAL (operands[8])))
4349 (define_insn "*pred_<sat_op><mode>_scalar"
4350 [(set (match_operand:VI_D 0 "register_operand" "=vd, vr, vd, vr")
4353 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
4354 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
4355 (match_operand 6 "const_int_operand" " i, i, i, i")
4356 (match_operand 7 "const_int_operand" " i, i, i, i")
4357 (match_operand 8 "const_int_operand" " i, i, i, i")
4358 (match_operand 9 "const_int_operand" " i, i, i, i")
4360 (reg:SI VTYPE_REGNUM)
4361 (reg:SI VXRM_REGNUM)] UNSPEC_VPREDICATE)
4363 [(match_operand:VI_D 3 "register_operand" " vr, vr, vr, vr")
4364 (match_operand:<VEL> 4 "reg_or_0_operand" " rJ, rJ, rJ, rJ")] VSAT_ARITH_OP)
4365 (match_operand:VI_D 2 "vector_merge_operand" " vu, 0, vu, 0")))]
4367 "v<sat_op>.vx\t%0,%3,%z4%p1"
4368 [(set_attr "type" "<sat_insn_type>")
4369 (set_attr "mode" "<MODE>")])
4371 (define_insn "*pred_<sat_op><mode>_extended_scalar"
4372 [(set (match_operand:VI_D 0 "register_operand" "=vd, vr, vd, vr")
4375 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
4376 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
4377 (match_operand 6 "const_int_operand" " i, i, i, i")
4378 (match_operand 7 "const_int_operand" " i, i, i, i")
4379 (match_operand 8 "const_int_operand" " i, i, i, i")
4380 (match_operand 9 "const_int_operand" " i, i, i, i")
4382 (reg:SI VTYPE_REGNUM)
4383 (reg:SI VXRM_REGNUM)] UNSPEC_VPREDICATE)
4385 [(match_operand:VI_D 3 "register_operand" " vr, vr, vr, vr")
4387 (match_operand:<VSUBEL> 4 "reg_or_0_operand" " rJ, rJ, rJ, rJ"))] VSAT_ARITH_OP)
4388 (match_operand:VI_D 2 "vector_merge_operand" " vu, 0, vu, 0")))]
4389 "TARGET_VECTOR && !TARGET_64BIT"
4390 "v<sat_op>.vx\t%0,%3,%z4%p1"
4391 [(set_attr "type" "<sat_insn_type>")
4392 (set_attr "mode" "<MODE>")])
4395 (define_insn "@pred_narrow_clip<v_su><mode>"
4396 [(set (match_operand:<V_DOUBLE_TRUNC> 0 "register_operand" "=vd,vd, vr, vr,vd, vr, &vr, &vr, vd, vr, &vr, &vr")
4397 (if_then_else:<V_DOUBLE_TRUNC>
4399 [(match_operand:<VM> 1 "vector_mask_operand" " vm,vm,Wc1,Wc1,vm,Wc1,vmWc1,vmWc1, vm,Wc1,vmWc1,vmWc1")
4400 (match_operand 5 "vector_length_operand" " rK,rK, rK, rK,rK, rK, rK, rK, rK, rK, rK, rK")
4401 (match_operand 6 "const_int_operand" " i, i, i, i, i, i, i, i, i, i, i, i")
4402 (match_operand 7 "const_int_operand" " i, i, i, i, i, i, i, i, i, i, i, i")
4403 (match_operand 8 "const_int_operand" " i, i, i, i, i, i, i, i, i, i, i, i")
4404 (match_operand 9 "const_int_operand" " i, i, i, i, i, i, i, i, i, i, i, i")
4406 (reg:SI VTYPE_REGNUM)
4407 (reg:SI VXRM_REGNUM)] UNSPEC_VPREDICATE)
4408 (unspec:<V_DOUBLE_TRUNC>
4409 [(match_operand:VWEXTI 3 "register_operand" " vr,vr, vr, vr, 0, 0, vr, vr, 0, 0, vr, vr")
4410 (match_operand:<V_DOUBLE_TRUNC> 4 "vector_shift_operand" " 0, 0, 0, 0,vr, vr, vr, vr, vk, vk, vk, vk")] VNCLIP)
4411 (match_operand:<V_DOUBLE_TRUNC> 2 "vector_merge_operand" " 0,vu, 0, vu,vu, vu, vu, 0, vu, vu, vu, 0")))]
4413 "vnclip<v_su>.w%o4\t%0,%3,%v4%p1"
4414 [(set_attr "type" "vnclip")
4415 (set_attr "mode" "<V_DOUBLE_TRUNC>")])
4417 (define_insn "@pred_narrow_clip<v_su><mode>_scalar"
4418 [(set (match_operand:<V_DOUBLE_TRUNC> 0 "register_operand" "=vd, vd, vr, vr, &vr, &vr")
4419 (if_then_else:<V_DOUBLE_TRUNC>
4421 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1,vmWc1,vmWc1")
4422 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK, rK, rK")
4423 (match_operand 6 "const_int_operand" " i, i, i, i, i, i")
4424 (match_operand 7 "const_int_operand" " i, i, i, i, i, i")
4425 (match_operand 8 "const_int_operand" " i, i, i, i, i, i")
4426 (match_operand 9 "const_int_operand" " i, i, i, i, i, i")
4428 (reg:SI VTYPE_REGNUM)
4429 (reg:SI VXRM_REGNUM)] UNSPEC_VPREDICATE)
4430 (unspec:<V_DOUBLE_TRUNC>
4431 [(match_operand:VWEXTI 3 "register_operand" " 0, 0, 0, 0, vr, vr")
4432 (match_operand 4 "pmode_reg_or_uimm5_operand" " rK, rK, rK, rK, rK, rK")] VNCLIP)
4433 (match_operand:<V_DOUBLE_TRUNC> 2 "vector_merge_operand" " vu, 0, vu, 0, vu, 0")))]
4435 "vnclip<v_su>.w%o4\t%0,%3,%4%p1"
4436 [(set_attr "type" "vnclip")
4437 (set_attr "mode" "<V_DOUBLE_TRUNC>")])
4439 ;; -------------------------------------------------------------------------------
4440 ;; ---- Predicated integer comparison operations
4441 ;; -------------------------------------------------------------------------------
4443 ;; - 11.8 Vector Integer Comparision Instructions
4444 ;; -------------------------------------------------------------------------------
4446 (define_expand "@pred_cmp<mode>"
4447 [(set (match_operand:<VM> 0 "register_operand")
4450 [(match_operand:<VM> 1 "vector_mask_operand")
4451 (match_operand 6 "vector_length_operand")
4452 (match_operand 7 "const_int_operand")
4453 (match_operand 8 "const_int_operand")
4455 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4456 (match_operator:<VM> 3 "comparison_except_ltge_operator"
4457 [(match_operand:V_VLSI 4 "register_operand")
4458 (match_operand:V_VLSI 5 "vector_arith_operand")])
4459 (match_operand:<VM> 2 "vector_merge_operand")))]
4463 (define_insn "*pred_cmp<mode>_merge_tie_mask"
4464 [(set (match_operand:<VM> 0 "register_operand" "=vm")
4467 [(match_operand:<VM> 1 "register_operand" " 0")
4468 (match_operand 5 "vector_length_operand" " rK")
4469 (match_operand 6 "const_int_operand" " i")
4470 (match_operand 7 "const_int_operand" " i")
4472 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4473 (match_operator:<VM> 2 "comparison_except_ltge_operator"
4474 [(match_operand:V_VLSI 3 "register_operand" " vr")
4475 (match_operand:V_VLSI 4 "vector_arith_operand" "vrvi")])
4478 "vms%B2.v%o4\t%0,%3,%v4,v0.t"
4479 [(set_attr "type" "vicmp")
4480 (set_attr "mode" "<MODE>")
4481 (set_attr "merge_op_idx" "1")
4482 (set_attr "vl_op_idx" "5")
4483 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[6])"))
4484 (set (attr "avl_type_idx") (const_int 7))])
4486 ;; We don't use early-clobber for LMUL <= 1 to get better codegen.
4487 (define_insn "*pred_cmp<mode>"
4488 [(set (match_operand:<VM> 0 "register_operand" "=vr, vr, vr, vr")
4491 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1,vmWc1,vmWc1")
4492 (match_operand 6 "vector_length_operand" " rK, rK, rK, rK")
4493 (match_operand 7 "const_int_operand" " i, i, i, i")
4494 (match_operand 8 "const_int_operand" " i, i, i, i")
4496 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4497 (match_operator:<VM> 3 "comparison_except_ltge_operator"
4498 [(match_operand:V_VLSI 4 "register_operand" " vr, vr, vr, vr")
4499 (match_operand:V_VLSI 5 "vector_arith_operand" " vr, vr, vi, vi")])
4500 (match_operand:<VM> 2 "vector_merge_operand" " vu, 0, vu, 0")))]
4501 "TARGET_VECTOR && riscv_vector::cmp_lmul_le_one (<MODE>mode)"
4502 "vms%B3.v%o5\t%0,%4,%v5%p1"
4503 [(set_attr "type" "vicmp")
4504 (set_attr "mode" "<MODE>")])
4506 ;; We use early-clobber for source LMUL > dest LMUL.
4507 (define_insn "*pred_cmp<mode>_narrow"
4508 [(set (match_operand:<VM> 0 "register_operand" "=vm, vr, vr, vr, vr, vr, vr, &vr, &vr")
4511 [(match_operand:<VM> 1 "vector_mask_operand" " 0,vmWc1,vmWc1,vmWc1,vmWc1,vmWc1,vmWc1,vmWc1,vmWc1")
4512 (match_operand 6 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK, rK, rK")
4513 (match_operand 7 "const_int_operand" " i, i, i, i, i, i, i, i, i")
4514 (match_operand 8 "const_int_operand" " i, i, i, i, i, i, i, i, i")
4516 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4517 (match_operator:<VM> 3 "comparison_except_ltge_operator"
4518 [(match_operand:V_VLSI 4 "register_operand" " vr, 0, vr, 0, 0, vr, 0, vr, vr")
4519 (match_operand:V_VLSI 5 "vector_arith_operand" " vrvi, vrvi, 0, 0, vrvi, 0, 0, vrvi, vrvi")])
4520 (match_operand:<VM> 2 "vector_merge_operand" " vu, vu, vu, vu, 0, 0, 0, vu, 0")))]
4521 "TARGET_VECTOR && riscv_vector::cmp_lmul_gt_one (<MODE>mode)"
4522 "vms%B3.v%o5\t%0,%4,%v5%p1"
4523 [(set_attr "type" "vicmp")
4524 (set_attr "mode" "<MODE>")])
4526 (define_expand "@pred_ltge<mode>"
4527 [(set (match_operand:<VM> 0 "register_operand")
4530 [(match_operand:<VM> 1 "vector_mask_operand")
4531 (match_operand 6 "vector_length_operand")
4532 (match_operand 7 "const_int_operand")
4533 (match_operand 8 "const_int_operand")
4535 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4536 (match_operator:<VM> 3 "ltge_operator"
4537 [(match_operand:V_VLSI 4 "register_operand")
4538 (match_operand:V_VLSI 5 "vector_neg_arith_operand")])
4539 (match_operand:<VM> 2 "vector_merge_operand")))]
4543 (define_insn "*pred_ltge<mode>_merge_tie_mask"
4544 [(set (match_operand:<VM> 0 "register_operand" "=vm")
4547 [(match_operand:<VM> 1 "register_operand" " 0")
4548 (match_operand 5 "vector_length_operand" " rK")
4549 (match_operand 6 "const_int_operand" " i")
4550 (match_operand 7 "const_int_operand" " i")
4552 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4553 (match_operator:<VM> 2 "ltge_operator"
4554 [(match_operand:V_VLSI 3 "register_operand" " vr")
4555 (match_operand:V_VLSI 4 "vector_neg_arith_operand" "vrvj")])
4558 "vms%B2.v%o4\t%0,%3,%v4,v0.t"
4559 [(set_attr "type" "vicmp")
4560 (set_attr "mode" "<MODE>")
4561 (set_attr "merge_op_idx" "1")
4562 (set_attr "vl_op_idx" "5")
4563 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[6])"))
4564 (set (attr "avl_type_idx") (const_int 7))])
4566 ;; We don't use early-clobber for LMUL <= 1 to get better codegen.
4567 (define_insn "*pred_ltge<mode>"
4568 [(set (match_operand:<VM> 0 "register_operand" "=vr, vr, vr, vr")
4571 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1,vmWc1,vmWc1")
4572 (match_operand 6 "vector_length_operand" " rK, rK, rK, rK")
4573 (match_operand 7 "const_int_operand" " i, i, i, i")
4574 (match_operand 8 "const_int_operand" " i, i, i, i")
4576 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4577 (match_operator:<VM> 3 "ltge_operator"
4578 [(match_operand:V_VLSI 4 "register_operand" " vr, vr, vr, vr")
4579 (match_operand:V_VLSI 5 "vector_neg_arith_operand" " vr, vr, vj, vj")])
4580 (match_operand:<VM> 2 "vector_merge_operand" " vu, 0, vu, 0")))]
4581 "TARGET_VECTOR && riscv_vector::cmp_lmul_le_one (<MODE>mode)"
4582 "vms%B3.v%o5\t%0,%4,%v5%p1"
4583 [(set_attr "type" "vicmp")
4584 (set_attr "mode" "<MODE>")])
4586 ;; We use early-clobber for source LMUL > dest LMUL.
4587 (define_insn "*pred_ltge<mode>_narrow"
4588 [(set (match_operand:<VM> 0 "register_operand" "=vm, vr, vr, vr, vr, vr, vr, &vr, &vr")
4591 [(match_operand:<VM> 1 "vector_mask_operand" " 0,vmWc1,vmWc1,vmWc1,vmWc1,vmWc1,vmWc1,vmWc1,vmWc1")
4592 (match_operand 6 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK, rK, rK")
4593 (match_operand 7 "const_int_operand" " i, i, i, i, i, i, i, i, i")
4594 (match_operand 8 "const_int_operand" " i, i, i, i, i, i, i, i, i")
4596 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4597 (match_operator:<VM> 3 "ltge_operator"
4598 [(match_operand:V_VLSI 4 "register_operand" " vr, 0, vr, 0, 0, vr, 0, vr, vr")
4599 (match_operand:V_VLSI 5 "vector_neg_arith_operand" " vrvj, vrvj, 0, 0, vrvj, 0, 0, vrvj, vrvj")])
4600 (match_operand:<VM> 2 "vector_merge_operand" " vu, vu, vu, vu, 0, 0, 0, vu, 0")))]
4601 "TARGET_VECTOR && riscv_vector::cmp_lmul_gt_one (<MODE>mode)"
4602 "vms%B3.v%o5\t%0,%4,%v5%p1"
4603 [(set_attr "type" "vicmp")
4604 (set_attr "mode" "<MODE>")])
4606 (define_expand "@pred_cmp<mode>_scalar"
4607 [(set (match_operand:<VM> 0 "register_operand")
4610 [(match_operand:<VM> 1 "vector_mask_operand")
4611 (match_operand 6 "vector_length_operand")
4612 (match_operand 7 "const_int_operand")
4613 (match_operand 8 "const_int_operand")
4615 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4616 (match_operator:<VM> 3 "comparison_except_eqge_operator"
4617 [(match_operand:V_VLSI_QHS 4 "register_operand")
4618 (vec_duplicate:V_VLSI_QHS
4619 (match_operand:<VEL> 5 "register_operand"))])
4620 (match_operand:<VM> 2 "vector_merge_operand")))]
4624 (define_insn "*pred_cmp<mode>_scalar_merge_tie_mask"
4625 [(set (match_operand:<VM> 0 "register_operand" "=vm")
4628 [(match_operand:<VM> 1 "register_operand" " 0")
4629 (match_operand 5 "vector_length_operand" " rK")
4630 (match_operand 6 "const_int_operand" " i")
4631 (match_operand 7 "const_int_operand" " i")
4633 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4634 (match_operator:<VM> 2 "comparison_except_eqge_operator"
4635 [(match_operand:V_VLSI_QHS 3 "register_operand" " vr")
4636 (vec_duplicate:V_VLSI_QHS
4637 (match_operand:<VEL> 4 "register_operand" " r"))])
4640 "vms%B2.vx\t%0,%3,%4,v0.t"
4641 [(set_attr "type" "vicmp")
4642 (set_attr "mode" "<MODE>")
4643 (set_attr "merge_op_idx" "1")
4644 (set_attr "vl_op_idx" "5")
4645 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[6])"))
4646 (set (attr "avl_type_idx") (const_int 7))])
4648 ;; We don't use early-clobber for LMUL <= 1 to get better codegen.
4649 (define_insn "*pred_cmp<mode>_scalar"
4650 [(set (match_operand:<VM> 0 "register_operand" "=vr, vr")
4653 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
4654 (match_operand 6 "vector_length_operand" " rK, rK")
4655 (match_operand 7 "const_int_operand" " i, i")
4656 (match_operand 8 "const_int_operand" " i, i")
4658 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4659 (match_operator:<VM> 3 "comparison_except_eqge_operator"
4660 [(match_operand:V_VLSI_QHS 4 "register_operand" " vr, vr")
4661 (vec_duplicate:V_VLSI_QHS
4662 (match_operand:<VEL> 5 "register_operand" " r, r"))])
4663 (match_operand:<VM> 2 "vector_merge_operand" " vu, 0")))]
4664 "TARGET_VECTOR && riscv_vector::cmp_lmul_le_one (<MODE>mode)"
4665 "vms%B3.vx\t%0,%4,%5%p1"
4666 [(set_attr "type" "vicmp")
4667 (set_attr "mode" "<MODE>")])
4669 ;; We use early-clobber for source LMUL > dest LMUL.
4670 (define_insn "*pred_cmp<mode>_scalar_narrow"
4671 [(set (match_operand:<VM> 0 "register_operand" "=vm, vr, vr, &vr, &vr")
4674 [(match_operand:<VM> 1 "vector_mask_operand" " 0,vmWc1,vmWc1,vmWc1,vmWc1")
4675 (match_operand 6 "vector_length_operand" " rK, rK, rK, rK, rK")
4676 (match_operand 7 "const_int_operand" " i, i, i, i, i")
4677 (match_operand 8 "const_int_operand" " i, i, i, i, i")
4679 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4680 (match_operator:<VM> 3 "comparison_except_eqge_operator"
4681 [(match_operand:V_VLSI_QHS 4 "register_operand" " vr, 0, 0, vr, vr")
4682 (vec_duplicate:V_VLSI_QHS
4683 (match_operand:<VEL> 5 "register_operand" " r, r, r, r, r"))])
4684 (match_operand:<VM> 2 "vector_merge_operand" " vu, vu, 0, vu, 0")))]
4685 "TARGET_VECTOR && riscv_vector::cmp_lmul_gt_one (<MODE>mode)"
4686 "vms%B3.vx\t%0,%4,%5%p1"
4687 [(set_attr "type" "vicmp")
4688 (set_attr "mode" "<MODE>")])
4690 (define_expand "@pred_eqne<mode>_scalar"
4691 [(set (match_operand:<VM> 0 "register_operand")
4694 [(match_operand:<VM> 1 "vector_mask_operand")
4695 (match_operand 6 "vector_length_operand")
4696 (match_operand 7 "const_int_operand")
4697 (match_operand 8 "const_int_operand")
4699 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4700 (match_operator:<VM> 3 "equality_operator"
4701 [(vec_duplicate:V_VLSI_QHS
4702 (match_operand:<VEL> 5 "register_operand"))
4703 (match_operand:V_VLSI_QHS 4 "register_operand")])
4704 (match_operand:<VM> 2 "vector_merge_operand")))]
4708 (define_insn "*pred_eqne<mode>_scalar_merge_tie_mask"
4709 [(set (match_operand:<VM> 0 "register_operand" "=vm")
4712 [(match_operand:<VM> 1 "register_operand" " 0")
4713 (match_operand 5 "vector_length_operand" " rK")
4714 (match_operand 6 "const_int_operand" " i")
4715 (match_operand 7 "const_int_operand" " i")
4717 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4718 (match_operator:<VM> 2 "equality_operator"
4719 [(vec_duplicate:V_VLSI_QHS
4720 (match_operand:<VEL> 4 "register_operand" " r"))
4721 (match_operand:V_VLSI_QHS 3 "register_operand" " vr")])
4724 "vms%B2.vx\t%0,%3,%4,v0.t"
4725 [(set_attr "type" "vicmp")
4726 (set_attr "mode" "<MODE>")
4727 (set_attr "merge_op_idx" "1")
4728 (set_attr "vl_op_idx" "5")
4729 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[6])"))
4730 (set (attr "avl_type_idx") (const_int 7))])
4732 ;; We don't use early-clobber for LMUL <= 1 to get better codegen.
4733 (define_insn "*pred_eqne<mode>_scalar"
4734 [(set (match_operand:<VM> 0 "register_operand" "=vr, vr")
4737 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
4738 (match_operand 6 "vector_length_operand" " rK, rK")
4739 (match_operand 7 "const_int_operand" " i, i")
4740 (match_operand 8 "const_int_operand" " i, i")
4742 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4743 (match_operator:<VM> 3 "equality_operator"
4744 [(vec_duplicate:V_VLSI_QHS
4745 (match_operand:<VEL> 5 "register_operand" " r, r"))
4746 (match_operand:V_VLSI_QHS 4 "register_operand" " vr, vr")])
4747 (match_operand:<VM> 2 "vector_merge_operand" " vu, 0")))]
4748 "TARGET_VECTOR && riscv_vector::cmp_lmul_le_one (<MODE>mode)"
4749 "vms%B3.vx\t%0,%4,%5%p1"
4750 [(set_attr "type" "vicmp")
4751 (set_attr "mode" "<MODE>")])
4753 ;; We use early-clobber for source LMUL > dest LMUL.
4754 (define_insn "*pred_eqne<mode>_scalar_narrow"
4755 [(set (match_operand:<VM> 0 "register_operand" "=vm, vr, vr, &vr, &vr")
4758 [(match_operand:<VM> 1 "vector_mask_operand" " 0,vmWc1,vmWc1,vmWc1,vmWc1")
4759 (match_operand 6 "vector_length_operand" " rK, rK, rK, rK, rK")
4760 (match_operand 7 "const_int_operand" " i, i, i, i, i")
4761 (match_operand 8 "const_int_operand" " i, i, i, i, i")
4763 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4764 (match_operator:<VM> 3 "equality_operator"
4765 [(vec_duplicate:V_VLSI_QHS
4766 (match_operand:<VEL> 5 "register_operand" " r, r, r, r, r"))
4767 (match_operand:V_VLSI_QHS 4 "register_operand" " vr, 0, 0, vr, vr")])
4768 (match_operand:<VM> 2 "vector_merge_operand" " vu, vu, 0, vu, 0")))]
4769 "TARGET_VECTOR && riscv_vector::cmp_lmul_gt_one (<MODE>mode)"
4770 "vms%B3.vx\t%0,%4,%5%p1"
4771 [(set_attr "type" "vicmp")
4772 (set_attr "mode" "<MODE>")])
4774 ;; Handle GET_MODE_INNER (mode) = DImode. We need to split them since
4775 ;; we need to deal with SEW = 64 in RV32 system.
4776 (define_expand "@pred_cmp<mode>_scalar"
4777 [(set (match_operand:<VM> 0 "register_operand")
4780 [(match_operand:<VM> 1 "vector_mask_operand")
4781 (match_operand 6 "vector_length_operand")
4782 (match_operand 7 "const_int_operand")
4783 (match_operand 8 "const_int_operand")
4785 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4786 (match_operator:<VM> 3 "comparison_except_eqge_operator"
4787 [(match_operand:V_VLSI_D 4 "register_operand")
4788 (vec_duplicate:V_VLSI_D
4789 (match_operand:<VEL> 5 "reg_or_int_operand"))])
4790 (match_operand:<VM> 2 "vector_merge_operand")))]
4793 enum rtx_code code = GET_CODE (operands[3]);
4794 if (riscv_vector::sew64_scalar_helper (
4796 /* scalar op */&operands[5],
4797 /* vl */operands[6],
4799 riscv_vector::has_vi_variant_p (code, operands[5]),
4800 code == LT || code == LTU ?
4801 [] (rtx *operands, rtx boardcast_scalar) {
4802 emit_insn (gen_pred_ltge<mode> (operands[0], operands[1],
4803 operands[2], operands[3], operands[4], boardcast_scalar,
4804 operands[6], operands[7], operands[8]));
4807 [] (rtx *operands, rtx boardcast_scalar) {
4808 emit_insn (gen_pred_cmp<mode> (operands[0], operands[1],
4809 operands[2], operands[3], operands[4], boardcast_scalar,
4810 operands[6], operands[7], operands[8]));
4812 (riscv_vector::avl_type) INTVAL (operands[8])))
4816 (define_expand "@pred_eqne<mode>_scalar"
4817 [(set (match_operand:<VM> 0 "register_operand")
4820 [(match_operand:<VM> 1 "vector_mask_operand")
4821 (match_operand 6 "vector_length_operand")
4822 (match_operand 7 "const_int_operand")
4823 (match_operand 8 "const_int_operand")
4825 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4826 (match_operator:<VM> 3 "equality_operator"
4827 [(vec_duplicate:V_VLSI_D
4828 (match_operand:<VEL> 5 "reg_or_int_operand"))
4829 (match_operand:V_VLSI_D 4 "register_operand")])
4830 (match_operand:<VM> 2 "vector_merge_operand")))]
4833 enum rtx_code code = GET_CODE (operands[3]);
4834 if (riscv_vector::sew64_scalar_helper (
4836 /* scalar op */&operands[5],
4837 /* vl */operands[6],
4839 riscv_vector::has_vi_variant_p (code, operands[5]),
4840 [] (rtx *operands, rtx boardcast_scalar) {
4841 emit_insn (gen_pred_cmp<mode> (operands[0], operands[1],
4842 operands[2], operands[3], operands[4], boardcast_scalar,
4843 operands[6], operands[7], operands[8]));
4845 (riscv_vector::avl_type) INTVAL (operands[8])))
4849 (define_insn "*pred_cmp<mode>_scalar_merge_tie_mask"
4850 [(set (match_operand:<VM> 0 "register_operand" "=vm")
4853 [(match_operand:<VM> 1 "register_operand" " 0")
4854 (match_operand 5 "vector_length_operand" " rK")
4855 (match_operand 6 "const_int_operand" " i")
4856 (match_operand 7 "const_int_operand" " i")
4858 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4859 (match_operator:<VM> 2 "comparison_except_eqge_operator"
4860 [(match_operand:V_VLSI_D 3 "register_operand" " vr")
4861 (vec_duplicate:V_VLSI_D
4862 (match_operand:<VEL> 4 "register_operand" " r"))])
4865 "vms%B2.vx\t%0,%3,%4,v0.t"
4866 [(set_attr "type" "vicmp")
4867 (set_attr "mode" "<MODE>")
4868 (set_attr "merge_op_idx" "1")
4869 (set_attr "vl_op_idx" "5")
4870 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[6])"))
4871 (set (attr "avl_type_idx") (const_int 7))])
4873 (define_insn "*pred_eqne<mode>_scalar_merge_tie_mask"
4874 [(set (match_operand:<VM> 0 "register_operand" "=vm")
4877 [(match_operand:<VM> 1 "register_operand" " 0")
4878 (match_operand 5 "vector_length_operand" " rK")
4879 (match_operand 6 "const_int_operand" " i")
4880 (match_operand 7 "const_int_operand" " i")
4882 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4883 (match_operator:<VM> 2 "equality_operator"
4884 [(vec_duplicate:V_VLSI_D
4885 (match_operand:<VEL> 4 "register_operand" " r"))
4886 (match_operand:V_VLSI_D 3 "register_operand" " vr")])
4889 "vms%B2.vx\t%0,%3,%4,v0.t"
4890 [(set_attr "type" "vicmp")
4891 (set_attr "mode" "<MODE>")
4892 (set_attr "merge_op_idx" "1")
4893 (set_attr "vl_op_idx" "5")
4894 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[6])"))
4895 (set (attr "avl_type_idx") (const_int 7))])
4897 ;; We don't use early-clobber for LMUL <= 1 to get better codegen.
4898 (define_insn "*pred_cmp<mode>_scalar"
4899 [(set (match_operand:<VM> 0 "register_operand" "=vr, vr")
4902 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
4903 (match_operand 6 "vector_length_operand" " rK, rK")
4904 (match_operand 7 "const_int_operand" " i, i")
4905 (match_operand 8 "const_int_operand" " i, i")
4907 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4908 (match_operator:<VM> 3 "comparison_except_eqge_operator"
4909 [(match_operand:V_VLSI_D 4 "register_operand" " vr, vr")
4910 (vec_duplicate:V_VLSI_D
4911 (match_operand:<VEL> 5 "register_operand" " r, r"))])
4912 (match_operand:<VM> 2 "vector_merge_operand" " vu, 0")))]
4913 "TARGET_VECTOR && riscv_vector::cmp_lmul_le_one (<MODE>mode)"
4914 "vms%B3.vx\t%0,%4,%5%p1"
4915 [(set_attr "type" "vicmp")
4916 (set_attr "mode" "<MODE>")])
4918 ;; We use early-clobber for source LMUL > dest LMUL.
4919 (define_insn "*pred_cmp<mode>_scalar_narrow"
4920 [(set (match_operand:<VM> 0 "register_operand" "=vm, vr, vr, &vr, &vr")
4923 [(match_operand:<VM> 1 "vector_mask_operand" " 0,vmWc1,vmWc1,vmWc1,vmWc1")
4924 (match_operand 6 "vector_length_operand" " rK, rK, rK, rK, rK")
4925 (match_operand 7 "const_int_operand" " i, i, i, i, i")
4926 (match_operand 8 "const_int_operand" " i, i, i, i, i")
4928 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4929 (match_operator:<VM> 3 "comparison_except_eqge_operator"
4930 [(match_operand:V_VLSI_D 4 "register_operand" " vr, 0, 0, vr, vr")
4931 (vec_duplicate:V_VLSI_D
4932 (match_operand:<VEL> 5 "register_operand" " r, r, r, r, r"))])
4933 (match_operand:<VM> 2 "vector_merge_operand" " vu, vu, 0, vu, 0")))]
4934 "TARGET_VECTOR && riscv_vector::cmp_lmul_gt_one (<MODE>mode)"
4935 "vms%B3.vx\t%0,%4,%5%p1"
4936 [(set_attr "type" "vicmp")
4937 (set_attr "mode" "<MODE>")])
4939 ;; We don't use early-clobber for LMUL <= 1 to get better codegen.
4940 (define_insn "*pred_eqne<mode>_scalar"
4941 [(set (match_operand:<VM> 0 "register_operand" "=vr, vr")
4944 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
4945 (match_operand 6 "vector_length_operand" " rK, rK")
4946 (match_operand 7 "const_int_operand" " i, i")
4947 (match_operand 8 "const_int_operand" " i, i")
4949 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4950 (match_operator:<VM> 3 "equality_operator"
4951 [(vec_duplicate:V_VLSI_D
4952 (match_operand:<VEL> 5 "register_operand" " r, r"))
4953 (match_operand:V_VLSI_D 4 "register_operand" " vr, vr")])
4954 (match_operand:<VM> 2 "vector_merge_operand" " vu, 0")))]
4955 "TARGET_VECTOR && riscv_vector::cmp_lmul_le_one (<MODE>mode)"
4956 "vms%B3.vx\t%0,%4,%5%p1"
4957 [(set_attr "type" "vicmp")
4958 (set_attr "mode" "<MODE>")])
4960 ;; We use early-clobber for source LMUL > dest LMUL.
4961 (define_insn "*pred_eqne<mode>_scalar_narrow"
4962 [(set (match_operand:<VM> 0 "register_operand" "=vm, vr, vr, &vr, &vr")
4965 [(match_operand:<VM> 1 "vector_mask_operand" " 0,vmWc1,vmWc1,vmWc1,vmWc1")
4966 (match_operand 6 "vector_length_operand" " rK, rK, rK, rK, rK")
4967 (match_operand 7 "const_int_operand" " i, i, i, i, i")
4968 (match_operand 8 "const_int_operand" " i, i, i, i, i")
4970 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4971 (match_operator:<VM> 3 "equality_operator"
4972 [(vec_duplicate:V_VLSI_D
4973 (match_operand:<VEL> 5 "register_operand" " r, r, r, r, r"))
4974 (match_operand:V_VLSI_D 4 "register_operand" " vr, 0, 0, vr, vr")])
4975 (match_operand:<VM> 2 "vector_merge_operand" " vu, vu, 0, vu, 0")))]
4976 "TARGET_VECTOR && riscv_vector::cmp_lmul_gt_one (<MODE>mode)"
4977 "vms%B3.vx\t%0,%4,%5%p1"
4978 [(set_attr "type" "vicmp")
4979 (set_attr "mode" "<MODE>")])
4981 (define_insn "*pred_cmp<mode>_extended_scalar_merge_tie_mask"
4982 [(set (match_operand:<VM> 0 "register_operand" "=vm")
4985 [(match_operand:<VM> 1 "register_operand" " 0")
4986 (match_operand 5 "vector_length_operand" " rK")
4987 (match_operand 6 "const_int_operand" " i")
4988 (match_operand 7 "const_int_operand" " i")
4990 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
4991 (match_operator:<VM> 2 "comparison_except_eqge_operator"
4992 [(match_operand:V_VLSI_D 3 "register_operand" " vr")
4993 (vec_duplicate:V_VLSI_D
4995 (match_operand:<VSUBEL> 4 "register_operand" " r")))])
4997 "TARGET_VECTOR && !TARGET_64BIT"
4998 "vms%B2.vx\t%0,%3,%4,v0.t"
4999 [(set_attr "type" "vicmp")
5000 (set_attr "mode" "<MODE>")
5001 (set_attr "merge_op_idx" "1")
5002 (set_attr "vl_op_idx" "5")
5003 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[6])"))
5004 (set (attr "avl_type_idx") (const_int 7))])
5006 ;; We don't use early-clobber for LMUL <= 1 to get better codegen.
5007 (define_insn "*pred_cmp<mode>_extended_scalar"
5008 [(set (match_operand:<VM> 0 "register_operand" "=vr, vr")
5011 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
5012 (match_operand 6 "vector_length_operand" " rK, rK")
5013 (match_operand 7 "const_int_operand" " i, i")
5014 (match_operand 8 "const_int_operand" " i, i")
5016 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5017 (match_operator:<VM> 3 "comparison_except_eqge_operator"
5018 [(match_operand:V_VLSI_D 4 "register_operand" " vr, vr")
5019 (vec_duplicate:V_VLSI_D
5021 (match_operand:<VSUBEL> 5 "register_operand" " r, r")))])
5022 (match_operand:<VM> 2 "vector_merge_operand" " vu, 0")))]
5023 "TARGET_VECTOR && riscv_vector::cmp_lmul_le_one (<MODE>mode) && !TARGET_64BIT"
5024 "vms%B3.vx\t%0,%4,%5%p1"
5025 [(set_attr "type" "vicmp")
5026 (set_attr "mode" "<MODE>")])
5028 (define_insn "*pred_cmp<mode>_extended_scalar_narrow"
5029 [(set (match_operand:<VM> 0 "register_operand" "=vm, vr, vr, &vr, &vr")
5032 [(match_operand:<VM> 1 "vector_mask_operand" " 0,vmWc1,vmWc1,vmWc1,vmWc1")
5033 (match_operand 6 "vector_length_operand" " rK, rK, rK, rK, rK")
5034 (match_operand 7 "const_int_operand" " i, i, i, i, i")
5035 (match_operand 8 "const_int_operand" " i, i, i, i, i")
5037 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5038 (match_operator:<VM> 3 "comparison_except_eqge_operator"
5039 [(match_operand:V_VLSI_D 4 "register_operand" " vr, 0, 0, vr, vr")
5040 (vec_duplicate:V_VLSI_D
5042 (match_operand:<VSUBEL> 5 "register_operand" " r, r, r, r, r")))])
5043 (match_operand:<VM> 2 "vector_merge_operand" " vu, vu, 0, vu, 0")))]
5044 "TARGET_VECTOR && riscv_vector::cmp_lmul_gt_one (<MODE>mode) && !TARGET_64BIT"
5045 "vms%B3.vx\t%0,%4,%5%p1"
5046 [(set_attr "type" "vicmp")
5047 (set_attr "mode" "<MODE>")])
5049 (define_insn "*pred_eqne<mode>_extended_scalar_merge_tie_mask"
5050 [(set (match_operand:<VM> 0 "register_operand" "=vm")
5053 [(match_operand:<VM> 1 "register_operand" " 0")
5054 (match_operand 5 "vector_length_operand" " rK")
5055 (match_operand 6 "const_int_operand" " i")
5056 (match_operand 7 "const_int_operand" " i")
5058 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5059 (match_operator:<VM> 2 "equality_operator"
5060 [(vec_duplicate:V_VLSI_D
5062 (match_operand:<VSUBEL> 4 "register_operand" " r")))
5063 (match_operand:V_VLSI_D 3 "register_operand" " vr")])
5065 "TARGET_VECTOR && !TARGET_64BIT"
5066 "vms%B2.vx\t%0,%3,%4,v0.t"
5067 [(set_attr "type" "vicmp")
5068 (set_attr "mode" "<MODE>")
5069 (set_attr "merge_op_idx" "1")
5070 (set_attr "vl_op_idx" "5")
5071 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[6])"))
5072 (set (attr "avl_type_idx") (const_int 7))])
5074 ;; We don't use early-clobber for LMUL <= 1 to get better codegen.
5075 (define_insn "*pred_eqne<mode>_extended_scalar"
5076 [(set (match_operand:<VM> 0 "register_operand" "=vr, vr")
5079 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
5080 (match_operand 6 "vector_length_operand" " rK, rK")
5081 (match_operand 7 "const_int_operand" " i, i")
5082 (match_operand 8 "const_int_operand" " i, i")
5084 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5085 (match_operator:<VM> 3 "equality_operator"
5086 [(vec_duplicate:V_VLSI_D
5088 (match_operand:<VSUBEL> 5 "register_operand" " r, r")))
5089 (match_operand:V_VLSI_D 4 "register_operand" " vr, vr")])
5090 (match_operand:<VM> 2 "vector_merge_operand" " vu, 0")))]
5091 "TARGET_VECTOR && riscv_vector::cmp_lmul_le_one (<MODE>mode) && !TARGET_64BIT"
5092 "vms%B3.vx\t%0,%4,%5%p1"
5093 [(set_attr "type" "vicmp")
5094 (set_attr "mode" "<MODE>")])
5096 (define_insn "*pred_eqne<mode>_extended_scalar_narrow"
5097 [(set (match_operand:<VM> 0 "register_operand" "=vm, vr, vr, &vr, &vr")
5100 [(match_operand:<VM> 1 "vector_mask_operand" " 0,vmWc1,vmWc1,vmWc1,vmWc1")
5101 (match_operand 6 "vector_length_operand" " rK, rK, rK, rK, rK")
5102 (match_operand 7 "const_int_operand" " i, i, i, i, i")
5103 (match_operand 8 "const_int_operand" " i, i, i, i, i")
5105 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5106 (match_operator:<VM> 3 "equality_operator"
5107 [(vec_duplicate:V_VLSI_D
5109 (match_operand:<VSUBEL> 5 "register_operand" " r, r, r, r, r")))
5110 (match_operand:V_VLSI_D 4 "register_operand" " vr, 0, 0, vr, vr")])
5111 (match_operand:<VM> 2 "vector_merge_operand" " vu, vu, 0, vu, 0")))]
5112 "TARGET_VECTOR && riscv_vector::cmp_lmul_gt_one (<MODE>mode) && !TARGET_64BIT"
5113 "vms%B3.vx\t%0,%4,%5%p1"
5114 [(set_attr "type" "vicmp")
5115 (set_attr "mode" "<MODE>")])
5117 ;; GE, vmsge.vx/vmsgeu.vx
5120 ;; - pseudoinstruction: vmsge{u}.vx vd, va, x
5121 ;; - expansion: vmslt{u}.vx vd, va, x; vmnand.mm vd, vd, vd
5123 ;; masked va >= x, vd != v0
5124 ;; - pseudoinstruction: vmsge{u}.vx vd, va, x, v0.t
5125 ;; - expansion: vmslt{u}.vx vd, va, x, v0.t; vmxor.mm vd, vd, v0
5127 ;; masked va >= x, vd == v0
5128 ;; - pseudoinstruction: vmsge{u}.vx vd, va, x, v0.t, vt
5129 ;; - expansion: vmslt{u}.vx vt, va, x; vmandn.mm vd, vd, vt
5130 (define_expand "@pred_ge<mode>_scalar"
5131 [(set (match_operand:<VM> 0 "register_operand")
5134 [(match_operand:<VM> 1 "vector_mask_operand")
5135 (match_operand 6 "vector_length_operand")
5136 (match_operand 7 "const_int_operand")
5137 (match_operand 8 "const_int_operand")
5139 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5140 (match_operator:<VM> 3 "ge_operator"
5141 [(match_operand:V_VLSI 4 "register_operand")
5142 (vec_duplicate:V_VLSI
5143 (match_operand:<VEL> 5 "reg_or_int_operand"))])
5144 (match_operand:<VM> 2 "vector_merge_operand")))]
5147 enum rtx_code code = GET_CODE (operands[3]);
5148 rtx undef = RVV_VUNDEF (<VM>mode);
5149 rtx tmp = gen_reg_rtx (<VM>mode);
5150 if (code == GEU && rtx_equal_p (operands[5], const0_rtx))
5152 /* If vmsgeu with 0 immediate, expand it to vmset. */
5153 if (satisfies_constraint_Wc1 (operands[1]))
5155 gen_pred_mov (<VM>mode, operands[0], CONSTM1_RTX (<VM>mode), undef,
5156 CONSTM1_RTX (<VM>mode), operands[6], operands[8]));
5159 /* If vmsgeu_mask with 0 immediate, expand it to vmor mask, maskedoff.
5161 if (rtx_equal_p (operands[1], operands[2]))
5162 emit_move_insn (operands[0], operands[1]);
5163 else if (register_operand (operands[2], <VM>mode))
5164 emit_insn (gen_pred (IOR, <VM>mode, operands[0],
5165 CONSTM1_RTX (<VM>mode), undef, operands[1],
5166 operands[2], operands[6], operands[8]));
5168 emit_insn (gen_pred (IOR, <VM>mode, operands[0],
5169 CONSTM1_RTX (<VM>mode), undef, operands[1],
5170 operands[1], operands[6], operands[8]));
5173 else if (riscv_vector::neg_simm5_p (operands[5]))
5175 gen_pred_ltge<mode> (operands[0], operands[1], operands[2], operands[3],
5177 gen_const_vec_duplicate (<MODE>mode, operands[5]),
5178 operands[6], operands[7], operands[8]));
5182 operands[3] = gen_rtx_fmt_ee (LT, <VM>mode, XEXP (operands[3], 0),
5183 XEXP (operands[3], 1));
5185 operands[3] = gen_rtx_fmt_ee (LTU, <VM>mode, XEXP (operands[3], 0),
5186 XEXP (operands[3], 1));
5187 if (GET_MODE_BITSIZE (<VEL>mode) <= GET_MODE_BITSIZE (Pmode))
5188 operands[5] = force_reg (<VEL>mode, operands[5]);
5190 if (satisfies_constraint_Wc1 (operands[1]))
5193 - pseudoinstruction: vmsge{u}.vx vd, va, x
5194 - expansion: vmslt{u}.vx vd, va, x; vmnand.mm vd, vd, vd. */
5196 gen_pred_cmp<mode>_scalar (tmp, operands[1], operands[2],
5197 operands[3], operands[4], operands[5],
5198 operands[6], operands[7], operands[8]));
5199 emit_insn (gen_pred_nand<vm> (operands[0], CONSTM1_RTX (<VM>mode),
5200 undef, tmp, tmp, operands[6], operands[8]));
5204 if (rtx_equal_p (operands[1], operands[2]))
5206 /* masked va >= x, vd == v0
5207 - pseudoinstruction: vmsge{u}.vx vd, va, x, v0.t, vt
5208 - expansion: vmslt{u}.vx vt, va, x; vmandn.mm vd, vd, vt. */
5209 emit_insn (gen_pred_cmp<mode>_scalar (
5210 tmp, CONSTM1_RTX (<VM>mode), undef, operands[3], operands[4],
5211 operands[5], operands[6], operands[7], operands[8]));
5213 gen_pred_andnot<vm> (operands[0], CONSTM1_RTX (<VM>mode), undef,
5214 operands[1], tmp, operands[6], operands[8]));
5218 /* masked va >= x, vd != v0
5219 - pseudoinstruction: vmsge{u}.vx vd, va, x, v0.t
5220 - expansion: vmslt{u}.vx vd, va, x, v0.t; vmxor.mm vd, vd, v0.
5222 emit_insn (gen_pred_cmp<mode>_scalar (
5223 tmp, operands[1], operands[2], operands[3], operands[4],
5224 operands[5], operands[6], operands[7], operands[8]));
5225 emit_insn (gen_pred (XOR, <VM>mode, operands[0],
5226 CONSTM1_RTX (<VM>mode), undef, tmp,
5227 operands[1], operands[6], operands[8]));
5234 ;; -------------------------------------------------------------------------------
5235 ;; ---- Predicated integer ternary operations
5236 ;; -------------------------------------------------------------------------------
5238 ;; - 11.13 Vector Single-Width Integer Multiply-Add Instructions
5239 ;; -------------------------------------------------------------------------------
5241 (define_expand "@pred_mul_plus<mode>"
5242 [(set (match_operand:V_VLSI 0 "register_operand")
5243 (if_then_else:V_VLSI
5245 [(match_operand:<VM> 1 "vector_mask_operand")
5246 (match_operand 6 "vector_length_operand")
5247 (match_operand 7 "const_int_operand")
5248 (match_operand 8 "const_int_operand")
5249 (match_operand 9 "const_int_operand")
5251 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5254 (match_operand:V_VLSI 2 "register_operand")
5255 (match_operand:V_VLSI 3 "register_operand"))
5256 (match_operand:V_VLSI 4 "register_operand"))
5257 (match_operand:V_VLSI 5 "vector_merge_operand")))]
5260 riscv_vector::prepare_ternary_operands (operands);
5263 (define_insn "*pred_mul_plus<mode>_undef"
5264 [(set (match_operand:V_VLSI 0 "register_operand" "=vd, vd,?&vd, vr, vr,?&vr")
5265 (if_then_else:V_VLSI
5267 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm, vm,Wc1,Wc1, Wc1")
5268 (match_operand 6 "vector_length_operand" " rK, rK, rK, rK, rK, rK")
5269 (match_operand 7 "const_int_operand" " i, i, i, i, i, i")
5270 (match_operand 8 "const_int_operand" " i, i, i, i, i, i")
5271 (match_operand 9 "const_int_operand" " i, i, i, i, i, i")
5273 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5276 (match_operand:V_VLSI 3 "register_operand" " 0, vr, vr, 0, vr, vr")
5277 (match_operand:V_VLSI 4 "register_operand" " vr, vr, vr, vr, vr, vr"))
5278 (match_operand:V_VLSI 5 "register_operand" " vr, 0, vr, vr, 0, vr"))
5279 (match_operand:V_VLSI 2 "vector_undef_operand")))]
5282 vmadd.vv\t%0,%4,%5%p1
5283 vmacc.vv\t%0,%3,%4%p1
5284 vmv.v.v\t%0,%4\;vmacc.vv\t%0,%3,%4%p1
5285 vmadd.vv\t%0,%4,%5%p1
5286 vmacc.vv\t%0,%3,%4%p1
5287 vmv.v.v\t%0,%5\;vmacc.vv\t%0,%3,%4%p1"
5288 [(set_attr "type" "vimuladd")
5289 (set_attr "mode" "<MODE>")])
5291 (define_insn "*pred_madd<mode>"
5292 [(set (match_operand:V_VLSI 0 "register_operand" "=vd,?&vd, vr,?&vr")
5293 (if_then_else:V_VLSI
5295 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1")
5296 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
5297 (match_operand 6 "const_int_operand" " i, i, i, i")
5298 (match_operand 7 "const_int_operand" " i, i, i, i")
5299 (match_operand 8 "const_int_operand" " i, i, i, i")
5301 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5304 (match_operand:V_VLSI 2 "register_operand" " 0, vr, 0, vr")
5305 (match_operand:V_VLSI 3 "register_operand" " vr, vr, vr, vr"))
5306 (match_operand:V_VLSI 4 "register_operand" " vr, vr, vr, vr"))
5310 vmadd.vv\t%0,%3,%4%p1
5311 vmv.v.v\t%0,%2\;vmadd.vv\t%0,%3,%4%p1
5312 vmadd.vv\t%0,%3,%4%p1
5313 vmv.v.v\t%0,%2\;vmadd.vv\t%0,%3,%4%p1"
5314 [(set_attr "type" "vimuladd")
5315 (set_attr "mode" "<MODE>")
5316 (set_attr "merge_op_idx" "4")
5317 (set_attr "vl_op_idx" "5")
5318 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[6])"))
5319 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[7])"))
5320 (set (attr "avl_type_idx") (const_int 8))])
5322 (define_insn "*pred_macc<mode>"
5323 [(set (match_operand:V_VLSI 0 "register_operand" "=vd,?&vd, vr,?&vr")
5324 (if_then_else:V_VLSI
5326 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1")
5327 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
5328 (match_operand 6 "const_int_operand" " i, i, i, i")
5329 (match_operand 7 "const_int_operand" " i, i, i, i")
5330 (match_operand 8 "const_int_operand" " i, i, i, i")
5332 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5335 (match_operand:V_VLSI 2 "register_operand" " vr, vr, vr, vr")
5336 (match_operand:V_VLSI 3 "register_operand" " vr, vr, vr, vr"))
5337 (match_operand:V_VLSI 4 "register_operand" " 0, vr, 0, vr"))
5341 vmacc.vv\t%0,%2,%3%p1
5342 vmv.v.v\t%0,%4\;vmacc.vv\t%0,%2,%3%p1
5343 vmacc.vv\t%0,%2,%3%p1
5344 vmv.v.v\t%0,%4\;vmacc.vv\t%0,%2,%3%p1"
5345 [(set_attr "type" "vimuladd")
5346 (set_attr "mode" "<MODE>")
5347 (set_attr "merge_op_idx" "2")
5348 (set_attr "vl_op_idx" "5")
5349 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[6])"))
5350 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[7])"))
5351 (set (attr "avl_type_idx") (const_int 8))])
5353 (define_expand "@pred_mul_plus<mode>_scalar"
5354 [(set (match_operand:V_VLSI_QHS 0 "register_operand")
5355 (if_then_else:V_VLSI_QHS
5357 [(match_operand:<VM> 1 "vector_mask_operand")
5358 (match_operand 6 "vector_length_operand")
5359 (match_operand 7 "const_int_operand")
5360 (match_operand 8 "const_int_operand")
5361 (match_operand 9 "const_int_operand")
5363 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5366 (vec_duplicate:V_VLSI_QHS
5367 (match_operand:<VEL> 2 "register_operand"))
5368 (match_operand:V_VLSI_QHS 3 "register_operand"))
5369 (match_operand:V_VLSI_QHS 4 "register_operand"))
5370 (match_operand:V_VLSI_QHS 5 "register_operand")))]
5374 (define_insn "*pred_madd<mode>_scalar"
5375 [(set (match_operand:V_VLSI 0 "register_operand" "=vd,?&vd, vr,?&vr")
5376 (if_then_else:V_VLSI
5378 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1")
5379 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
5380 (match_operand 6 "const_int_operand" " i, i, i, i")
5381 (match_operand 7 "const_int_operand" " i, i, i, i")
5382 (match_operand 8 "const_int_operand" " i, i, i, i")
5384 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5387 (vec_duplicate:V_VLSI
5388 (match_operand:<VEL> 2 "register_operand" " r, r, r, r"))
5389 (match_operand:V_VLSI 3 "register_operand" " 0, vr, 0, vr"))
5390 (match_operand:V_VLSI 4 "register_operand" " vr, vr, vr, vr"))
5394 vmadd.vx\t%0,%2,%4%p1
5395 vmv.v.v\t%0,%3\;vmadd.vx\t%0,%2,%4%p1
5396 vmadd.vx\t%0,%2,%4%p1
5397 vmv.v.v\t%0,%3\;vmadd.vx\t%0,%2,%4%p1"
5398 [(set_attr "type" "vimuladd")
5399 (set_attr "mode" "<MODE>")
5400 (set_attr "merge_op_idx" "4")
5401 (set_attr "vl_op_idx" "5")
5402 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[6])"))
5403 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[7])"))
5404 (set (attr "avl_type_idx") (const_int 8))])
5406 (define_insn "*pred_macc<mode>_scalar"
5407 [(set (match_operand:V_VLSI 0 "register_operand" "=vd,?&vd, vr,?&vr")
5408 (if_then_else:V_VLSI
5410 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1")
5411 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
5412 (match_operand 6 "const_int_operand" " i, i, i, i")
5413 (match_operand 7 "const_int_operand" " i, i, i, i")
5414 (match_operand 8 "const_int_operand" " i, i, i, i")
5416 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5419 (vec_duplicate:V_VLSI
5420 (match_operand:<VEL> 2 "register_operand" " r, r, r, r"))
5421 (match_operand:V_VLSI 3 "register_operand" " vr, vr, vr, vr"))
5422 (match_operand:V_VLSI 4 "register_operand" " 0, vr, 0, vr"))
5426 vmacc.vx\t%0,%2,%3%p1
5427 vmv.v.v\t%0,%4\;vmacc.vx\t%0,%2,%3%p1
5428 vmacc.vx\t%0,%2,%3%p1
5429 vmv.v.v\t%0,%4\;vmacc.vx\t%0,%2,%3%p1"
5430 [(set_attr "type" "vimuladd")
5431 (set_attr "mode" "<MODE>")
5432 (set_attr "merge_op_idx" "2")
5433 (set_attr "vl_op_idx" "5")
5434 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[6])"))
5435 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[7])"))
5436 (set (attr "avl_type_idx") (const_int 8))])
5438 (define_expand "@pred_mul_plus<mode>_scalar"
5439 [(set (match_operand:V_VLSI_D 0 "register_operand")
5440 (if_then_else:V_VLSI_D
5442 [(match_operand:<VM> 1 "vector_mask_operand")
5443 (match_operand 6 "vector_length_operand")
5444 (match_operand 7 "const_int_operand")
5445 (match_operand 8 "const_int_operand")
5446 (match_operand 9 "const_int_operand")
5448 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5451 (vec_duplicate:V_VLSI_D
5452 (match_operand:<VEL> 2 "reg_or_int_operand"))
5453 (match_operand:V_VLSI_D 3 "register_operand"))
5454 (match_operand:V_VLSI_D 4 "register_operand"))
5455 (match_operand:V_VLSI_D 5 "register_operand")))]
5458 if (riscv_vector::sew64_scalar_helper (
5460 /* scalar op */&operands[2],
5461 /* vl */operands[6],
5464 [] (rtx *operands, rtx boardcast_scalar) {
5465 emit_insn (gen_pred_mul_plus<mode> (operands[0], operands[1],
5466 boardcast_scalar, operands[3], operands[4], operands[5],
5467 operands[6], operands[7], operands[8], operands[9]));
5469 (riscv_vector::avl_type) INTVAL (operands[9])))
5473 (define_insn "*pred_madd<mode>_extended_scalar"
5474 [(set (match_operand:V_VLSI_D 0 "register_operand" "=vd,?&vd, vr,?&vr")
5475 (if_then_else:V_VLSI_D
5477 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1")
5478 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
5479 (match_operand 6 "const_int_operand" " i, i, i, i")
5480 (match_operand 7 "const_int_operand" " i, i, i, i")
5481 (match_operand 8 "const_int_operand" " i, i, i, i")
5483 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5486 (vec_duplicate:V_VLSI_D
5488 (match_operand:<VSUBEL> 2 "register_operand" " r, r, r, r")))
5489 (match_operand:V_VLSI_D 3 "register_operand" " 0, vr, 0, vr"))
5490 (match_operand:V_VLSI_D 4 "register_operand" " vr, vr, vr, vr"))
5492 "TARGET_VECTOR && !TARGET_64BIT"
5494 vmadd.vx\t%0,%2,%4%p1
5495 vmv.v.v\t%0,%2\;vmadd.vx\t%0,%2,%4%p1
5496 vmadd.vx\t%0,%2,%4%p1
5497 vmv.v.v\t%0,%2\;vmadd.vx\t%0,%2,%4%p1"
5498 [(set_attr "type" "vimuladd")
5499 (set_attr "mode" "<MODE>")
5500 (set_attr "merge_op_idx" "4")
5501 (set_attr "vl_op_idx" "5")
5502 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[6])"))
5503 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[7])"))
5504 (set (attr "avl_type_idx") (const_int 8))])
5506 (define_insn "*pred_macc<mode>_extended_scalar"
5507 [(set (match_operand:V_VLSI_D 0 "register_operand" "=vd,?&vd, vr,?&vr")
5508 (if_then_else:V_VLSI_D
5510 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1")
5511 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
5512 (match_operand 6 "const_int_operand" " i, i, i, i")
5513 (match_operand 7 "const_int_operand" " i, i, i, i")
5514 (match_operand 8 "const_int_operand" " i, i, i, i")
5516 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5519 (vec_duplicate:V_VLSI_D
5521 (match_operand:<VSUBEL> 2 "register_operand" " r, r, r, r")))
5522 (match_operand:V_VLSI_D 3 "register_operand" " vr, vr, vr, vr"))
5523 (match_operand:V_VLSI_D 4 "register_operand" " 0, vr, 0, vr"))
5525 "TARGET_VECTOR && !TARGET_64BIT"
5527 vmacc.vx\t%0,%2,%3%p1
5528 vmv.v.v\t%0,%4\;vmacc.vx\t%0,%2,%3%p1
5529 vmacc.vx\t%0,%2,%3%p1
5530 vmv.v.v\t%0,%4\;vmacc.vx\t%0,%2,%3%p1"
5531 [(set_attr "type" "vimuladd")
5532 (set_attr "mode" "<MODE>")
5533 (set_attr "merge_op_idx" "2")
5534 (set_attr "vl_op_idx" "5")
5535 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[6])"))
5536 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[7])"))
5537 (set (attr "avl_type_idx") (const_int 8))])
5539 (define_expand "@pred_minus_mul<mode>"
5540 [(set (match_operand:V_VLSI 0 "register_operand")
5541 (if_then_else:V_VLSI
5543 [(match_operand:<VM> 1 "vector_mask_operand")
5544 (match_operand 6 "vector_length_operand")
5545 (match_operand 7 "const_int_operand")
5546 (match_operand 8 "const_int_operand")
5547 (match_operand 9 "const_int_operand")
5549 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5551 (match_operand:V_VLSI 4 "register_operand")
5553 (match_operand:V_VLSI 2 "register_operand")
5554 (match_operand:V_VLSI 3 "register_operand")))
5555 (match_operand:V_VLSI 5 "vector_merge_operand")))]
5558 riscv_vector::prepare_ternary_operands (operands);
5561 (define_insn "*pred_minus_mul<mode>_undef"
5562 [(set (match_operand:V_VLSI 0 "register_operand" "=vd, vd,?&vd, vr, vr,?&vr")
5563 (if_then_else:V_VLSI
5565 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm, vm,Wc1,Wc1, Wc1")
5566 (match_operand 6 "vector_length_operand" " rK, rK, rK, rK, rK, rK")
5567 (match_operand 7 "const_int_operand" " i, i, i, i, i, i")
5568 (match_operand 8 "const_int_operand" " i, i, i, i, i, i")
5569 (match_operand 9 "const_int_operand" " i, i, i, i, i, i")
5571 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5573 (match_operand:V_VLSI 5 "register_operand" " vr, 0, vr, vr, 0, vr")
5575 (match_operand:V_VLSI 3 "register_operand" " 0, vr, vr, 0, vr, vr")
5576 (match_operand:V_VLSI 4 "register_operand" " vr, vr, vr, vr, vr, vr")))
5577 (match_operand:V_VLSI 2 "vector_undef_operand")))]
5580 vnmsub.vv\t%0,%4,%5%p1
5581 vnmsac.vv\t%0,%3,%4%p1
5582 vmv.v.v\t%0,%3\;vnmsub.vv\t%0,%4,%5%p1
5583 vnmsub.vv\t%0,%4,%5%p1
5584 vnmsac.vv\t%0,%3,%4%p1
5585 vmv.v.v\t%0,%3\;vnmsub.vv\t%0,%4,%5%p1"
5586 [(set_attr "type" "vimuladd")
5587 (set_attr "mode" "<MODE>")])
5589 (define_insn "*pred_nmsub<mode>"
5590 [(set (match_operand:V_VLSI 0 "register_operand" "=vd,?&vd, vr,?&vr")
5591 (if_then_else:V_VLSI
5593 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1")
5594 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
5595 (match_operand 6 "const_int_operand" " i, i, i, i")
5596 (match_operand 7 "const_int_operand" " i, i, i, i")
5597 (match_operand 8 "const_int_operand" " i, i, i, i")
5599 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5601 (match_operand:V_VLSI 4 "register_operand" " vr, vr, vr, vr")
5603 (match_operand:V_VLSI 2 "register_operand" " 0, vr, 0, vr")
5604 (match_operand:V_VLSI 3 "register_operand" " vr, vr, vr, vr")))
5608 vnmsub.vv\t%0,%3,%4%p1
5609 vmv.v.v\t%0,%2\;vnmsub.vv\t%0,%3,%4%p1
5610 vnmsub.vv\t%0,%3,%4%p1
5611 vmv.v.v\t%0,%2\;vnmsub.vv\t%0,%3,%4%p1"
5612 [(set_attr "type" "vimuladd")
5613 (set_attr "mode" "<MODE>")
5614 (set_attr "merge_op_idx" "4")
5615 (set_attr "vl_op_idx" "5")
5616 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[6])"))
5617 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[7])"))
5618 (set (attr "avl_type_idx") (const_int 8))])
5620 (define_insn "*pred_nmsac<mode>"
5621 [(set (match_operand:V_VLSI 0 "register_operand" "=vd,?&vd, vr,?&vr")
5622 (if_then_else:V_VLSI
5624 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1")
5625 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
5626 (match_operand 6 "const_int_operand" " i, i, i, i")
5627 (match_operand 7 "const_int_operand" " i, i, i, i")
5628 (match_operand 8 "const_int_operand" " i, i, i, i")
5630 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5632 (match_operand:V_VLSI 4 "register_operand" " 0, vr, 0, vr")
5634 (match_operand:V_VLSI 2 "register_operand" " vr, vr, vr, vr")
5635 (match_operand:V_VLSI 3 "register_operand" " vr, vr, vr, vr")))
5639 vnmsac.vv\t%0,%2,%3%p1
5640 vmv.v.v\t%0,%4\;vnmsac.vv\t%0,%2,%3%p1
5641 vnmsac.vv\t%0,%2,%3%p1
5642 vmv.v.v\t%0,%4\;vnmsac.vv\t%0,%2,%3%p1"
5643 [(set_attr "type" "vimuladd")
5644 (set_attr "mode" "<MODE>")
5645 (set_attr "merge_op_idx" "2")
5646 (set_attr "vl_op_idx" "5")
5647 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[6])"))
5648 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[7])"))
5649 (set (attr "avl_type_idx") (const_int 8))])
5651 (define_expand "@pred_minus_mul<mode>_scalar"
5652 [(set (match_operand:V_VLSI_QHS 0 "register_operand")
5653 (if_then_else:V_VLSI_QHS
5655 [(match_operand:<VM> 1 "vector_mask_operand")
5656 (match_operand 6 "vector_length_operand")
5657 (match_operand 7 "const_int_operand")
5658 (match_operand 8 "const_int_operand")
5659 (match_operand 9 "const_int_operand")
5661 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5663 (match_operand:V_VLSI_QHS 4 "register_operand")
5665 (vec_duplicate:V_VLSI_QHS
5666 (match_operand:<VEL> 2 "register_operand"))
5667 (match_operand:V_VLSI_QHS 3 "register_operand")))
5668 (match_operand:V_VLSI_QHS 5 "register_operand")))]
5672 (define_insn "*pred_nmsub<mode>_scalar"
5673 [(set (match_operand:V_VLSI 0 "register_operand" "=vd,?&vd, vr,?&vr")
5674 (if_then_else:V_VLSI
5676 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1")
5677 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
5678 (match_operand 6 "const_int_operand" " i, i, i, i")
5679 (match_operand 7 "const_int_operand" " i, i, i, i")
5680 (match_operand 8 "const_int_operand" " i, i, i, i")
5682 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5684 (match_operand:V_VLSI 4 "register_operand" " vr, vr, vr, vr")
5686 (vec_duplicate:V_VLSI
5687 (match_operand:<VEL> 2 "register_operand" " r, r, r, r"))
5688 (match_operand:V_VLSI 3 "register_operand" " 0, vr, 0, vr")))
5692 vnmsub.vx\t%0,%2,%4%p1
5693 vmv.v.v\t%0,%3\;vnmsub.vx\t%0,%2,%4%p1
5694 vnmsub.vx\t%0,%2,%4%p1
5695 vmv.v.v\t%0,%3\;vnmsub.vx\t%0,%2,%4%p1"
5696 [(set_attr "type" "vimuladd")
5697 (set_attr "mode" "<MODE>")
5698 (set_attr "merge_op_idx" "4")
5699 (set_attr "vl_op_idx" "5")
5700 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[6])"))
5701 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[7])"))
5702 (set (attr "avl_type_idx") (const_int 8))])
5704 (define_insn "*pred_nmsac<mode>_scalar"
5705 [(set (match_operand:V_VLSI 0 "register_operand" "=vd,?&vd, vr,?&vr")
5706 (if_then_else:V_VLSI
5708 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1")
5709 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
5710 (match_operand 6 "const_int_operand" " i, i, i, i")
5711 (match_operand 7 "const_int_operand" " i, i, i, i")
5712 (match_operand 8 "const_int_operand" " i, i, i, i")
5714 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5716 (match_operand:V_VLSI 4 "register_operand" " 0, vr, 0, vr")
5718 (vec_duplicate:V_VLSI
5719 (match_operand:<VEL> 2 "register_operand" " r, r, r, r"))
5720 (match_operand:V_VLSI 3 "register_operand" " vr, vr, vr, vr")))
5724 vnmsac.vx\t%0,%2,%3%p1
5725 vmv.v.v\t%0,%4\;vnmsac.vx\t%0,%2,%3%p1
5726 vnmsac.vx\t%0,%2,%3%p1
5727 vmv.v.v\t%0,%4\;vnmsac.vx\t%0,%2,%3%p1"
5728 [(set_attr "type" "vimuladd")
5729 (set_attr "mode" "<MODE>")
5730 (set_attr "merge_op_idx" "2")
5731 (set_attr "vl_op_idx" "5")
5732 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[6])"))
5733 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[7])"))
5734 (set (attr "avl_type_idx") (const_int 8))])
5736 (define_expand "@pred_minus_mul<mode>_scalar"
5737 [(set (match_operand:V_VLSI_D 0 "register_operand")
5738 (if_then_else:V_VLSI_D
5740 [(match_operand:<VM> 1 "vector_mask_operand")
5741 (match_operand 6 "vector_length_operand")
5742 (match_operand 7 "const_int_operand")
5743 (match_operand 8 "const_int_operand")
5744 (match_operand 9 "const_int_operand")
5746 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5748 (match_operand:V_VLSI_D 4 "register_operand")
5750 (vec_duplicate:V_VLSI_D
5751 (match_operand:<VEL> 2 "reg_or_int_operand"))
5752 (match_operand:V_VLSI_D 3 "register_operand")))
5753 (match_operand:V_VLSI_D 5 "register_operand")))]
5756 if (riscv_vector::sew64_scalar_helper (
5758 /* scalar op */&operands[2],
5759 /* vl */operands[6],
5762 [] (rtx *operands, rtx boardcast_scalar) {
5763 emit_insn (gen_pred_minus_mul<mode> (operands[0], operands[1],
5764 boardcast_scalar, operands[3], operands[4], operands[5],
5765 operands[6], operands[7], operands[8], operands[9]));
5767 (riscv_vector::avl_type) INTVAL (operands[9])))
5771 (define_insn "*pred_nmsub<mode>_extended_scalar"
5772 [(set (match_operand:V_VLSI_D 0 "register_operand" "=vd,?&vd, vr,?&vr")
5773 (if_then_else:V_VLSI_D
5775 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1")
5776 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
5777 (match_operand 6 "const_int_operand" " i, i, i, i")
5778 (match_operand 7 "const_int_operand" " i, i, i, i")
5779 (match_operand 8 "const_int_operand" " i, i, i, i")
5781 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5783 (match_operand:V_VLSI_D 4 "register_operand" " vr, vr, vr, vr")
5785 (vec_duplicate:V_VLSI_D
5787 (match_operand:<VSUBEL> 2 "register_operand" " r, r, r, r")))
5788 (match_operand:V_VLSI_D 3 "register_operand" " 0, vr, 0, vr")))
5790 "TARGET_VECTOR && !TARGET_64BIT"
5792 vnmsub.vx\t%0,%2,%4%p1
5793 vmv.v.v\t%0,%3\;vnmsub.vx\t%0,%2,%4%p1
5794 vnmsub.vx\t%0,%2,%4%p1
5795 vmv.v.v\t%0,%3\;vnmsub.vx\t%0,%2,%4%p1"
5796 [(set_attr "type" "vimuladd")
5797 (set_attr "mode" "<MODE>")
5798 (set_attr "merge_op_idx" "4")
5799 (set_attr "vl_op_idx" "5")
5800 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[6])"))
5801 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[7])"))
5802 (set (attr "avl_type_idx") (const_int 8))])
5804 (define_insn "*pred_nmsac<mode>_extended_scalar"
5805 [(set (match_operand:V_VLSI_D 0 "register_operand" "=vd,?&vd, vr,?&vr")
5806 (if_then_else:V_VLSI_D
5808 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1")
5809 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
5810 (match_operand 6 "const_int_operand" " i, i, i, i")
5811 (match_operand 7 "const_int_operand" " i, i, i, i")
5812 (match_operand 8 "const_int_operand" " i, i, i, i")
5814 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5816 (match_operand:V_VLSI_D 4 "register_operand" " 0, vr, 0, vr")
5818 (vec_duplicate:V_VLSI_D
5820 (match_operand:<VSUBEL> 2 "register_operand" " r, r, r, r")))
5821 (match_operand:V_VLSI_D 3 "register_operand" " vr, vr, vr, vr")))
5823 "TARGET_VECTOR && !TARGET_64BIT"
5825 vnmsac.vx\t%0,%2,%3%p1
5826 vmv.v.v\t%0,%4\;vnmsac.vx\t%0,%2,%3%p1
5827 vnmsac.vx\t%0,%2,%3%p1
5828 vmv.v.v\t%0,%4\;vnmsac.vx\t%0,%2,%3%p1"
5829 [(set_attr "type" "vimuladd")
5830 (set_attr "mode" "<MODE>")
5831 (set_attr "merge_op_idx" "2")
5832 (set_attr "vl_op_idx" "5")
5833 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[6])"))
5834 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[7])"))
5835 (set (attr "avl_type_idx") (const_int 8))])
5837 ;; -------------------------------------------------------------------------------
5838 ;; ---- Predicated widen integer ternary operations
5839 ;; -------------------------------------------------------------------------------
5841 ;; - 11.14 Vector Widening Integer Multiply-Add Instructions
5842 ;; -------------------------------------------------------------------------------
5844 (define_insn "@pred_widen_mul_plus<su><mode>"
5845 [(set (match_operand:VWEXTI 0 "register_operand" "=&vr")
5846 (if_then_else:VWEXTI
5848 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1")
5849 (match_operand 5 "vector_length_operand" " rK")
5850 (match_operand 6 "const_int_operand" " i")
5851 (match_operand 7 "const_int_operand" " i")
5852 (match_operand 8 "const_int_operand" " i")
5854 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5858 (match_operand:<V_DOUBLE_TRUNC> 3 "register_operand" " vr"))
5860 (match_operand:<V_DOUBLE_TRUNC> 4 "register_operand" " vr")))
5861 (match_operand:VWEXTI 2 "register_operand" " 0"))
5864 "vwmacc<u>.vv\t%0,%3,%4%p1"
5865 [(set_attr "type" "viwmuladd")
5866 (set_attr "mode" "<V_DOUBLE_TRUNC>")])
5868 (define_insn "@pred_widen_mul_plus<su><mode>_scalar"
5869 [(set (match_operand:VWEXTI 0 "register_operand" "=vd, vr, vd, vr, vd, vr, ?&vr")
5870 (if_then_else:VWEXTI
5872 [(match_operand:<VM> 1 "vector_mask_operand" " vm,Wc1, vm,Wc1, vm,Wc1,vmWc1")
5873 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK")
5874 (match_operand 6 "const_int_operand" " i, i, i, i, i, i, i")
5875 (match_operand 7 "const_int_operand" " i, i, i, i, i, i, i")
5876 (match_operand 8 "const_int_operand" " i, i, i, i, i, i, i")
5878 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5882 (vec_duplicate:<V_DOUBLE_TRUNC>
5883 (match_operand:<VSUBEL> 3 "reg_or_0_operand" " rJ, rJ, rJ, rJ, rJ, rJ, rJ")))
5885 (match_operand:<V_DOUBLE_TRUNC> 4 "register_operand" "W21,W21,W42,W42,W84,W84, vr")))
5886 (match_operand:VWEXTI 2 "register_operand" " 0, 0, 0, 0, 0, 0, 0"))
5889 "vwmacc<u>.vx\t%0,%z3,%4%p1"
5890 [(set_attr "type" "viwmuladd")
5891 (set_attr "mode" "<V_DOUBLE_TRUNC>")
5892 (set_attr "group_overlap" "W21,W21,W42,W42,W84,W84,none")])
5894 (define_insn "@pred_widen_mul_plussu<mode>"
5895 [(set (match_operand:VWEXTI 0 "register_operand" "=&vr")
5896 (if_then_else:VWEXTI
5898 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1")
5899 (match_operand 5 "vector_length_operand" " rK")
5900 (match_operand 6 "const_int_operand" " i")
5901 (match_operand 7 "const_int_operand" " i")
5902 (match_operand 8 "const_int_operand" " i")
5904 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5908 (match_operand:<V_DOUBLE_TRUNC> 3 "register_operand" " vr"))
5910 (match_operand:<V_DOUBLE_TRUNC> 4 "register_operand" " vr")))
5911 (match_operand:VWEXTI 2 "register_operand" " 0"))
5914 "vwmaccsu.vv\t%0,%3,%4%p1"
5915 [(set_attr "type" "viwmuladd")
5916 (set_attr "mode" "<V_DOUBLE_TRUNC>")])
5918 (define_insn "@pred_widen_mul_plussu<mode>_scalar"
5919 [(set (match_operand:VWEXTI 0 "register_operand" "=vd, vr, vd, vr, vd, vr, ?&vr")
5920 (if_then_else:VWEXTI
5922 [(match_operand:<VM> 1 "vector_mask_operand" " vm,Wc1, vm,Wc1, vm,Wc1,vmWc1")
5923 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK")
5924 (match_operand 6 "const_int_operand" " i, i, i, i, i, i, i")
5925 (match_operand 7 "const_int_operand" " i, i, i, i, i, i, i")
5926 (match_operand 8 "const_int_operand" " i, i, i, i, i, i, i")
5928 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5932 (vec_duplicate:<V_DOUBLE_TRUNC>
5933 (match_operand:<VSUBEL> 3 "reg_or_0_operand" " rJ, rJ, rJ, rJ, rJ, rJ, rJ")))
5935 (match_operand:<V_DOUBLE_TRUNC> 4 "register_operand" "W21,W21,W42,W42,W84,W84, vr")))
5936 (match_operand:VWEXTI 2 "register_operand" " 0, 0, 0, 0, 0, 0, 0"))
5939 "vwmaccsu.vx\t%0,%z3,%4%p1"
5940 [(set_attr "type" "viwmuladd")
5941 (set_attr "mode" "<V_DOUBLE_TRUNC>")
5942 (set_attr "group_overlap" "W21,W21,W42,W42,W84,W84,none")])
5944 (define_insn "@pred_widen_mul_plusus<mode>_scalar"
5945 [(set (match_operand:VWEXTI 0 "register_operand" "=vd, vr, vd, vr, vd, vr, ?&vr")
5946 (if_then_else:VWEXTI
5948 [(match_operand:<VM> 1 "vector_mask_operand" " vm,Wc1, vm,Wc1, vm,Wc1,vmWc1")
5949 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK")
5950 (match_operand 6 "const_int_operand" " i, i, i, i, i, i, i")
5951 (match_operand 7 "const_int_operand" " i, i, i, i, i, i, i")
5952 (match_operand 8 "const_int_operand" " i, i, i, i, i, i, i")
5954 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5958 (vec_duplicate:<V_DOUBLE_TRUNC>
5959 (match_operand:<VSUBEL> 3 "reg_or_0_operand" " rJ, rJ, rJ, rJ, rJ, rJ, rJ")))
5961 (match_operand:<V_DOUBLE_TRUNC> 4 "register_operand" "W21,W21,W42,W42,W84,W84, vr")))
5962 (match_operand:VWEXTI 2 "register_operand" " 0, 0, 0, 0, 0, 0, 0"))
5965 "vwmaccus.vx\t%0,%z3,%4%p1"
5966 [(set_attr "type" "viwmuladd")
5967 (set_attr "mode" "<V_DOUBLE_TRUNC>")
5968 (set_attr "group_overlap" "W21,W21,W42,W42,W84,W84,none")])
5970 ;; -------------------------------------------------------------------------------
5971 ;; ---- Predicated BOOL mask operations
5972 ;; -------------------------------------------------------------------------------
5974 ;; - 15.1 Vector Mask-Register Logical Instructions
5975 ;; - 15.2 Vector count population in mask vcpop.m
5976 ;; - 15.3 vfirst find-first-set mask bit
5977 ;; - 15.4 vmsbf.m set-before-first mask bit
5978 ;; - 15.5 vmsif.m set-including-first mask bit
5979 ;; - 15.6 vmsof.m set-only-first mask bit
5980 ;; - 15.8 Vector Iota Instruction
5981 ;; - 15.9 Vector Element Index Instruction
5982 ;; -------------------------------------------------------------------------------
5984 ;; We keep this pattern same as pred_mov so that we can gain more optimizations.
5985 ;; For example, if we have vmxor.mm v1,v1,v1. It will be optmized as vmclr.m which
5986 ;; is generated by pred_mov.
5987 (define_insn "@pred_<optab><mode>"
5988 [(set (match_operand:VB_VLS 0 "register_operand" "=vr")
5989 (if_then_else:VB_VLS
5991 [(match_operand:VB_VLS 1 "vector_all_trues_mask_operand" "Wc1")
5992 (match_operand 5 "vector_length_operand" " rK")
5993 (match_operand 6 "const_int_operand" " i")
5995 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
5997 (match_operand:VB_VLS 3 "register_operand" " vr")
5998 (match_operand:VB_VLS 4 "register_operand" " vr"))
5999 (match_operand:VB_VLS 2 "vector_undef_operand" " vu")))]
6001 "vm<insn>.mm\t%0,%3,%4"
6002 [(set_attr "type" "vmalu")
6003 (set_attr "mode" "<MODE>")
6004 (set_attr "vl_op_idx" "5")
6005 (set (attr "avl_type_idx") (const_int 6))])
6007 (define_insn "@pred_n<optab><mode>"
6008 [(set (match_operand:VB_VLS 0 "register_operand" "=vr")
6009 (if_then_else:VB_VLS
6011 [(match_operand:VB_VLS 1 "vector_all_trues_mask_operand" "Wc1")
6012 (match_operand 5 "vector_length_operand" " rK")
6013 (match_operand 6 "const_int_operand" " i")
6015 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
6018 (match_operand:VB_VLS 3 "register_operand" " vr")
6019 (match_operand:VB_VLS 4 "register_operand" " vr")))
6020 (match_operand:VB_VLS 2 "vector_undef_operand" " vu")))]
6022 "vm<ninsn>.mm\t%0,%3,%4"
6023 [(set_attr "type" "vmalu")
6024 (set_attr "mode" "<MODE>")
6025 (set_attr "vl_op_idx" "5")
6026 (set (attr "avl_type_idx") (const_int 6))])
6028 (define_insn "@pred_<optab>not<mode>"
6029 [(set (match_operand:VB_VLS 0 "register_operand" "=vr")
6030 (if_then_else:VB_VLS
6032 [(match_operand:VB_VLS 1 "vector_all_trues_mask_operand" "Wc1")
6033 (match_operand 5 "vector_length_operand" " rK")
6034 (match_operand 6 "const_int_operand" " i")
6036 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
6038 (match_operand:VB_VLS 3 "register_operand" " vr")
6040 (match_operand:VB_VLS 4 "register_operand" " vr")))
6041 (match_operand:VB_VLS 2 "vector_undef_operand" " vu")))]
6043 "vm<insn>n.mm\t%0,%3,%4"
6044 [(set_attr "type" "vmalu")
6045 (set_attr "mode" "<MODE>")
6046 (set_attr "vl_op_idx" "5")
6047 (set (attr "avl_type_idx") (const_int 6))])
6049 (define_insn "@pred_not<mode>"
6050 [(set (match_operand:VB_VLS 0 "register_operand" "=vr")
6051 (if_then_else:VB_VLS
6053 [(match_operand:VB_VLS 1 "vector_all_trues_mask_operand" "Wc1")
6054 (match_operand 4 "vector_length_operand" " rK")
6055 (match_operand 5 "const_int_operand" " i")
6057 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
6059 (match_operand:VB_VLS 3 "register_operand" " vr"))
6060 (match_operand:VB_VLS 2 "vector_undef_operand" " vu")))]
6063 [(set_attr "type" "vmalu")
6064 (set_attr "mode" "<MODE>")
6065 (set_attr "vl_op_idx" "4")
6066 (set (attr "avl_type_idx") (const_int 5))])
6068 (define_insn "@pred_popcount<VB:mode><P:mode>"
6069 [(set (match_operand:P 0 "register_operand" "=r")
6073 (match_operand:VB 1 "vector_mask_operand" "vmWc1")
6074 (match_operand:VB 2 "register_operand" " vr"))
6075 (match_operand 3 "vector_length_operand" " rK")
6076 (match_operand 4 "const_int_operand" " i")
6078 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)))]
6081 [(set_attr "type" "vmpop")
6082 (set_attr "mode" "<VB:MODE>")])
6084 (define_insn "@pred_ffs<VB:mode><P:mode>"
6085 [(set (match_operand:P 0 "register_operand" "=r")
6090 (match_operand:VB 1 "vector_mask_operand" "vmWc1")
6091 (match_operand:VB 2 "register_operand" " vr"))
6092 (match_operand 3 "vector_length_operand" " rK")
6093 (match_operand 4 "const_int_operand" " i")
6095 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE))
6098 "vfirst.m\t%0,%2%p1"
6099 [(set_attr "type" "vmffs")
6100 (set_attr "mode" "<VB:MODE>")])
6102 (define_insn "@pred_<misc_op><mode>"
6103 [(set (match_operand:VB 0 "register_operand" "=&vr, &vr")
6106 [(match_operand:VB 1 "vector_mask_operand" "vmWc1,vmWc1")
6107 (match_operand 4 "vector_length_operand" " rK, rK")
6108 (match_operand 5 "const_int_operand" " i, i")
6109 (match_operand 6 "const_int_operand" " i, i")
6111 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
6113 [(match_operand:VB 3 "register_operand" " vr, vr")] VMISC)
6114 (match_operand:VB 2 "vector_merge_operand" " vu, 0")))]
6116 "vm<misc_op>.m\t%0,%3%p1"
6117 [(set_attr "type" "vmsfs")
6118 (set_attr "mode" "<MODE>")])
6120 (define_insn "@pred_iota<mode>"
6121 [(set (match_operand:VI 0 "register_operand" "=&vr, &vr")
6124 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
6125 (match_operand 4 "vector_length_operand" " rK, rK")
6126 (match_operand 5 "const_int_operand" " i, i")
6127 (match_operand 6 "const_int_operand" " i, i")
6128 (match_operand 7 "const_int_operand" " i, i")
6130 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
6132 [(match_operand:<VM> 3 "register_operand" " vr, vr")] UNSPEC_VIOTA)
6133 (match_operand:VI 2 "vector_merge_operand" " vu, 0")))]
6136 [(set_attr "type" "vmiota")
6137 (set_attr "mode" "<MODE>")])
6139 (define_insn "@pred_series<mode>"
6140 [(set (match_operand:V_VLSI 0 "register_operand" "=vd, vd, vr, vr")
6141 (if_then_else:V_VLSI
6143 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
6144 (match_operand 3 "vector_length_operand" " rK, rK, rK, rK")
6145 (match_operand 4 "const_int_operand" " i, i, i, i")
6146 (match_operand 5 "const_int_operand" " i, i, i, i")
6147 (match_operand 6 "const_int_operand" " i, i, i, i")
6149 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
6150 (vec_series:V_VLSI (const_int 0) (const_int 1))
6151 (match_operand:V_VLSI 2 "vector_merge_operand" " vu, 0, vu, 0")))]
6154 [(set_attr "type" "vmidx")
6155 (set_attr "mode" "<MODE>")])
6157 ;; -------------------------------------------------------------------------------
6158 ;; ---- Predicated floating-point binary operations
6159 ;; -------------------------------------------------------------------------------
6161 ;; - 13.2 Vector Single-Width Floating-Point Add/Subtract Instructions
6162 ;; - 13.4 Vector Single-Width Floating-Point Multiply/Divide Instructions
6163 ;; - 13.11 Vector Floating-Point MIN/MAX Instructions
6164 ;; - 13.12 Vector Floating-Point Sign-Injection Instructions
6165 ;; -------------------------------------------------------------------------------
6167 (define_insn "@pred_<optab><mode>"
6168 [(set (match_operand:V_VLSF 0 "register_operand" "=vd, vd, vr, vr")
6169 (if_then_else:V_VLSF
6171 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
6172 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
6173 (match_operand 6 "const_int_operand" " i, i, i, i")
6174 (match_operand 7 "const_int_operand" " i, i, i, i")
6175 (match_operand 8 "const_int_operand" " i, i, i, i")
6176 (match_operand 9 "const_int_operand" " i, i, i, i")
6178 (reg:SI VTYPE_REGNUM)
6179 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
6180 (any_float_binop:V_VLSF
6181 (match_operand:V_VLSF 3 "register_operand" " vr, vr, vr, vr")
6182 (match_operand:V_VLSF 4 "register_operand" " vr, vr, vr, vr"))
6183 (match_operand:V_VLSF 2 "vector_merge_operand" " vu, 0, vu, 0")))]
6185 "vf<insn>.vv\t%0,%3,%4%p1"
6186 [(set_attr "type" "<float_insn_type>")
6187 (set_attr "mode" "<MODE>")
6188 (set (attr "frm_mode")
6189 (symbol_ref "riscv_vector::get_frm_mode (operands[9])"))])
6191 (define_insn "@pred_<optab><mode>"
6192 [(set (match_operand:V_VLSF 0 "register_operand" "=vd, vd, vr, vr")
6193 (if_then_else:V_VLSF
6195 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
6196 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
6197 (match_operand 6 "const_int_operand" " i, i, i, i")
6198 (match_operand 7 "const_int_operand" " i, i, i, i")
6199 (match_operand 8 "const_int_operand" " i, i, i, i")
6201 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
6202 (any_float_binop_nofrm:V_VLSF
6203 (match_operand:V_VLSF 3 "register_operand" " vr, vr, vr, vr")
6204 (match_operand:V_VLSF 4 "register_operand" " vr, vr, vr, vr"))
6205 (match_operand:V_VLSF 2 "vector_merge_operand" " vu, 0, vu, 0")))]
6207 "vf<insn>.vv\t%0,%3,%4%p1"
6208 [(set_attr "type" "<float_insn_type>")
6209 (set_attr "mode" "<MODE>")])
6211 (define_insn "@pred_<ieee_fmaxmin_op><mode>"
6212 [(set (match_operand:V_VLSF 0 "register_operand" "=vd, vd, vr, vr")
6213 (if_then_else:V_VLSF
6215 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
6216 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
6217 (match_operand 6 "const_int_operand" " i, i, i, i")
6218 (match_operand 7 "const_int_operand" " i, i, i, i")
6219 (match_operand 8 "const_int_operand" " i, i, i, i")
6221 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
6223 [(match_operand:V_VLSF 3 "register_operand" " vr, vr, vr, vr")
6224 (match_operand:V_VLSF 4 "register_operand" " vr, vr, vr, vr")]
6226 (match_operand:V_VLSF 2 "vector_merge_operand" " vu, 0, vu, 0")))]
6228 "v<ieee_fmaxmin_op>.vv\t%0,%3,%4%p1"
6229 [(set_attr "type" "vfminmax")
6230 (set_attr "mode" "<MODE>")])
6232 (define_insn "@pred_<optab><mode>_scalar"
6233 [(set (match_operand:VF 0 "register_operand" "=vd, vd, vr, vr")
6236 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
6237 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
6238 (match_operand 6 "const_int_operand" " i, i, i, i")
6239 (match_operand 7 "const_int_operand" " i, i, i, i")
6240 (match_operand 8 "const_int_operand" " i, i, i, i")
6241 (match_operand 9 "const_int_operand" " i, i, i, i")
6243 (reg:SI VTYPE_REGNUM)
6244 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
6245 (commutative_float_binop:VF
6247 (match_operand:<VEL> 4 "register_operand" " f, f, f, f"))
6248 (match_operand:VF 3 "register_operand" " vr, vr, vr, vr"))
6249 (match_operand:VF 2 "vector_merge_operand" " vu, 0, vu, 0")))]
6251 "vf<insn>.vf\t%0,%3,%4%p1"
6252 [(set_attr "type" "<float_insn_type>")
6253 (set_attr "mode" "<MODE>")
6254 (set (attr "frm_mode")
6255 (symbol_ref "riscv_vector::get_frm_mode (operands[9])"))])
6257 (define_insn "@pred_<optab><mode>_scalar"
6258 [(set (match_operand:VF 0 "register_operand" "=vd, vd, vr, vr")
6261 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
6262 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
6263 (match_operand 6 "const_int_operand" " i, i, i, i")
6264 (match_operand 7 "const_int_operand" " i, i, i, i")
6265 (match_operand 8 "const_int_operand" " i, i, i, i")
6267 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
6268 (commutative_float_binop_nofrm:VF
6270 (match_operand:<VEL> 4 "register_operand" " f, f, f, f"))
6271 (match_operand:VF 3 "register_operand" " vr, vr, vr, vr"))
6272 (match_operand:VF 2 "vector_merge_operand" " vu, 0, vu, 0")))]
6274 "vf<insn>.vf\t%0,%3,%4%p1"
6275 [(set_attr "type" "<float_insn_type>")
6276 (set_attr "mode" "<MODE>")])
6278 (define_insn "@pred_<ieee_fmaxmin_op><mode>_scalar"
6279 [(set (match_operand:VF 0 "register_operand" "=vd, vd, vr, vr")
6282 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
6283 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
6284 (match_operand 6 "const_int_operand" " i, i, i, i")
6285 (match_operand 7 "const_int_operand" " i, i, i, i")
6286 (match_operand 8 "const_int_operand" " i, i, i, i")
6288 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
6290 [(match_operand:VF 3 "register_operand" " vr, vr, vr, vr")
6292 (match_operand:<VEL> 4 "register_operand" " f, f, f, f"))]
6294 (match_operand:VF 2 "vector_merge_operand" " vu, 0, vu, 0")))]
6296 "v<ieee_fmaxmin_op>.vf\t%0,%3,%4%p1"
6297 [(set_attr "type" "vfminmax")
6298 (set_attr "mode" "<MODE>")])
6300 (define_insn "@pred_<optab><mode>_scalar"
6301 [(set (match_operand:VF 0 "register_operand" "=vd, vd, vr, vr")
6304 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
6305 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
6306 (match_operand 6 "const_int_operand" " i, i, i, i")
6307 (match_operand 7 "const_int_operand" " i, i, i, i")
6308 (match_operand 8 "const_int_operand" " i, i, i, i")
6309 (match_operand 9 "const_int_operand" " i, i, i, i")
6311 (reg:SI VTYPE_REGNUM)
6312 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
6313 (non_commutative_float_binop:VF
6314 (match_operand:VF 3 "register_operand" " vr, vr, vr, vr")
6316 (match_operand:<VEL> 4 "register_operand" " f, f, f, f")))
6317 (match_operand:VF 2 "vector_merge_operand" " vu, 0, vu, 0")))]
6319 "vf<insn>.vf\t%0,%3,%4%p1"
6320 [(set_attr "type" "<float_insn_type>")
6321 (set_attr "mode" "<MODE>")
6322 (set (attr "frm_mode")
6323 (symbol_ref "riscv_vector::get_frm_mode (operands[9])"))])
6325 (define_insn "@pred_<optab><mode>_reverse_scalar"
6326 [(set (match_operand:VF 0 "register_operand" "=vd, vd, vr, vr")
6329 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
6330 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
6331 (match_operand 6 "const_int_operand" " i, i, i, i")
6332 (match_operand 7 "const_int_operand" " i, i, i, i")
6333 (match_operand 8 "const_int_operand" " i, i, i, i")
6334 (match_operand 9 "const_int_operand" " i, i, i, i")
6336 (reg:SI VTYPE_REGNUM)
6337 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
6338 (non_commutative_float_binop:VF
6340 (match_operand:<VEL> 4 "register_operand" " f, f, f, f"))
6341 (match_operand:VF 3 "register_operand" " vr, vr, vr, vr"))
6342 (match_operand:VF 2 "vector_merge_operand" " vu, 0, vu, 0")))]
6344 "vfr<insn>.vf\t%0,%3,%4%p1"
6345 [(set_attr "type" "<float_insn_type>")
6346 (set_attr "mode" "<MODE>")
6347 (set (attr "frm_mode")
6348 (symbol_ref "riscv_vector::get_frm_mode (operands[9])"))])
6350 (define_insn "@pred_<copysign><mode>"
6351 [(set (match_operand:V_VLSF 0 "register_operand" "=vd, vd, vr, vr")
6352 (if_then_else:V_VLSF
6354 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
6355 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
6356 (match_operand 6 "const_int_operand" " i, i, i, i")
6357 (match_operand 7 "const_int_operand" " i, i, i, i")
6358 (match_operand 8 "const_int_operand" " i, i, i, i")
6360 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
6362 [(match_operand:V_VLSF 3 "register_operand" " vr, vr, vr, vr")
6363 (match_operand:V_VLSF 4 "register_operand" " vr, vr, vr, vr")] VCOPYSIGNS)
6364 (match_operand:V_VLSF 2 "vector_merge_operand" " vu, 0, vu, 0")))]
6366 "vfsgnj<nx>.vv\t%0,%3,%4%p1"
6367 [(set_attr "type" "vfsgnj")
6368 (set_attr "mode" "<MODE>")])
6370 (define_insn "@pred_ncopysign<mode>"
6371 [(set (match_operand:VF 0 "register_operand" "=vd, vd, vr, vr")
6374 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
6375 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
6376 (match_operand 6 "const_int_operand" " i, i, i, i")
6377 (match_operand 7 "const_int_operand" " i, i, i, i")
6378 (match_operand 8 "const_int_operand" " i, i, i, i")
6380 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
6383 [(match_operand:VF 3 "register_operand" " vr, vr, vr, vr")
6384 (match_operand:VF 4 "register_operand" " vr, vr, vr, vr")] UNSPEC_VCOPYSIGN))
6385 (match_operand:VF 2 "vector_merge_operand" " vu, 0, vu, 0")))]
6387 "vfsgnjn.vv\t%0,%3,%4%p1"
6388 [(set_attr "type" "vfsgnj")
6389 (set_attr "mode" "<MODE>")])
6391 (define_insn "@pred_<copysign><mode>_scalar"
6392 [(set (match_operand:V_VLSF 0 "register_operand" "=vd, vd, vr, vr")
6393 (if_then_else:V_VLSF
6395 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
6396 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
6397 (match_operand 6 "const_int_operand" " i, i, i, i")
6398 (match_operand 7 "const_int_operand" " i, i, i, i")
6399 (match_operand 8 "const_int_operand" " i, i, i, i")
6401 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
6403 [(match_operand:V_VLSF 3 "register_operand" " vr, vr, vr, vr")
6404 (vec_duplicate:V_VLSF
6405 (match_operand:<VEL> 4 "register_operand" " f, f, f, f"))] VCOPYSIGNS)
6406 (match_operand:V_VLSF 2 "vector_merge_operand" " vu, 0, vu, 0")))]
6408 "vfsgnj<nx>.vf\t%0,%3,%4%p1"
6409 [(set_attr "type" "vfsgnj")
6410 (set_attr "mode" "<MODE>")])
6412 (define_insn "@pred_ncopysign<mode>_scalar"
6413 [(set (match_operand:VF 0 "register_operand" "=vd, vd, vr, vr")
6416 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
6417 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
6418 (match_operand 6 "const_int_operand" " i, i, i, i")
6419 (match_operand 7 "const_int_operand" " i, i, i, i")
6420 (match_operand 8 "const_int_operand" " i, i, i, i")
6422 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
6425 [(match_operand:VF 3 "register_operand" " vr, vr, vr, vr")
6427 (match_operand:<VEL> 4 "register_operand" " f, f, f, f"))] UNSPEC_VCOPYSIGN))
6428 (match_operand:VF 2 "vector_merge_operand" " vu, 0, vu, 0")))]
6430 "vfsgnjn.vf\t%0,%3,%4%p1"
6431 [(set_attr "type" "vfsgnj")
6432 (set_attr "mode" "<MODE>")])
6434 ;; -------------------------------------------------------------------------------
6435 ;; ---- Predicated floating-point ternary operations
6436 ;; -------------------------------------------------------------------------------
6438 ;; - 13.6 Vector Single-Width Floating-Point Fused Multiply-Add Instructions
6439 ;; -------------------------------------------------------------------------------
6441 (define_expand "@pred_mul_<optab><mode>"
6442 [(set (match_operand:V_VLSF 0 "register_operand")
6443 (if_then_else:V_VLSF
6445 [(match_operand:<VM> 1 "vector_mask_operand")
6446 (match_operand 6 "vector_length_operand")
6447 (match_operand 7 "const_int_operand")
6448 (match_operand 8 "const_int_operand")
6449 (match_operand 9 "const_int_operand")
6450 (match_operand 10 "const_int_operand")
6452 (reg:SI VTYPE_REGNUM)
6453 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
6456 (match_operand:V_VLSF 2 "register_operand")
6457 (match_operand:V_VLSF 3 "register_operand"))
6458 (match_operand:V_VLSF 4 "register_operand"))
6459 (match_operand:V_VLSF 5 "vector_merge_operand")))]
6462 riscv_vector::prepare_ternary_operands (operands);
6465 (define_insn "*pred_mul_<optab><mode>_undef"
6466 [(set (match_operand:V_VLSF 0 "register_operand" "=vd,vd,?&vd, vr, vr,?&vr")
6467 (if_then_else:V_VLSF
6469 [(match_operand:<VM> 1 "vector_mask_operand" " vm,vm, vm,Wc1,Wc1, Wc1")
6470 (match_operand 6 "vector_length_operand" " rK,rK, rK, rK, rK, rK")
6471 (match_operand 7 "const_int_operand" " i, i, i, i, i, i")
6472 (match_operand 8 "const_int_operand" " i, i, i, i, i, i")
6473 (match_operand 9 "const_int_operand" " i, i, i, i, i, i")
6474 (match_operand 10 "const_int_operand" " i, i, i, i, i, i")
6476 (reg:SI VTYPE_REGNUM)
6477 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
6480 (match_operand:V_VLSF 3 "register_operand" " 0,vr, vr, 0, vr, vr")
6481 (match_operand:V_VLSF 4 "register_operand" " vr,vr, vr, vr, vr, vr"))
6482 (match_operand:V_VLSF 5 "register_operand" " vr, 0, vr, vr, 0, vr"))
6483 (match_operand:V_VLSF 2 "vector_undef_operand")))]
6486 vf<madd_msub>.vv\t%0,%4,%5%p1
6487 vf<macc_msac>.vv\t%0,%3,%4%p1
6488 vmv.v.v\t%0,%3\;vf<madd_msub>.vv\t%0,%4,%5%p1
6489 vf<madd_msub>.vv\t%0,%4,%5%p1
6490 vf<macc_msac>.vv\t%0,%3,%4%p1
6491 vmv.v.v\t%0,%3\;vf<madd_msub>.vv\t%0,%4,%5%p1"
6492 [(set_attr "type" "vfmuladd")
6493 (set_attr "mode" "<MODE>")
6494 (set (attr "frm_mode")
6495 (symbol_ref "riscv_vector::get_frm_mode (operands[10])"))])
6497 (define_insn "*pred_<madd_msub><mode>"
6498 [(set (match_operand:V_VLSF 0 "register_operand" "=vd, ?&vd, vr, ?&vr")
6499 (if_then_else:V_VLSF
6501 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1")
6502 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
6503 (match_operand 6 "const_int_operand" " i, i, i, i")
6504 (match_operand 7 "const_int_operand" " i, i, i, i")
6505 (match_operand 8 "const_int_operand" " i, i, i, i")
6506 (match_operand 9 "const_int_operand" " i, i, i, i")
6508 (reg:SI VTYPE_REGNUM)
6509 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
6512 (match_operand:V_VLSF 2 "register_operand" " 0, vr, 0, vr")
6513 (match_operand:V_VLSF 3 "register_operand" " vr, vr, vr, vr"))
6514 (match_operand:V_VLSF 4 "register_operand" " vr, vr, vr, vr"))
6518 vf<madd_msub>.vv\t%0,%3,%4%p1
6519 vmv.v.v\t%0,%2\;vf<madd_msub>.vv\t%0,%3,%4%p1
6520 vf<madd_msub>.vv\t%0,%3,%4%p1
6521 vmv.v.v\t%0,%2\;vf<madd_msub>.vv\t%0,%3,%4%p1"
6522 [(set_attr "type" "vfmuladd")
6523 (set_attr "mode" "<MODE>")
6524 (set_attr "merge_op_idx" "4")
6525 (set_attr "vl_op_idx" "5")
6526 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[6])"))
6527 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[7])"))
6528 (set (attr "avl_type_idx") (const_int 8))
6529 (set (attr "frm_mode")
6530 (symbol_ref "riscv_vector::get_frm_mode (operands[9])"))])
6532 (define_insn "*pred_<macc_msac><mode>"
6533 [(set (match_operand:V_VLSF 0 "register_operand" "=vd, ?&vd, vr, ?&vr")
6534 (if_then_else:V_VLSF
6536 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1")
6537 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
6538 (match_operand 6 "const_int_operand" " i, i, i, i")
6539 (match_operand 7 "const_int_operand" " i, i, i, i")
6540 (match_operand 8 "const_int_operand" " i, i, i, i")
6541 (match_operand 9 "const_int_operand" " i, i, i, i")
6543 (reg:SI VTYPE_REGNUM)
6544 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
6547 (match_operand:V_VLSF 2 "register_operand" " vr, vr, vr, vr")
6548 (match_operand:V_VLSF 3 "register_operand" " vr, vr, vr, vr"))
6549 (match_operand:V_VLSF 4 "register_operand" " 0, vr, 0, vr"))
6553 vf<macc_msac>.vv\t%0,%2,%3%p1
6554 vmv.v.v\t%0,%4\;vf<macc_msac>.vv\t%0,%2,%3%p1
6555 vf<macc_msac>.vv\t%0,%2,%3%p1
6556 vmv.v.v\t%0,%4\;vf<macc_msac>.vv\t%0,%2,%3%p1"
6557 [(set_attr "type" "vfmuladd")
6558 (set_attr "mode" "<MODE>")
6559 (set_attr "merge_op_idx" "2")
6560 (set_attr "vl_op_idx" "5")
6561 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[6])"))
6562 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[7])"))
6563 (set (attr "avl_type_idx") (const_int 8))
6564 (set (attr "frm_mode")
6565 (symbol_ref "riscv_vector::get_frm_mode (operands[9])"))])
6567 (define_expand "@pred_mul_<optab><mode>_scalar"
6568 [(set (match_operand:V_VLSF 0 "register_operand")
6569 (if_then_else:V_VLSF
6571 [(match_operand:<VM> 1 "vector_mask_operand")
6572 (match_operand 6 "vector_length_operand")
6573 (match_operand 7 "const_int_operand")
6574 (match_operand 8 "const_int_operand")
6575 (match_operand 9 "const_int_operand")
6576 (match_operand 10 "const_int_operand")
6578 (reg:SI VTYPE_REGNUM)
6579 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
6582 (vec_duplicate:V_VLSF
6583 (match_operand:<VEL> 2 "register_operand"))
6584 (match_operand:V_VLSF 3 "register_operand"))
6585 (match_operand:V_VLSF 4 "register_operand"))
6586 (match_operand:V_VLSF 5 "register_operand")))]
6590 (define_insn "*pred_<madd_msub><mode>_scalar"
6591 [(set (match_operand:V_VLSF 0 "register_operand" "=vd, ?&vd, vr, ?&vr")
6592 (if_then_else:V_VLSF
6594 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1")
6595 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
6596 (match_operand 6 "const_int_operand" " i, i, i, i")
6597 (match_operand 7 "const_int_operand" " i, i, i, i")
6598 (match_operand 8 "const_int_operand" " i, i, i, i")
6599 (match_operand 9 "const_int_operand" " i, i, i, i")
6601 (reg:SI VTYPE_REGNUM)
6602 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
6605 (vec_duplicate:V_VLSF
6606 (match_operand:<VEL> 2 "register_operand" " f, f, f, f"))
6607 (match_operand:V_VLSF 3 "register_operand" " 0, vr, 0, vr"))
6608 (match_operand:V_VLSF 4 "register_operand" " vr, vr, vr, vr"))
6612 vf<madd_msub>.vf\t%0,%2,%4%p1
6613 vmv.v.v\t%0,%3\;vf<madd_msub>.vf\t%0,%2,%4%p1
6614 vf<madd_msub>.vf\t%0,%2,%4%p1
6615 vmv.v.v\t%0,%3\;vf<madd_msub>.vf\t%0,%2,%4%p1"
6616 [(set_attr "type" "vfmuladd")
6617 (set_attr "mode" "<MODE>")
6618 (set_attr "merge_op_idx" "4")
6619 (set_attr "vl_op_idx" "5")
6620 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[6])"))
6621 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[7])"))
6622 (set (attr "avl_type_idx") (const_int 8))
6623 (set (attr "frm_mode")
6624 (symbol_ref "riscv_vector::get_frm_mode (operands[9])"))])
6626 (define_insn "*pred_<macc_msac><mode>_scalar"
6627 [(set (match_operand:V_VLSF 0 "register_operand" "=vd, ?&vd, vr, ?&vr")
6628 (if_then_else:V_VLSF
6630 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1")
6631 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
6632 (match_operand 6 "const_int_operand" " i, i, i, i")
6633 (match_operand 7 "const_int_operand" " i, i, i, i")
6634 (match_operand 8 "const_int_operand" " i, i, i, i")
6635 (match_operand 9 "const_int_operand" " i, i, i, i")
6637 (reg:SI VTYPE_REGNUM)
6638 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
6641 (vec_duplicate:V_VLSF
6642 (match_operand:<VEL> 2 "register_operand" " f, f, f, f"))
6643 (match_operand:V_VLSF 3 "register_operand" " vr, vr, vr, vr"))
6644 (match_operand:V_VLSF 4 "register_operand" " 0, vr, 0, vr"))
6648 vf<macc_msac>.vf\t%0,%2,%3%p1
6649 vmv.v.v\t%0,%4\;vf<macc_msac>.vf\t%0,%2,%3%p1
6650 vf<macc_msac>.vf\t%0,%2,%3%p1
6651 vmv.v.v\t%0,%4\;vf<macc_msac>.vf\t%0,%2,%3%p1"
6652 [(set_attr "type" "vfmuladd")
6653 (set_attr "mode" "<MODE>")
6654 (set_attr "merge_op_idx" "2")
6655 (set_attr "vl_op_idx" "5")
6656 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[6])"))
6657 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[7])"))
6658 (set (attr "avl_type_idx") (const_int 8))
6659 (set (attr "frm_mode")
6660 (symbol_ref "riscv_vector::get_frm_mode (operands[9])"))])
6662 (define_expand "@pred_mul_neg_<optab><mode>"
6663 [(set (match_operand:V_VLSF 0 "register_operand")
6664 (if_then_else:V_VLSF
6666 [(match_operand:<VM> 1 "vector_mask_operand")
6667 (match_operand 6 "vector_length_operand")
6668 (match_operand 7 "const_int_operand")
6669 (match_operand 8 "const_int_operand")
6670 (match_operand 9 "const_int_operand")
6671 (match_operand 10 "const_int_operand")
6673 (reg:SI VTYPE_REGNUM)
6674 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
6678 (match_operand:V_VLSF 2 "register_operand")
6679 (match_operand:V_VLSF 3 "register_operand")))
6680 (match_operand:V_VLSF 4 "register_operand"))
6681 (match_operand:V_VLSF 5 "vector_merge_operand")))]
6684 riscv_vector::prepare_ternary_operands (operands);
6687 (define_insn "*pred_mul_neg_<optab><mode>_undef"
6688 [(set (match_operand:V_VLSF 0 "register_operand" "=vd,vd,?&vd, vr, vr,?&vr")
6689 (if_then_else:V_VLSF
6691 [(match_operand:<VM> 1 "vector_mask_operand" " vm,vm, vm,Wc1,Wc1, Wc1")
6692 (match_operand 6 "vector_length_operand" " rK,rK, rK, rK, rK, rK")
6693 (match_operand 7 "const_int_operand" " i, i, i, i, i, i")
6694 (match_operand 8 "const_int_operand" " i, i, i, i, i, i")
6695 (match_operand 9 "const_int_operand" " i, i, i, i, i, i")
6696 (match_operand 10 "const_int_operand" " i, i, i, i, i, i")
6698 (reg:SI VTYPE_REGNUM)
6699 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
6703 (match_operand:V_VLSF 3 "register_operand" " 0,vr, vr, 0, vr, vr")
6704 (match_operand:V_VLSF 4 "register_operand" " vr,vr, vr, vr, vr, vr")))
6705 (match_operand:V_VLSF 5 "register_operand" " vr, 0, vr, vr, 0, vr"))
6706 (match_operand:V_VLSF 2 "vector_undef_operand")))]
6709 vf<nmsub_nmadd>.vv\t%0,%4,%5%p1
6710 vf<nmsac_nmacc>.vv\t%0,%3,%4%p1
6711 vmv.v.v\t%0,%3\;vf<nmsub_nmadd>.vv\t%0,%4,%5%p1
6712 vf<nmsub_nmadd>.vv\t%0,%4,%5%p1
6713 vf<nmsac_nmacc>.vv\t%0,%3,%4%p1
6714 vmv.v.v\t%0,%3\;vf<nmsub_nmadd>.vv\t%0,%4,%5%p1"
6715 [(set_attr "type" "vfmuladd")
6716 (set_attr "mode" "<MODE>")
6717 (set (attr "frm_mode")
6718 (symbol_ref "riscv_vector::get_frm_mode (operands[10])"))])
6720 (define_insn "*pred_<nmsub_nmadd><mode>"
6721 [(set (match_operand:V_VLSF 0 "register_operand" "=vd, ?&vd, vr, ?&vr")
6722 (if_then_else:V_VLSF
6724 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1")
6725 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
6726 (match_operand 6 "const_int_operand" " i, i, i, i")
6727 (match_operand 7 "const_int_operand" " i, i, i, i")
6728 (match_operand 8 "const_int_operand" " i, i, i, i")
6729 (match_operand 9 "const_int_operand" " i, i, i, i")
6731 (reg:SI VTYPE_REGNUM)
6732 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
6736 (match_operand:V_VLSF 2 "register_operand" " 0, vr, 0, vr")
6737 (match_operand:V_VLSF 3 "register_operand" " vr, vr, vr, vr")))
6738 (match_operand:V_VLSF 4 "register_operand" " vr, vr, vr, vr"))
6742 vf<nmsub_nmadd>.vv\t%0,%3,%4%p1
6743 vmv.v.v\t%0,%2\;vf<nmsub_nmadd>.vv\t%0,%3,%4%p1
6744 vf<nmsub_nmadd>.vv\t%0,%3,%4%p1
6745 vmv.v.v\t%0,%2\;vf<nmsub_nmadd>.vv\t%0,%3,%4%p1"
6746 [(set_attr "type" "vfmuladd")
6747 (set_attr "mode" "<MODE>")
6748 (set_attr "merge_op_idx" "4")
6749 (set_attr "vl_op_idx" "5")
6750 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[6])"))
6751 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[7])"))
6752 (set (attr "avl_type_idx") (const_int 8))
6753 (set (attr "frm_mode")
6754 (symbol_ref "riscv_vector::get_frm_mode (operands[9])"))])
6756 (define_insn "*pred_<nmsac_nmacc><mode>"
6757 [(set (match_operand:V_VLSF 0 "register_operand" "=vd, ?&vd, vr, ?&vr")
6758 (if_then_else:V_VLSF
6760 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1")
6761 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
6762 (match_operand 6 "const_int_operand" " i, i, i, i")
6763 (match_operand 7 "const_int_operand" " i, i, i, i")
6764 (match_operand 8 "const_int_operand" " i, i, i, i")
6765 (match_operand 9 "const_int_operand" " i, i, i, i")
6767 (reg:SI VTYPE_REGNUM)
6768 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
6772 (match_operand:V_VLSF 2 "register_operand" " vr, vr, vr, vr")
6773 (match_operand:V_VLSF 3 "register_operand" " vr, vr, vr, vr")))
6774 (match_operand:V_VLSF 4 "register_operand" " 0, vr, 0, vr"))
6778 vf<nmsac_nmacc>.vv\t%0,%2,%3%p1
6779 vmv.v.v\t%0,%4\;vf<nmsac_nmacc>.vv\t%0,%2,%3%p1
6780 vf<nmsac_nmacc>.vv\t%0,%2,%3%p1
6781 vmv.v.v\t%0,%4\;vf<nmsac_nmacc>.vv\t%0,%2,%3%p1"
6782 [(set_attr "type" "vfmuladd")
6783 (set_attr "mode" "<MODE>")
6784 (set_attr "merge_op_idx" "2")
6785 (set_attr "vl_op_idx" "5")
6786 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[6])"))
6787 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[7])"))
6788 (set (attr "avl_type_idx") (const_int 8))
6789 (set (attr "frm_mode")
6790 (symbol_ref "riscv_vector::get_frm_mode (operands[9])"))])
6792 (define_expand "@pred_mul_neg_<optab><mode>_scalar"
6793 [(set (match_operand:V_VLSF 0 "register_operand")
6794 (if_then_else:V_VLSF
6796 [(match_operand:<VM> 1 "vector_mask_operand")
6797 (match_operand 6 "vector_length_operand")
6798 (match_operand 7 "const_int_operand")
6799 (match_operand 8 "const_int_operand")
6800 (match_operand 9 "const_int_operand")
6801 (match_operand 10 "const_int_operand")
6803 (reg:SI VTYPE_REGNUM)
6804 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
6808 (vec_duplicate:V_VLSF
6809 (match_operand:<VEL> 2 "register_operand"))
6810 (match_operand:V_VLSF 3 "register_operand")))
6811 (match_operand:V_VLSF 4 "register_operand"))
6812 (match_operand:V_VLSF 5 "register_operand")))]
6816 (define_insn "*pred_<nmsub_nmadd><mode>_scalar"
6817 [(set (match_operand:V_VLSF 0 "register_operand" "=vd, ?&vd, vr, ?&vr")
6818 (if_then_else:V_VLSF
6820 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1")
6821 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
6822 (match_operand 6 "const_int_operand" " i, i, i, i")
6823 (match_operand 7 "const_int_operand" " i, i, i, i")
6824 (match_operand 8 "const_int_operand" " i, i, i, i")
6825 (match_operand 9 "const_int_operand" " i, i, i, i")
6827 (reg:SI VTYPE_REGNUM)
6828 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
6832 (vec_duplicate:V_VLSF
6833 (match_operand:<VEL> 2 "register_operand" " f, f, f, f"))
6834 (match_operand:V_VLSF 3 "register_operand" " 0, vr, 0, vr")))
6835 (match_operand:V_VLSF 4 "register_operand" " vr, vr, vr, vr"))
6839 vf<nmsub_nmadd>.vf\t%0,%2,%4%p1
6840 vmv.v.v\t%0,%3\;vf<nmsub_nmadd>.vf\t%0,%2,%4%p1
6841 vf<nmsub_nmadd>.vf\t%0,%2,%4%p1
6842 vmv.v.v\t%0,%3\;vf<nmsub_nmadd>.vf\t%0,%2,%4%p1"
6843 [(set_attr "type" "vfmuladd")
6844 (set_attr "mode" "<MODE>")
6845 (set_attr "merge_op_idx" "4")
6846 (set_attr "vl_op_idx" "5")
6847 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[6])"))
6848 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[7])"))
6849 (set (attr "avl_type_idx") (const_int 8))
6850 (set (attr "frm_mode")
6851 (symbol_ref "riscv_vector::get_frm_mode (operands[9])"))])
6853 (define_insn "*pred_<nmsac_nmacc><mode>_scalar"
6854 [(set (match_operand:V_VLSF 0 "register_operand" "=vd, ?&vd, vr, ?&vr")
6855 (if_then_else:V_VLSF
6857 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1, Wc1")
6858 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
6859 (match_operand 6 "const_int_operand" " i, i, i, i")
6860 (match_operand 7 "const_int_operand" " i, i, i, i")
6861 (match_operand 8 "const_int_operand" " i, i, i, i")
6862 (match_operand 9 "const_int_operand" " i, i, i, i")
6864 (reg:SI VTYPE_REGNUM)
6865 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
6869 (vec_duplicate:V_VLSF
6870 (match_operand:<VEL> 2 "register_operand" " f, f, f, f"))
6871 (match_operand:V_VLSF 3 "register_operand" " vr, vr, vr, vr")))
6872 (match_operand:V_VLSF 4 "register_operand" " 0, vr, 0, vr"))
6876 vf<nmsac_nmacc>.vf\t%0,%2,%3%p1
6877 vmv.v.v\t%0,%4\;vf<nmsac_nmacc>.vf\t%0,%2,%3%p1
6878 vf<nmsac_nmacc>.vf\t%0,%2,%3%p1
6879 vmv.v.v\t%0,%4\;vf<nmsac_nmacc>.vf\t%0,%2,%3%p1"
6880 [(set_attr "type" "vfmuladd")
6881 (set_attr "mode" "<MODE>")
6882 (set_attr "merge_op_idx" "2")
6883 (set_attr "vl_op_idx" "5")
6884 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[6])"))
6885 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[7])"))
6886 (set (attr "avl_type_idx") (const_int 8))
6887 (set (attr "frm_mode")
6888 (symbol_ref "riscv_vector::get_frm_mode (operands[9])"))])
6890 ;; -------------------------------------------------------------------------------
6891 ;; ---- Predicated floating-point unary operations
6892 ;; -------------------------------------------------------------------------------
6894 ;; - 13.8 Vector Floating-Point Square-Root Instruction
6895 ;; - 13.9 Vector Floating-Point Reciprocal Square-Root Estimate Instruction
6896 ;; - 13.10 Vector Floating-Point Reciprocal Estimate Instruction
6897 ;; - 13.12 Vector Floating-Point Sign-Injection Instructions (vfneg.v/vfabs.v)
6898 ;; - 13.14 Vector Floating-Point Classify Instruction
6899 ;; -------------------------------------------------------------------------------
6901 (define_insn "@pred_<optab><mode>"
6902 [(set (match_operand:V_VLSF 0 "register_operand" "=vd, vd, vr, vr")
6903 (if_then_else:V_VLSF
6905 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
6906 (match_operand 4 "vector_length_operand" " rK, rK, rK, rK")
6907 (match_operand 5 "const_int_operand" " i, i, i, i")
6908 (match_operand 6 "const_int_operand" " i, i, i, i")
6909 (match_operand 7 "const_int_operand" " i, i, i, i")
6910 (match_operand 8 "const_int_operand" " i, i, i, i")
6912 (reg:SI VTYPE_REGNUM)
6913 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
6914 (any_float_unop:V_VLSF
6915 (match_operand:V_VLSF 3 "register_operand" " vr, vr, vr, vr"))
6916 (match_operand:V_VLSF 2 "vector_merge_operand" " vu, 0, vu, 0")))]
6918 "vf<insn>.v\t%0,%3%p1"
6919 [(set_attr "type" "<float_insn_type>")
6920 (set_attr "mode" "<MODE>")
6921 (set_attr "vl_op_idx" "4")
6922 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[5])"))
6923 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[6])"))
6924 (set (attr "avl_type_idx") (const_int 7))
6925 (set (attr "frm_mode")
6926 (symbol_ref "riscv_vector::get_frm_mode (operands[8])"))])
6928 (define_insn "@pred_<optab><mode>"
6929 [(set (match_operand:V_VLSF 0 "register_operand" "=vd, vd, vr, vr")
6930 (if_then_else:V_VLSF
6932 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
6933 (match_operand 4 "vector_length_operand" " rK, rK, rK, rK")
6934 (match_operand 5 "const_int_operand" " i, i, i, i")
6935 (match_operand 6 "const_int_operand" " i, i, i, i")
6936 (match_operand 7 "const_int_operand" " i, i, i, i")
6938 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
6939 (any_float_unop_nofrm:V_VLSF
6940 (match_operand:V_VLSF 3 "register_operand" " vr, vr, vr, vr"))
6941 (match_operand:V_VLSF 2 "vector_merge_operand" " vu, 0, vu, 0")))]
6943 "vf<insn>.v\t%0,%3%p1"
6944 [(set_attr "type" "<float_insn_type>")
6945 (set_attr "mode" "<MODE>")
6946 (set_attr "vl_op_idx" "4")
6947 (set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[5])"))
6948 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[6])"))
6949 (set (attr "avl_type_idx") (const_int 7))])
6951 (define_insn "@pred_<misc_op><mode>"
6952 [(set (match_operand:VF 0 "register_operand" "=vd, vd, vr, vr")
6955 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
6956 (match_operand 4 "vector_length_operand" " rK, rK, rK, rK")
6957 (match_operand 5 "const_int_operand" " i, i, i, i")
6958 (match_operand 6 "const_int_operand" " i, i, i, i")
6959 (match_operand 7 "const_int_operand" " i, i, i, i")
6961 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
6963 [(match_operand:VF 3 "register_operand" " vr, vr, vr, vr")] VFMISC)
6964 (match_operand:VF 2 "vector_merge_operand" " vu, 0, vu, 0")))]
6966 "vf<misc_op>.v\t%0,%3%p1"
6967 [(set_attr "type" "<float_insn_type>")
6968 (set_attr "mode" "<MODE>")])
6970 (define_insn "@pred_<misc_frm_op><mode>"
6971 [(set (match_operand:VF 0 "register_operand" "=vd, vd, vr, vr")
6974 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
6975 (match_operand 4 "vector_length_operand" " rK, rK, rK, rK")
6976 (match_operand 5 "const_int_operand" " i, i, i, i")
6977 (match_operand 6 "const_int_operand" " i, i, i, i")
6978 (match_operand 7 "const_int_operand" " i, i, i, i")
6979 (match_operand 8 "const_int_operand" " i, i, i, i")
6981 (reg:SI VTYPE_REGNUM)
6982 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
6984 [(match_operand:VF 3 "register_operand" " vr, vr, vr, vr")] VFMISC_FRM)
6985 (match_operand:VF 2 "vector_merge_operand" " vu, 0, vu, 0")))]
6987 "vf<misc_frm_op>.v\t%0,%3%p1"
6988 [(set_attr "type" "<float_frm_insn_type>")
6989 (set_attr "mode" "<MODE>")
6990 (set (attr "frm_mode")
6991 (symbol_ref "riscv_vector::get_frm_mode (operands[8])"))])
6993 (define_insn "@pred_class<mode>"
6994 [(set (match_operand:<VCONVERT> 0 "register_operand" "=vd, vd, vr, vr")
6995 (if_then_else:<VCONVERT>
6997 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
6998 (match_operand 4 "vector_length_operand" " rK, rK, rK, rK")
6999 (match_operand 5 "const_int_operand" " i, i, i, i")
7000 (match_operand 6 "const_int_operand" " i, i, i, i")
7001 (match_operand 7 "const_int_operand" " i, i, i, i")
7003 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
7005 [(match_operand:VF 3 "register_operand" " vr, vr, vr, vr")] UNSPEC_VFCLASS)
7006 (match_operand:<VCONVERT> 2 "vector_merge_operand" " vu, 0, vu, 0")))]
7008 "vfclass.v\t%0,%3%p1"
7009 [(set_attr "type" "vfclass")
7010 (set_attr "mode" "<MODE>")])
7012 ;; -------------------------------------------------------------------------------
7013 ;; ---- Predicated floating-point widen binary operations
7014 ;; -------------------------------------------------------------------------------
7016 ;; - 13.3 Vector Widening Floating-Point Add/Subtract Instructions
7017 ;; - 13.5 Vector Widening Floating-Point Multiply
7018 ;; -------------------------------------------------------------------------------
7020 ;; Vector Widening Add/Subtract/Multiply.
7021 (define_insn "@pred_dual_widen_<optab><mode>"
7022 [(set (match_operand:VWEXTF 0 "register_operand" "=&vr, &vr")
7023 (if_then_else:VWEXTF
7025 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
7026 (match_operand 5 "vector_length_operand" " rK, rK")
7027 (match_operand 6 "const_int_operand" " i, i")
7028 (match_operand 7 "const_int_operand" " i, i")
7029 (match_operand 8 "const_int_operand" " i, i")
7030 (match_operand 9 "const_int_operand" " i, i")
7032 (reg:SI VTYPE_REGNUM)
7033 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
7034 (any_widen_binop:VWEXTF
7035 (float_extend:VWEXTF
7036 (match_operand:<V_DOUBLE_TRUNC> 3 "register_operand" " vr, vr"))
7037 (float_extend:VWEXTF
7038 (match_operand:<V_DOUBLE_TRUNC> 4 "register_operand" " vr, vr")))
7039 (match_operand:VWEXTF 2 "vector_merge_operand" " vu, 0")))]
7041 "vfw<insn>.vv\t%0,%3,%4%p1"
7042 [(set_attr "type" "vf<widen_binop_insn_type>")
7043 (set_attr "mode" "<V_DOUBLE_TRUNC>")
7044 (set (attr "frm_mode")
7045 (symbol_ref "riscv_vector::get_frm_mode (operands[9])"))])
7047 (define_insn "@pred_dual_widen_<optab><mode>_scalar"
7048 [(set (match_operand:VWEXTF 0 "register_operand" "=vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, ?&vr, ?&vr")
7049 (if_then_else:VWEXTF
7051 [(match_operand:<VM> 1 "vector_mask_operand" " vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1,vmWc1,vmWc1")
7052 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK")
7053 (match_operand 6 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
7054 (match_operand 7 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
7055 (match_operand 8 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
7056 (match_operand 9 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
7058 (reg:SI VTYPE_REGNUM)
7059 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
7060 (any_widen_binop:VWEXTF
7061 (float_extend:VWEXTF
7062 (match_operand:<V_DOUBLE_TRUNC> 3 "register_operand" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84, vr, vr"))
7063 (float_extend:VWEXTF
7064 (vec_duplicate:<V_DOUBLE_TRUNC>
7065 (match_operand:<VSUBEL> 4 "register_operand" " f, f, f, f, f, f, f, f, f, f, f, f, f, f"))))
7066 (match_operand:VWEXTF 2 "vector_merge_operand" " vu, vu, 0, 0, vu, vu, 0, 0, vu, vu, 0, 0, vu, 0")))]
7068 "vfw<insn>.vf\t%0,%3,%4%p1"
7069 [(set_attr "type" "vf<widen_binop_insn_type>")
7070 (set_attr "mode" "<V_DOUBLE_TRUNC>")
7071 (set (attr "frm_mode")
7072 (symbol_ref "riscv_vector::get_frm_mode (operands[9])"))
7073 (set_attr "group_overlap" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84,none,none")])
7075 (define_insn "@pred_single_widen_add<mode>"
7076 [(set (match_operand:VWEXTF 0 "register_operand" "=vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, &vr, &vr, ?&vr, ?&vr")
7077 (if_then_else:VWEXTF
7079 [(match_operand:<VM> 1 "vector_mask_operand" " vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1,vmWc1,vmWc1,vmWc1,vmWc1")
7080 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK")
7081 (match_operand 6 "const_int_operand" " i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i")
7082 (match_operand 7 "const_int_operand" " i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i")
7083 (match_operand 8 "const_int_operand" " i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i")
7084 (match_operand 9 "const_int_operand" " i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i")
7086 (reg:SI VTYPE_REGNUM)
7087 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
7089 (float_extend:VWEXTF
7090 (match_operand:<V_DOUBLE_TRUNC> 4 "register_operand" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84, vr, vr, vr, vr"))
7091 (match_operand:VWEXTF 3 "register_operand" " vr, vr, vr, vr, vr, vr, vr, vr, vr, vr, vr, vr, 0, 0, vr, vr"))
7092 (match_operand:VWEXTF 2 "vector_merge_operand" " vu, vu, 0, 0, vu, vu, 0, 0, vu, vu, 0, 0, vu, 0, vu, 0")))]
7094 "vfwadd.wv\t%0,%3,%4%p1"
7095 [(set_attr "type" "vfwalu")
7096 (set_attr "mode" "<V_DOUBLE_TRUNC>")
7097 (set (attr "frm_mode")
7098 (symbol_ref "riscv_vector::get_frm_mode (operands[9])"))
7099 (set_attr "group_overlap" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84,W0,W0,none,none")])
7101 (define_insn "@pred_single_widen_sub<mode>"
7102 [(set (match_operand:VWEXTF 0 "register_operand" "=vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, &vr, &vr, ?&vr, ?&vr")
7103 (if_then_else:VWEXTF
7105 [(match_operand:<VM> 1 "vector_mask_operand" " vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1,vmWc1,vmWc1,vmWc1,vmWc1")
7106 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK")
7107 (match_operand 6 "const_int_operand" " i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i")
7108 (match_operand 7 "const_int_operand" " i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i")
7109 (match_operand 8 "const_int_operand" " i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i")
7110 (match_operand 9 "const_int_operand" " i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i")
7112 (reg:SI VTYPE_REGNUM)
7113 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
7115 (match_operand:VWEXTF 3 "register_operand" " vr, vr, vr, vr, vr, vr, vr, vr, vr, vr, vr, vr, 0, 0, vr, vr")
7116 (float_extend:VWEXTF
7117 (match_operand:<V_DOUBLE_TRUNC> 4 "register_operand" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84, vr, vr, vr, vr")))
7118 (match_operand:VWEXTF 2 "vector_merge_operand" " vu, vu, 0, 0, vu, vu, 0, 0, vu, vu, 0, 0, vu, 0, vu, 0")))]
7120 "vfwsub.wv\t%0,%3,%4%p1"
7121 [(set_attr "type" "vfwalu")
7122 (set_attr "mode" "<V_DOUBLE_TRUNC>")
7123 (set (attr "frm_mode")
7124 (symbol_ref "riscv_vector::get_frm_mode (operands[9])"))
7125 (set_attr "group_overlap" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84,W0,W0,none,none")])
7127 (define_insn "@pred_single_widen_<plus_minus:optab><mode>_scalar"
7128 [(set (match_operand:VWEXTF 0 "register_operand" "=vr, vr")
7129 (if_then_else:VWEXTF
7131 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
7132 (match_operand 5 "vector_length_operand" " rK, rK")
7133 (match_operand 6 "const_int_operand" " i, i")
7134 (match_operand 7 "const_int_operand" " i, i")
7135 (match_operand 8 "const_int_operand" " i, i")
7136 (match_operand 9 "const_int_operand" " i, i")
7138 (reg:SI VTYPE_REGNUM)
7139 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
7141 (match_operand:VWEXTF 3 "register_operand" " vr, vr")
7142 (float_extend:VWEXTF
7143 (vec_duplicate:<V_DOUBLE_TRUNC>
7144 (match_operand:<VSUBEL> 4 "register_operand" " f, f"))))
7145 (match_operand:VWEXTF 2 "vector_merge_operand" " vu, 0")))]
7147 "vfw<insn>.wf\t%0,%3,%4%p1"
7148 [(set_attr "type" "vf<widen_binop_insn_type>")
7149 (set_attr "mode" "<V_DOUBLE_TRUNC>")
7150 (set (attr "frm_mode")
7151 (symbol_ref "riscv_vector::get_frm_mode (operands[9])"))])
7153 ;; -------------------------------------------------------------------------------
7154 ;; ---- Predicated widen floating-point ternary operations
7155 ;; -------------------------------------------------------------------------------
7157 ;; - 13.7 Vector Widening Floating-Point Fused Multiply-Add Instructions
7158 ;; -------------------------------------------------------------------------------
7160 (define_insn "@pred_widen_mul_<optab><mode>"
7161 [(set (match_operand:VWEXTF 0 "register_operand" "=&vr")
7162 (if_then_else:VWEXTF
7164 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1")
7165 (match_operand 5 "vector_length_operand" " rK")
7166 (match_operand 6 "const_int_operand" " i")
7167 (match_operand 7 "const_int_operand" " i")
7168 (match_operand 8 "const_int_operand" " i")
7169 (match_operand 9 "const_int_operand" " i")
7171 (reg:SI VTYPE_REGNUM)
7172 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
7175 (float_extend:VWEXTF
7176 (match_operand:<V_DOUBLE_TRUNC> 3 "register_operand" " vr"))
7177 (float_extend:VWEXTF
7178 (match_operand:<V_DOUBLE_TRUNC> 4 "register_operand" " vr")))
7179 (match_operand:VWEXTF 2 "register_operand" " 0"))
7182 "vfw<macc_msac>.vv\t%0,%3,%4%p1"
7183 [(set_attr "type" "vfwmuladd")
7184 (set_attr "mode" "<V_DOUBLE_TRUNC>")
7185 (set (attr "frm_mode")
7186 (symbol_ref "riscv_vector::get_frm_mode (operands[9])"))])
7188 (define_insn "@pred_widen_mul_<optab><mode>_scalar"
7189 [(set (match_operand:VWEXTF 0 "register_operand" "=vd, vr, vd, vr, vd, vr, ?&vr")
7190 (if_then_else:VWEXTF
7192 [(match_operand:<VM> 1 "vector_mask_operand" " vm,Wc1, vm,Wc1, vm,Wc1,vmWc1")
7193 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK")
7194 (match_operand 6 "const_int_operand" " i, i, i, i, i, i, i")
7195 (match_operand 7 "const_int_operand" " i, i, i, i, i, i, i")
7196 (match_operand 8 "const_int_operand" " i, i, i, i, i, i, i")
7197 (match_operand 9 "const_int_operand" " i, i, i, i, i, i, i")
7199 (reg:SI VTYPE_REGNUM)
7200 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
7203 (float_extend:VWEXTF
7204 (vec_duplicate:<V_DOUBLE_TRUNC>
7205 (match_operand:<VSUBEL> 3 "register_operand" " f, f, f, f, f, f, f")))
7206 (float_extend:VWEXTF
7207 (match_operand:<V_DOUBLE_TRUNC> 4 "register_operand" "W21,W21,W42,W42,W84,W84, vr")))
7208 (match_operand:VWEXTF 2 "register_operand" " 0, 0, 0, 0, 0, 0, 0"))
7211 "vfw<macc_msac>.vf\t%0,%3,%4%p1"
7212 [(set_attr "type" "vfwmuladd")
7213 (set_attr "mode" "<V_DOUBLE_TRUNC>")
7214 (set (attr "frm_mode")
7215 (symbol_ref "riscv_vector::get_frm_mode (operands[9])"))
7216 (set_attr "group_overlap" "W21,W21,W42,W42,W84,W84,none")])
7218 (define_insn "@pred_widen_mul_neg_<optab><mode>"
7219 [(set (match_operand:VWEXTF 0 "register_operand" "=&vr")
7220 (if_then_else:VWEXTF
7222 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1")
7223 (match_operand 5 "vector_length_operand" " rK")
7224 (match_operand 6 "const_int_operand" " i")
7225 (match_operand 7 "const_int_operand" " i")
7226 (match_operand 8 "const_int_operand" " i")
7227 (match_operand 9 "const_int_operand" " i")
7229 (reg:SI VTYPE_REGNUM)
7230 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
7234 (float_extend:VWEXTF
7235 (match_operand:<V_DOUBLE_TRUNC> 3 "register_operand" " vr"))
7236 (float_extend:VWEXTF
7237 (match_operand:<V_DOUBLE_TRUNC> 4 "register_operand" " vr"))))
7238 (match_operand:VWEXTF 2 "register_operand" " 0"))
7241 "vfw<nmsac_nmacc>.vv\t%0,%3,%4%p1"
7242 [(set_attr "type" "vfwmuladd")
7243 (set_attr "mode" "<V_DOUBLE_TRUNC>")
7244 (set (attr "frm_mode")
7245 (symbol_ref "riscv_vector::get_frm_mode (operands[9])"))])
7247 (define_insn "@pred_widen_mul_neg_<optab><mode>_scalar"
7248 [(set (match_operand:VWEXTF 0 "register_operand" "=vd, vr, vd, vr, vd, vr, ?&vr")
7249 (if_then_else:VWEXTF
7251 [(match_operand:<VM> 1 "vector_mask_operand" " vm,Wc1, vm,Wc1, vm,Wc1,vmWc1")
7252 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK")
7253 (match_operand 6 "const_int_operand" " i, i, i, i, i, i, i")
7254 (match_operand 7 "const_int_operand" " i, i, i, i, i, i, i")
7255 (match_operand 8 "const_int_operand" " i, i, i, i, i, i, i")
7256 (match_operand 9 "const_int_operand" " i, i, i, i, i, i, i")
7258 (reg:SI VTYPE_REGNUM)
7259 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
7263 (float_extend:VWEXTF
7264 (vec_duplicate:<V_DOUBLE_TRUNC>
7265 (match_operand:<VSUBEL> 3 "register_operand" " f, f, f, f, f, f, f")))
7266 (float_extend:VWEXTF
7267 (match_operand:<V_DOUBLE_TRUNC> 4 "register_operand" "W21,W21,W42,W42,W84,W84, vr"))))
7268 (match_operand:VWEXTF 2 "register_operand" " 0, 0, 0, 0, 0, 0, 0"))
7271 "vfw<nmsac_nmacc>.vf\t%0,%3,%4%p1"
7272 [(set_attr "type" "vfwmuladd")
7273 (set_attr "mode" "<V_DOUBLE_TRUNC>")
7274 (set (attr "frm_mode")
7275 (symbol_ref "riscv_vector::get_frm_mode (operands[9])"))
7276 (set_attr "group_overlap" "W21,W21,W42,W42,W84,W84,none")])
7278 ;; -------------------------------------------------------------------------------
7279 ;; ---- Predicated floating-point comparison operations
7280 ;; -------------------------------------------------------------------------------
7282 ;; - 13.13 Vector Floating-Point Compare Instructions
7283 ;; -------------------------------------------------------------------------------
7285 (define_expand "@pred_cmp<mode>"
7286 [(set (match_operand:<VM> 0 "register_operand")
7289 [(match_operand:<VM> 1 "vector_mask_operand")
7290 (match_operand 6 "vector_length_operand")
7291 (match_operand 7 "const_int_operand")
7292 (match_operand 8 "const_int_operand")
7294 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
7295 (match_operator:<VM> 3 "signed_order_operator"
7296 [(match_operand:V_VLSF 4 "register_operand")
7297 (match_operand:V_VLSF 5 "register_operand")])
7298 (match_operand:<VM> 2 "vector_merge_operand")))]
7302 ;; We don't use early-clobber for LMUL <= 1 to get better codegen.
7303 (define_insn "*pred_cmp<mode>"
7304 [(set (match_operand:<VM> 0 "register_operand" "=vr, vr")
7307 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
7308 (match_operand 6 "vector_length_operand" " rK, rK")
7309 (match_operand 7 "const_int_operand" " i, i")
7310 (match_operand 8 "const_int_operand" " i, i")
7312 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
7313 (match_operator:<VM> 3 "signed_order_operator"
7314 [(match_operand:V_VLSF 4 "register_operand" " vr, vr")
7315 (match_operand:V_VLSF 5 "register_operand" " vr, vr")])
7316 (match_operand:<VM> 2 "vector_merge_operand" " vu, 0")))]
7317 "TARGET_VECTOR && riscv_vector::cmp_lmul_le_one (<MODE>mode)"
7318 "vmf%B3.vv\t%0,%4,%5%p1"
7319 [(set_attr "type" "vfcmp")
7320 (set_attr "mode" "<MODE>")])
7322 (define_insn "*pred_cmp<mode>_narrow_merge_tie_mask"
7323 [(set (match_operand:<VM> 0 "register_operand" "=vm")
7326 [(match_operand:<VM> 1 "register_operand" " 0")
7327 (match_operand 5 "vector_length_operand" " rK")
7328 (match_operand 6 "const_int_operand" " i")
7329 (match_operand 7 "const_int_operand" " i")
7331 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
7332 (match_operator:<VM> 2 "signed_order_operator"
7333 [(match_operand:V_VLSF 3 "register_operand" " vr")
7334 (match_operand:V_VLSF 4 "register_operand" " vr")])
7337 "vmf%B2.vv\t%0,%3,%4,v0.t"
7338 [(set_attr "type" "vfcmp")
7339 (set_attr "mode" "<MODE>")
7340 (set_attr "merge_op_idx" "1")
7341 (set_attr "vl_op_idx" "5")
7342 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[6])"))
7343 (set (attr "avl_type_idx") (const_int 7))])
7345 ;; We use early-clobber for source LMUL > dest LMUL.
7346 (define_insn "*pred_cmp<mode>_narrow"
7347 [(set (match_operand:<VM> 0 "register_operand" "=vm, vr, vr, vr, vr, vr, vr, &vr, &vr")
7350 [(match_operand:<VM> 1 "vector_mask_operand" " 0,vmWc1,vmWc1,vmWc1,vmWc1,vmWc1,vmWc1,vmWc1,vmWc1")
7351 (match_operand 6 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK, rK, rK")
7352 (match_operand 7 "const_int_operand" " i, i, i, i, i, i, i, i, i")
7353 (match_operand 8 "const_int_operand" " i, i, i, i, i, i, i, i, i")
7355 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
7356 (match_operator:<VM> 3 "signed_order_operator"
7357 [(match_operand:V_VLSF 4 "register_operand" " vr, 0, vr, 0, 0, vr, 0, vr, vr")
7358 (match_operand:V_VLSF 5 "register_operand" " vr, vr, 0, 0, vr, 0, 0, vr, vr")])
7359 (match_operand:<VM> 2 "vector_merge_operand" " vu, vu, vu, vu, 0, 0, 0, vu, 0")))]
7360 "TARGET_VECTOR && riscv_vector::cmp_lmul_gt_one (<MODE>mode)"
7361 "vmf%B3.vv\t%0,%4,%5%p1"
7362 [(set_attr "type" "vfcmp")
7363 (set_attr "mode" "<MODE>")])
7365 (define_expand "@pred_cmp<mode>_scalar"
7366 [(set (match_operand:<VM> 0 "register_operand")
7369 [(match_operand:<VM> 1 "vector_mask_operand")
7370 (match_operand 6 "vector_length_operand")
7371 (match_operand 7 "const_int_operand")
7372 (match_operand 8 "const_int_operand")
7374 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
7375 (match_operator:<VM> 3 "signed_order_operator"
7376 [(match_operand:V_VLSF 4 "register_operand")
7377 (vec_duplicate:V_VLSF
7378 (match_operand:<VEL> 5 "register_operand"))])
7379 (match_operand:<VM> 2 "vector_merge_operand")))]
7383 (define_insn "*pred_cmp<mode>_scalar_merge_tie_mask"
7384 [(set (match_operand:<VM> 0 "register_operand" "=vm")
7387 [(match_operand:<VM> 1 "register_operand" " 0")
7388 (match_operand 5 "vector_length_operand" " rK")
7389 (match_operand 6 "const_int_operand" " i")
7390 (match_operand 7 "const_int_operand" " i")
7392 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
7393 (match_operator:<VM> 2 "signed_order_operator"
7394 [(match_operand:V_VLSF 3 "register_operand" " vr")
7395 (vec_duplicate:V_VLSF
7396 (match_operand:<VEL> 4 "register_operand" " f"))])
7399 "vmf%B2.vf\t%0,%3,%4,v0.t"
7400 [(set_attr "type" "vfcmp")
7401 (set_attr "mode" "<MODE>")
7402 (set_attr "merge_op_idx" "1")
7403 (set_attr "vl_op_idx" "5")
7404 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[6])"))
7405 (set (attr "avl_type_idx") (const_int 7))])
7407 ;; We don't use early-clobber for LMUL <= 1 to get better codegen.
7408 (define_insn "*pred_cmp<mode>_scalar"
7409 [(set (match_operand:<VM> 0 "register_operand" "=vr, vr")
7412 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
7413 (match_operand 6 "vector_length_operand" " rK, rK")
7414 (match_operand 7 "const_int_operand" " i, i")
7415 (match_operand 8 "const_int_operand" " i, i")
7417 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
7418 (match_operator:<VM> 3 "signed_order_operator"
7419 [(match_operand:V_VLSF 4 "register_operand" " vr, vr")
7420 (vec_duplicate:V_VLSF
7421 (match_operand:<VEL> 5 "register_operand" " f, f"))])
7422 (match_operand:<VM> 2 "vector_merge_operand" " vu, 0")))]
7423 "TARGET_VECTOR && riscv_vector::cmp_lmul_le_one (<MODE>mode)"
7424 "vmf%B3.vf\t%0,%4,%5%p1"
7425 [(set_attr "type" "vfcmp")
7426 (set_attr "mode" "<MODE>")])
7428 ;; We use early-clobber for source LMUL > dest LMUL.
7429 (define_insn "*pred_cmp<mode>_scalar_narrow"
7430 [(set (match_operand:<VM> 0 "register_operand" "=vm, vr, vr, &vr, &vr")
7433 [(match_operand:<VM> 1 "vector_mask_operand" " 0,vmWc1,vmWc1,vmWc1,vmWc1")
7434 (match_operand 6 "vector_length_operand" " rK, rK, rK, rK, rK")
7435 (match_operand 7 "const_int_operand" " i, i, i, i, i")
7436 (match_operand 8 "const_int_operand" " i, i, i, i, i")
7438 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
7439 (match_operator:<VM> 3 "signed_order_operator"
7440 [(match_operand:V_VLSF 4 "register_operand" " vr, 0, 0, vr, vr")
7441 (vec_duplicate:V_VLSF
7442 (match_operand:<VEL> 5 "register_operand" " f, f, f, f, f"))])
7443 (match_operand:<VM> 2 "vector_merge_operand" " vu, vu, 0, vu, 0")))]
7444 "TARGET_VECTOR && riscv_vector::cmp_lmul_gt_one (<MODE>mode)"
7445 "vmf%B3.vf\t%0,%4,%5%p1"
7446 [(set_attr "type" "vfcmp")
7447 (set_attr "mode" "<MODE>")])
7449 (define_expand "@pred_eqne<mode>_scalar"
7450 [(set (match_operand:<VM> 0 "register_operand")
7453 [(match_operand:<VM> 1 "vector_mask_operand")
7454 (match_operand 6 "vector_length_operand")
7455 (match_operand 7 "const_int_operand")
7456 (match_operand 8 "const_int_operand")
7458 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
7459 (match_operator:<VM> 3 "equality_operator"
7460 [(vec_duplicate:V_VLSF
7461 (match_operand:<VEL> 5 "register_operand"))
7462 (match_operand:V_VLSF 4 "register_operand")])
7463 (match_operand:<VM> 2 "vector_merge_operand")))]
7467 (define_insn "*pred_eqne<mode>_scalar_merge_tie_mask"
7468 [(set (match_operand:<VM> 0 "register_operand" "=vm")
7471 [(match_operand:<VM> 1 "register_operand" " 0")
7472 (match_operand 5 "vector_length_operand" " rK")
7473 (match_operand 6 "const_int_operand" " i")
7474 (match_operand 7 "const_int_operand" " i")
7476 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
7477 (match_operator:<VM> 2 "equality_operator"
7478 [(vec_duplicate:V_VLSF
7479 (match_operand:<VEL> 4 "register_operand" " f"))
7480 (match_operand:V_VLSF 3 "register_operand" " vr")])
7483 "vmf%B2.vf\t%0,%3,%4,v0.t"
7484 [(set_attr "type" "vfcmp")
7485 (set_attr "mode" "<MODE>")
7486 (set_attr "merge_op_idx" "1")
7487 (set_attr "vl_op_idx" "5")
7488 (set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[6])"))
7489 (set (attr "avl_type_idx") (const_int 7))])
7491 ;; We don't use early-clobber for LMUL <= 1 to get better codegen.
7492 (define_insn "*pred_eqne<mode>_scalar"
7493 [(set (match_operand:<VM> 0 "register_operand" "=vr, vr")
7496 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
7497 (match_operand 6 "vector_length_operand" " rK, rK")
7498 (match_operand 7 "const_int_operand" " i, i")
7499 (match_operand 8 "const_int_operand" " i, i")
7501 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
7502 (match_operator:<VM> 3 "equality_operator"
7503 [(vec_duplicate:V_VLSF
7504 (match_operand:<VEL> 5 "register_operand" " f, f"))
7505 (match_operand:V_VLSF 4 "register_operand" " vr, vr")])
7506 (match_operand:<VM> 2 "vector_merge_operand" " vu, 0")))]
7507 "TARGET_VECTOR && riscv_vector::cmp_lmul_le_one (<MODE>mode)"
7508 "vmf%B3.vf\t%0,%4,%5%p1"
7509 [(set_attr "type" "vfcmp")
7510 (set_attr "mode" "<MODE>")])
7512 ;; We use early-clobber for source LMUL > dest LMUL.
7513 (define_insn "*pred_eqne<mode>_scalar_narrow"
7514 [(set (match_operand:<VM> 0 "register_operand" "=vm, vr, vr, &vr, &vr")
7517 [(match_operand:<VM> 1 "vector_mask_operand" " 0,vmWc1,vmWc1,vmWc1,vmWc1")
7518 (match_operand 6 "vector_length_operand" " rK, rK, rK, rK, rK")
7519 (match_operand 7 "const_int_operand" " i, i, i, i, i")
7520 (match_operand 8 "const_int_operand" " i, i, i, i, i")
7522 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
7523 (match_operator:<VM> 3 "equality_operator"
7524 [(vec_duplicate:V_VLSF
7525 (match_operand:<VEL> 5 "register_operand" " f, f, f, f, f"))
7526 (match_operand:V_VLSF 4 "register_operand" " vr, 0, 0, vr, vr")])
7527 (match_operand:<VM> 2 "vector_merge_operand" " vu, vu, 0, vu, 0")))]
7528 "TARGET_VECTOR && riscv_vector::cmp_lmul_gt_one (<MODE>mode)"
7529 "vmf%B3.vf\t%0,%4,%5%p1"
7530 [(set_attr "type" "vfcmp")
7531 (set_attr "mode" "<MODE>")])
7533 ;; -------------------------------------------------------------------------------
7534 ;; ---- Predicated floating-point merge
7535 ;; -------------------------------------------------------------------------------
7537 ;; - 13.15 Vector Floating-Point Merge Instruction
7538 ;; -------------------------------------------------------------------------------
7540 (define_insn "@pred_merge<mode>_scalar"
7541 [(set (match_operand:V_VLSF 0 "register_operand" "=vd,vd")
7542 (if_then_else:V_VLSF
7544 [(match_operand 5 "vector_length_operand" " rK,rK")
7545 (match_operand 6 "const_int_operand" " i, i")
7546 (match_operand 7 "const_int_operand" " i, i")
7548 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
7550 (vec_duplicate:V_VLSF
7551 (match_operand:<VEL> 3 "register_operand" " f, f"))
7552 (match_operand:V_VLSF 2 "register_operand" " vr,vr")
7553 (match_operand:<VM> 4 "register_operand" " vm,vm"))
7554 (match_operand:V_VLSF 1 "vector_merge_operand" " vu, 0")))]
7556 "vfmerge.vfm\t%0,%2,%3,%4"
7557 [(set_attr "type" "vfmerge")
7558 (set_attr "mode" "<MODE>")])
7560 ;; -------------------------------------------------------------------------------
7561 ;; ---- Predicated floating-point conversions
7562 ;; -------------------------------------------------------------------------------
7564 ;; - 13.17 Single-Width Floating-Point/Integer Type-Convert Instructions
7565 ;; -------------------------------------------------------------------------------
7567 (define_insn "@pred_fcvt_x<v_su>_f<mode>"
7568 [(set (match_operand:<VCONVERT> 0 "register_operand" "=vd, vd, vr, vr")
7569 (if_then_else:<VCONVERT>
7571 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
7572 (match_operand 4 "vector_length_operand" " rK, rK, rK, rK")
7573 (match_operand 5 "const_int_operand" " i, i, i, i")
7574 (match_operand 6 "const_int_operand" " i, i, i, i")
7575 (match_operand 7 "const_int_operand" " i, i, i, i")
7576 (match_operand 8 "const_int_operand" " i, i, i, i")
7578 (reg:SI VTYPE_REGNUM)
7579 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
7581 [(match_operand:V_VLSF 3 "register_operand" " vr, vr, vr, vr")] VFCVTS)
7582 (match_operand:<VCONVERT> 2 "vector_merge_operand" " vu, 0, vu, 0")))]
7584 "vfcvt.x<v_su>.f.v\t%0,%3%p1"
7585 [(set_attr "type" "vfcvtftoi")
7586 (set_attr "mode" "<MODE>")
7587 (set (attr "frm_mode")
7588 (symbol_ref "riscv_vector::get_frm_mode (operands[8])"))])
7590 (define_insn "@pred_<fix_cvt><mode>"
7591 [(set (match_operand:<VCONVERT> 0 "register_operand" "=vd, vd, vr, vr")
7592 (if_then_else:<VCONVERT>
7594 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
7595 (match_operand 4 "vector_length_operand" " rK, rK, rK, rK")
7596 (match_operand 5 "const_int_operand" " i, i, i, i")
7597 (match_operand 6 "const_int_operand" " i, i, i, i")
7598 (match_operand 7 "const_int_operand" " i, i, i, i")
7600 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
7602 (match_operand:V_VLSF 3 "register_operand" " vr, vr, vr, vr"))
7603 (match_operand:<VCONVERT> 2 "vector_merge_operand" " vu, 0, vu, 0")))]
7605 "vfcvt.rtz.x<u>.f.v\t%0,%3%p1"
7606 [(set_attr "type" "vfcvtftoi")
7607 (set_attr "mode" "<MODE>")])
7609 (define_insn "@pred_<float_cvt><mode>"
7610 [(set (match_operand:V_VLSF 0 "register_operand" "=vd, vd, vr, vr")
7611 (if_then_else:V_VLSF
7613 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
7614 (match_operand 4 "vector_length_operand" " rK, rK, rK, rK")
7615 (match_operand 5 "const_int_operand" " i, i, i, i")
7616 (match_operand 6 "const_int_operand" " i, i, i, i")
7617 (match_operand 7 "const_int_operand" " i, i, i, i")
7618 (match_operand 8 "const_int_operand" " i, i, i, i")
7620 (reg:SI VTYPE_REGNUM)
7621 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
7623 (match_operand:<VCONVERT> 3 "register_operand" " vr, vr, vr, vr"))
7624 (match_operand:V_VLSF 2 "vector_merge_operand" " vu, 0, vu, 0")))]
7626 "vfcvt.f.x<u>.v\t%0,%3%p1"
7627 [(set_attr "type" "vfcvtitof")
7628 (set_attr "mode" "<MODE>")
7629 (set (attr "frm_mode")
7630 (symbol_ref "riscv_vector::get_frm_mode (operands[8])"))])
7632 ;; -------------------------------------------------------------------------------
7633 ;; ---- Predicated floating-point widen conversions
7634 ;; -------------------------------------------------------------------------------
7636 ;; - 13.18 Widening Floating-Point/Integer Type-Convert Instructions
7637 ;; -------------------------------------------------------------------------------
7639 (define_insn "@pred_widen_fcvt_x<v_su>_f<mode>"
7640 [(set (match_operand:VWCONVERTI 0 "register_operand" "=vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, ?&vr, ?&vr")
7641 (if_then_else:VWCONVERTI
7643 [(match_operand:<VM> 1 "vector_mask_operand" " vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1,vmWc1,vmWc1")
7644 (match_operand 4 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK")
7645 (match_operand 5 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
7646 (match_operand 6 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
7647 (match_operand 7 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
7648 (match_operand 8 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
7650 (reg:SI VTYPE_REGNUM)
7651 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
7653 [(match_operand:<VNCONVERT> 3 "register_operand" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84, vr, vr")] VFCVTS)
7654 (match_operand:VWCONVERTI 2 "vector_merge_operand" " vu, vu, 0, 0, vu, vu, 0, 0, vu, vu, 0, 0, vu, 0")))]
7656 "vfwcvt.x<v_su>.f.v\t%0,%3%p1"
7657 [(set_attr "type" "vfwcvtftoi")
7658 (set_attr "mode" "<VNCONVERT>")
7659 (set (attr "frm_mode")
7660 (symbol_ref "riscv_vector::get_frm_mode (operands[8])"))
7661 (set_attr "group_overlap" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84,none,none")])
7663 (define_insn "@pred_widen_<fix_cvt><mode>"
7664 [(set (match_operand:VWCONVERTI 0 "register_operand" "=vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, ?&vr, ?&vr")
7665 (if_then_else:VWCONVERTI
7667 [(match_operand:<VM> 1 "vector_mask_operand" " vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1,vmWc1,vmWc1")
7668 (match_operand 4 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK")
7669 (match_operand 5 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
7670 (match_operand 6 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
7671 (match_operand 7 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
7673 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
7675 (match_operand:<VNCONVERT> 3 "register_operand" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84, vr, vr"))
7676 (match_operand:VWCONVERTI 2 "vector_merge_operand" " vu, vu, 0, 0, vu, vu, 0, 0, vu, vu, 0, 0, vu, 0")))]
7678 "vfwcvt.rtz.x<u>.f.v\t%0,%3%p1"
7679 [(set_attr "type" "vfwcvtftoi")
7680 (set_attr "mode" "<VNCONVERT>")
7681 (set_attr "group_overlap" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84,none,none")])
7683 (define_insn "@pred_widen_<float_cvt><mode>"
7684 [(set (match_operand:V_VLSF 0 "register_operand" "=vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, ?&vr, ?&vr")
7685 (if_then_else:V_VLSF
7687 [(match_operand:<VM> 1 "vector_mask_operand" " vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1,vmWc1,vmWc1")
7688 (match_operand 4 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK")
7689 (match_operand 5 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
7690 (match_operand 6 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
7691 (match_operand 7 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
7693 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
7695 (match_operand:<VNCONVERT> 3 "register_operand" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84, vr, vr"))
7696 (match_operand:V_VLSF 2 "vector_merge_operand" " vu, vu, 0, 0, vu, vu, 0, 0, vu, vu, 0, 0, vu, 0")))]
7698 "vfwcvt.f.x<u>.v\t%0,%3%p1"
7699 [(set_attr "type" "vfwcvtitof")
7700 (set_attr "mode" "<VNCONVERT>")
7701 (set_attr "group_overlap" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84,none,none")])
7703 (define_insn "@pred_extend<mode>"
7704 [(set (match_operand:VWEXTF_ZVFHMIN 0 "register_operand" "=vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, ?&vr, ?&vr")
7705 (if_then_else:VWEXTF_ZVFHMIN
7707 [(match_operand:<VM> 1 "vector_mask_operand" " vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1,vmWc1,vmWc1")
7708 (match_operand 4 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK")
7709 (match_operand 5 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
7710 (match_operand 6 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
7711 (match_operand 7 "const_int_operand" "i, i, i, i, i, i, i, i, i, i, i, i, i, i")
7713 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
7714 (float_extend:VWEXTF_ZVFHMIN
7715 (match_operand:<V_DOUBLE_TRUNC> 3 "register_operand" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84, vr, vr"))
7716 (match_operand:VWEXTF_ZVFHMIN 2 "vector_merge_operand" " vu, vu, 0, 0, vu, vu, 0, 0, vu, vu, 0, 0, vu, 0")))]
7718 "vfwcvt.f.f.v\t%0,%3%p1"
7719 [(set_attr "type" "vfwcvtftof")
7720 (set_attr "mode" "<V_DOUBLE_TRUNC>")
7721 (set_attr "group_overlap" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84,none,none")])
7723 ;; -------------------------------------------------------------------------------
7724 ;; ---- Predicated floating-point narrow conversions
7725 ;; -------------------------------------------------------------------------------
7727 ;; - 13.19 Narrowing Floating-Point/Integer Type-Convert Instructions
7728 ;; -------------------------------------------------------------------------------
7730 (define_insn "@pred_narrow_fcvt_x<v_su>_f<mode>"
7731 [(set (match_operand:<VNCONVERT> 0 "register_operand" "=vd, vd, vr, vr, &vr, &vr")
7732 (if_then_else:<VNCONVERT>
7734 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1,vmWc1,vmWc1")
7735 (match_operand 4 "vector_length_operand" " rK, rK, rK, rK, rK, rK")
7736 (match_operand 5 "const_int_operand" " i, i, i, i, i, i")
7737 (match_operand 6 "const_int_operand" " i, i, i, i, i, i")
7738 (match_operand 7 "const_int_operand" " i, i, i, i, i, i")
7739 (match_operand 8 "const_int_operand" " i, i, i, i, i, i")
7741 (reg:SI VTYPE_REGNUM)
7742 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
7744 [(match_operand:V_VLSF 3 "register_operand" " 0, 0, 0, 0, vr, vr")] VFCVTS)
7745 (match_operand:<VNCONVERT> 2 "vector_merge_operand" " vu, 0, vu, 0, vu, 0")))]
7747 "vfncvt.x<v_su>.f.w\t%0,%3%p1"
7748 [(set_attr "type" "vfncvtftoi")
7749 (set_attr "mode" "<VNCONVERT>")
7750 (set (attr "frm_mode")
7751 (symbol_ref "riscv_vector::get_frm_mode (operands[8])"))])
7753 (define_insn "@pred_narrow_<fix_cvt><mode>"
7754 [(set (match_operand:<VNCONVERT> 0 "register_operand" "=vd, vd, vr, vr, &vr, &vr")
7755 (if_then_else:<VNCONVERT>
7757 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1,vmWc1,vmWc1")
7758 (match_operand 4 "vector_length_operand" " rK, rK, rK, rK, rK, rK")
7759 (match_operand 5 "const_int_operand" " i, i, i, i, i, i")
7760 (match_operand 6 "const_int_operand" " i, i, i, i, i, i")
7761 (match_operand 7 "const_int_operand" " i, i, i, i, i, i")
7763 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
7764 (any_fix:<VNCONVERT>
7765 (match_operand:V_VLSF 3 "register_operand" " 0, 0, 0, 0, vr, vr"))
7766 (match_operand:<VNCONVERT> 2 "vector_merge_operand" " vu, 0, vu, 0, vu, 0")))]
7768 "vfncvt.rtz.x<u>.f.w\t%0,%3%p1"
7769 [(set_attr "type" "vfncvtftoi")
7770 (set_attr "mode" "<VNCONVERT>")])
7772 (define_insn "@pred_narrow_<float_cvt><mode>"
7773 [(set (match_operand:<VNCONVERT> 0 "register_operand" "=vd, vd, vr, vr, &vr, &vr")
7774 (if_then_else:<VNCONVERT>
7776 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1,vmWc1,vmWc1")
7777 (match_operand 4 "vector_length_operand" " rK, rK, rK, rK, rK, rK")
7778 (match_operand 5 "const_int_operand" " i, i, i, i, i, i")
7779 (match_operand 6 "const_int_operand" " i, i, i, i, i, i")
7780 (match_operand 7 "const_int_operand" " i, i, i, i, i, i")
7781 (match_operand 8 "const_int_operand" " i, i, i, i, i, i")
7783 (reg:SI VTYPE_REGNUM)
7784 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
7785 (any_float:<VNCONVERT>
7786 (match_operand:VWCONVERTI 3 "register_operand" " 0, 0, 0, 0, vr, vr"))
7787 (match_operand:<VNCONVERT> 2 "vector_merge_operand" " vu, 0, vu, 0, vu, 0")))]
7789 "vfncvt.f.x<u>.w\t%0,%3%p1"
7790 [(set_attr "type" "vfncvtitof")
7791 (set_attr "mode" "<VNCONVERT>")
7792 (set (attr "frm_mode")
7793 (symbol_ref "riscv_vector::get_frm_mode (operands[8])"))])
7795 (define_insn "@pred_trunc<mode>"
7796 [(set (match_operand:<V_DOUBLE_TRUNC> 0 "register_operand" "=vd, vd, vr, vr, &vr, &vr")
7797 (if_then_else:<V_DOUBLE_TRUNC>
7799 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1,vmWc1,vmWc1")
7800 (match_operand 4 "vector_length_operand" " rK, rK, rK, rK, rK, rK")
7801 (match_operand 5 "const_int_operand" " i, i, i, i, i, i")
7802 (match_operand 6 "const_int_operand" " i, i, i, i, i, i")
7803 (match_operand 7 "const_int_operand" " i, i, i, i, i, i")
7804 (match_operand 8 "const_int_operand" " i, i, i, i, i, i")
7806 (reg:SI VTYPE_REGNUM)
7807 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
7808 (float_truncate:<V_DOUBLE_TRUNC>
7809 (match_operand:VWEXTF_ZVFHMIN 3 "register_operand" " 0, 0, 0, 0, vr, vr"))
7810 (match_operand:<V_DOUBLE_TRUNC> 2 "vector_merge_operand" " vu, 0, vu, 0, vu, 0")))]
7812 "vfncvt.f.f.w\t%0,%3%p1"
7813 [(set_attr "type" "vfncvtftof")
7814 (set_attr "mode" "<V_DOUBLE_TRUNC>")
7815 (set (attr "frm_mode")
7816 (symbol_ref "riscv_vector::get_frm_mode (operands[8])"))])
7818 (define_insn "@pred_rod_trunc<mode>"
7819 [(set (match_operand:<V_DOUBLE_TRUNC> 0 "register_operand" "=vd, vd, vr, vr, &vr, &vr")
7820 (if_then_else:<V_DOUBLE_TRUNC>
7822 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1,vmWc1,vmWc1")
7823 (match_operand 4 "vector_length_operand" " rK, rK, rK, rK, rK, rK")
7824 (match_operand 5 "const_int_operand" " i, i, i, i, i, i")
7825 (match_operand 6 "const_int_operand" " i, i, i, i, i, i")
7826 (match_operand 7 "const_int_operand" " i, i, i, i, i, i")
7828 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
7829 (unspec:<V_DOUBLE_TRUNC>
7830 [(float_truncate:<V_DOUBLE_TRUNC>
7831 (match_operand:VWEXTF_ZVFHMIN 3 "register_operand" " 0, 0, 0, 0, vr, vr"))] UNSPEC_ROD)
7832 (match_operand:<V_DOUBLE_TRUNC> 2 "vector_merge_operand" " vu, 0, vu, 0, vu, 0")))]
7834 "vfncvt.rod.f.f.w\t%0,%3%p1"
7835 [(set_attr "type" "vfncvtftof")
7836 (set_attr "mode" "<V_DOUBLE_TRUNC>")])
7838 ;; -------------------------------------------------------------------------------
7839 ;; ---- Predicated reduction operations
7840 ;; -------------------------------------------------------------------------------
7842 ;; - 14.1 Vector Single-Width Integer Reduction Instructions
7843 ;; - 14.2 Vector Widening Integer Reduction Instructions
7844 ;; - 14.3 Vector Single-Width Floating-Point Reduction Instructions
7845 ;; - 14.4 Vector Widening Floating-Point Reduction Instructions
7846 ;; -------------------------------------------------------------------------------
7848 ;; Integer Reduction (vred(sum|maxu|max|minu|min|and|or|xor).vs)
7849 (define_insn "@pred_<reduc_op><mode>"
7850 [(set (match_operand:<V_LMUL1> 0 "register_operand" "=vr, vr")
7853 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
7854 (match_operand 5 "vector_length_operand" " rK, rK")
7855 (match_operand 6 "const_int_operand" " i, i")
7856 (match_operand 7 "const_int_operand" " i, i")
7858 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
7860 (match_operand:V_VLSI 3 "register_operand" " vr, vr")
7861 (match_operand:<V_LMUL1> 4 "register_operand" " vr, vr")
7863 (match_operand:<V_LMUL1> 2 "vector_merge_operand" " vu, 0")] UNSPEC_REDUC))]
7865 "v<reduc_op>.vs\t%0,%3,%4%p1"
7866 [(set_attr "type" "vired")
7867 (set_attr "mode" "<MODE>")])
7869 ;; Integer Widen Reduction Sum (vwredsum[u].vs)
7870 (define_insn "@pred_<reduc_op><mode>"
7871 [(set (match_operand:<V_EXT_LMUL1> 0 "register_operand" "=vr, vr")
7872 (unspec:<V_EXT_LMUL1>
7874 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
7875 (match_operand 5 "vector_length_operand" " rK, rK")
7876 (match_operand 6 "const_int_operand" " i, i")
7877 (match_operand 7 "const_int_operand" " i, i")
7879 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
7880 (unspec:<V_EXT_LMUL1> [
7881 (match_operand:VI_QHS 3 "register_operand" " vr, vr")
7882 (match_operand:<V_EXT_LMUL1> 4 "register_operand" " vr, vr")
7884 (match_operand:<V_EXT_LMUL1> 2 "vector_merge_operand" " vu, 0")] UNSPEC_REDUC))]
7886 "v<reduc_op>.vs\t%0,%3,%4%p1"
7887 [(set_attr "type" "viwred")
7888 (set_attr "mode" "<MODE>")])
7890 ;; Float Reduction (vfred(max|min).vs)
7891 (define_insn "@pred_<reduc_op><mode>"
7892 [(set (match_operand:<V_LMUL1> 0 "register_operand" "=vr, vr")
7895 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
7896 (match_operand 5 "vector_length_operand" " rK, rK")
7897 (match_operand 6 "const_int_operand" " i, i")
7898 (match_operand 7 "const_int_operand" " i, i")
7900 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
7902 (match_operand:V_VLSF 3 "register_operand" " vr, vr")
7903 (match_operand:<V_LMUL1> 4 "register_operand" " vr, vr")
7905 (match_operand:<V_LMUL1> 2 "vector_merge_operand" " vu, 0")] UNSPEC_REDUC))]
7907 "vf<reduc_op>.vs\t%0,%3,%4%p1"
7908 [(set_attr "type" "vfredu")
7909 (set_attr "mode" "<MODE>")])
7911 ;; Float Reduction Sum (vfred[ou]sum.vs)
7912 (define_insn "@pred_<reduc_op><mode>"
7913 [(set (match_operand:<V_LMUL1> 0 "register_operand" "=vr,vr")
7916 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
7917 (match_operand 5 "vector_length_operand" " rK, rK")
7918 (match_operand 6 "const_int_operand" " i, i")
7919 (match_operand 7 "const_int_operand" " i, i")
7920 (match_operand 8 "const_int_operand" " i, i")
7922 (reg:SI VTYPE_REGNUM)
7923 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
7925 (match_operand:V_VLSF 3 "register_operand" " vr, vr")
7926 (match_operand:<V_LMUL1> 4 "register_operand" " vr, vr")
7928 (match_operand:<V_LMUL1> 2 "vector_merge_operand" " vu, 0")] UNSPEC_REDUC))]
7930 "vf<reduc_op>.vs\t%0,%3,%4%p1"
7931 [(set_attr "type" "vfred<order>")
7932 (set_attr "mode" "<MODE>")
7933 (set (attr "frm_mode")
7934 (symbol_ref "riscv_vector::get_frm_mode (operands[8])"))])
7936 ;; Float Widen Reduction Sum (vfwred[ou]sum.vs)
7937 (define_insn "@pred_<reduc_op><mode>"
7938 [(set (match_operand:<V_EXT_LMUL1> 0 "register_operand" "=vr, vr")
7939 (unspec:<V_EXT_LMUL1>
7941 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
7942 (match_operand 5 "vector_length_operand" " rK, rK")
7943 (match_operand 6 "const_int_operand" " i, i")
7944 (match_operand 7 "const_int_operand" " i, i")
7945 (match_operand 8 "const_int_operand" " i, i")
7947 (reg:SI VTYPE_REGNUM)
7948 (reg:SI FRM_REGNUM)] UNSPEC_VPREDICATE)
7949 (unspec:<V_EXT_LMUL1> [
7950 (match_operand:VF_HS 3 "register_operand" " vr, vr")
7951 (match_operand:<V_EXT_LMUL1> 4 "register_operand" " vr, vr")
7953 (match_operand:<V_EXT_LMUL1> 2 "vector_merge_operand" " vu, 0")] UNSPEC_REDUC))]
7955 "vf<reduc_op>.vs\t%0,%3,%4%p1"
7956 [(set_attr "type" "vfwred<order>")
7957 (set_attr "mode" "<MODE>")
7958 (set (attr "frm_mode")
7959 (symbol_ref "riscv_vector::get_frm_mode (operands[8])"))])
7961 ;; -------------------------------------------------------------------------------
7962 ;; ---- Predicated permutation operations
7963 ;; -------------------------------------------------------------------------------
7965 ;; - 16.1 Integer Scalar Move Instructions
7966 ;; - 16.2 Floating-Point Scalar Move Instructions
7967 ;; - 16.3 Vector Slide Instructions
7968 ;; - 16.4 Vector Register Gather Instructions
7969 ;; - 16.5 Vector Compress Instruction
7970 ;; -------------------------------------------------------------------------------
7972 (define_expand "@pred_extract_first<mode>"
7973 [(set (match_operand:<VEL> 0 "register_operand")
7976 (match_operand:V_VLSI 1 "reg_or_mem_operand")
7977 (parallel [(const_int 0)]))
7978 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE))]
7981 if (MEM_P (operands[1]))
7983 /* Combine vle.v + vmv.x.s ==> lw. */
7984 emit_move_insn (operands[0], gen_rtx_MEM (<VEL>mode, XEXP (operands[1], 0)));
7989 (define_insn_and_split "*pred_extract_first<mode>"
7990 [(set (match_operand:<VEL> 0 "register_operand" "=r")
7993 (match_operand:V_VLSI 1 "register_operand" "vr")
7994 (parallel [(const_int 0)]))
7995 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE))]
7998 "known_gt (GET_MODE_BITSIZE (<VEL>mode), GET_MODE_BITSIZE (Pmode))"
8001 /* In rv32 system, we can't use vmv.x.s directly.
8002 Instead, we should generate this following code sequence:
8006 rtx nbits = force_reg (Pmode, gen_int_mode (GET_MODE_BITSIZE (Pmode), Pmode));
8007 rtx high_bits = gen_reg_rtx (<MODE>mode);
8008 emit_insn (gen_pred_scalar (LSHIFTRT, <MODE>mode, high_bits, CONSTM1_RTX (<VM>mode),
8009 RVV_VUNDEF (<MODE>mode), operands[1], nbits, /* vl */ const1_rtx,
8010 gen_int_mode (riscv_vector::TAIL_ANY, Pmode),
8011 gen_int_mode (riscv_vector::MASK_ANY, Pmode),
8012 gen_int_mode (riscv_vector::NONVLMAX, Pmode)));
8013 emit_insn (gen_pred_extract_first_trunc (<MODE>mode,
8014 gen_highpart (SImode, operands[0]), high_bits));
8015 emit_insn (gen_pred_extract_first_trunc (<MODE>mode,
8016 gen_lowpart (SImode, operands[0]), operands[1]));
8019 [(set_attr "type" "vimovvx")
8020 (set_attr "mode" "<MODE>")])
8022 (define_insn "@pred_extract_first_trunc<mode>"
8023 [(set (match_operand:SI 0 "register_operand" "=r")
8027 (match_operand:V_VLSI_D 1 "register_operand" "vr")
8028 (parallel [(const_int 0)]))
8029 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)))]
8032 [(set_attr "type" "vimovvx")
8033 (set_attr "mode" "<MODE>")])
8035 (define_expand "@pred_extract_first<mode>"
8036 [(set (match_operand:<VEL> 0 "register_operand")
8039 (match_operand:V_VLSF 1 "reg_or_mem_operand")
8040 (parallel [(const_int 0)]))
8041 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE))]
8044 if (MEM_P (operands[1]))
8046 /* Combine vle.v + vmv.f.s ==> flw. */
8047 emit_move_insn (operands[0], gen_rtx_MEM (<VEL>mode, XEXP (operands[1], 0)));
8052 (define_insn "*pred_extract_first<mode>"
8053 [(set (match_operand:<VEL> 0 "register_operand" "=f")
8056 (match_operand:V_VLSF 1 "register_operand" "vr")
8057 (parallel [(const_int 0)]))
8058 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE))]
8061 [(set_attr "type" "vfmovvf")
8062 (set_attr "mode" "<MODE>")])
8064 ;; vslide instructions
8065 (define_insn "@pred_slide<ud><mode>"
8066 [(set (match_operand:V_VLS 0 "register_operand" "<ud_constraint>")
8069 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
8070 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
8071 (match_operand 6 "const_int_operand" " i, i, i, i")
8072 (match_operand 7 "const_int_operand" " i, i, i, i")
8073 (match_operand 8 "const_int_operand" " i, i, i, i")
8075 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8076 (match_operand:V_VLS 2 "vector_merge_operand" " vu, 0, vu, 0")
8077 (match_operand:V_VLS 3 "register_operand" " vr, vr, vr, vr")
8078 (match_operand 4 "pmode_reg_or_uimm5_operand" " rK, rK, rK, rK")] VSLIDES))]
8080 "vslide<ud>.v%o4\t%0,%3,%4%p1"
8081 [(set_attr "type" "vslide<ud>")
8082 (set_attr "mode" "<MODE>")])
8084 ;; vslide1 instructions
8085 (define_insn "@pred_slide<ud><mode>"
8086 [(set (match_operand:V_VLSI_QHS 0 "register_operand" "<ud_constraint>")
8089 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
8090 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
8091 (match_operand 6 "const_int_operand" " i, i, i, i")
8092 (match_operand 7 "const_int_operand" " i, i, i, i")
8093 (match_operand 8 "const_int_operand" " i, i, i, i")
8095 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8096 (match_operand:V_VLSI_QHS 2 "vector_merge_operand" " vu, 0, vu, 0")
8097 (match_operand:V_VLSI_QHS 3 "register_operand" " vr, vr, vr, vr")
8098 (match_operand:<VEL> 4 "reg_or_0_operand" " rJ, rJ, rJ, rJ")] VSLIDES1))]
8100 "vslide<ud>.vx\t%0,%3,%z4%p1"
8101 [(set_attr "type" "vislide<ud>")
8102 (set_attr "mode" "<MODE>")])
8104 (define_expand "@pred_slide<ud><mode>"
8105 [(set (match_operand:V_VLSI_D 0 "register_operand")
8108 [(match_operand:<VM> 1 "vector_mask_operand")
8109 (match_operand 5 "reg_or_int_operand")
8110 (match_operand 6 "const_int_operand")
8111 (match_operand 7 "const_int_operand")
8112 (match_operand 8 "const_int_operand")
8114 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8115 (match_operand:V_VLSI_D 2 "vector_merge_operand")
8116 (match_operand:V_VLSI_D 3 "register_operand")
8117 (match_operand:<VEL> 4 "reg_or_int_operand")] VSLIDES1))]
8120 poly_uint64 nunits = GET_MODE_NUNITS (<MODE>mode) * 2;
8121 machine_mode vsimode = riscv_vector::get_vector_mode (SImode, nunits).require ();
8122 machine_mode vbimode = riscv_vector::get_vector_mode (BImode, nunits).require ();
8123 if (riscv_vector::slide1_sew64_helper (<UNSPEC>, <MODE>mode,
8129 (define_insn "*pred_slide<ud><mode>"
8130 [(set (match_operand:V_VLSI_D 0 "register_operand" "<ud_constraint>")
8133 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
8134 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
8135 (match_operand 6 "const_int_operand" " i, i, i, i")
8136 (match_operand 7 "const_int_operand" " i, i, i, i")
8137 (match_operand 8 "const_int_operand" " i, i, i, i")
8139 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8140 (match_operand:V_VLSI_D 2 "vector_merge_operand" " vu, 0, vu, 0")
8141 (match_operand:V_VLSI_D 3 "register_operand" " vr, vr, vr, vr")
8142 (match_operand:<VEL> 4 "reg_or_0_operand" " rJ, rJ, rJ, rJ")] VSLIDES1))]
8144 "vslide<ud>.vx\t%0,%3,%z4%p1"
8145 [(set_attr "type" "vislide<ud>")
8146 (set_attr "mode" "<MODE>")])
8148 (define_insn "*pred_slide<ud><mode>_extended"
8149 [(set (match_operand:V_VLSI_D 0 "register_operand" "<ud_constraint>")
8152 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
8153 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
8154 (match_operand 6 "const_int_operand" " i, i, i, i")
8155 (match_operand 7 "const_int_operand" " i, i, i, i")
8156 (match_operand 8 "const_int_operand" " i, i, i, i")
8158 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8159 (match_operand:V_VLSI_D 2 "vector_merge_operand" " vu, 0, vu, 0")
8160 (match_operand:V_VLSI_D 3 "register_operand" " vr, vr, vr, vr")
8162 (match_operand:<VSUBEL> 4 "reg_or_0_operand" " rJ, rJ, rJ, rJ"))] VSLIDES1))]
8163 "TARGET_VECTOR && !TARGET_64BIT"
8164 "vslide<ud>.vx\t%0,%3,%z4%p1"
8165 [(set_attr "type" "vislide<ud>")
8166 (set_attr "mode" "<MODE>")])
8168 ;; vfslide1 instructions
8169 (define_insn "@pred_slide<ud><mode>"
8170 [(set (match_operand:V_VLSF 0 "register_operand" "<ud_constraint>")
8173 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
8174 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
8175 (match_operand 6 "const_int_operand" " i, i, i, i")
8176 (match_operand 7 "const_int_operand" " i, i, i, i")
8177 (match_operand 8 "const_int_operand" " i, i, i, i")
8179 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8180 (match_operand:V_VLSF 2 "vector_merge_operand" " vu, 0, vu, 0")
8181 (match_operand:V_VLSF 3 "register_operand" " vr, vr, vr, vr")
8182 (match_operand:<VEL> 4 "register_operand" " f, f, f, f")] VFSLIDES1))]
8184 "vfslide<ud>.vf\t%0,%3,%4%p1"
8185 [(set_attr "type" "vfslide<ud>")
8186 (set_attr "mode" "<MODE>")])
8189 (define_insn "@pred_gather<mode>"
8190 [(set (match_operand:V_VLS 0 "register_operand" "=&vr, &vr")
8193 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
8194 (match_operand 5 "vector_length_operand" " rK, rK")
8195 (match_operand 6 "const_int_operand" " i, i")
8196 (match_operand 7 "const_int_operand" " i, i")
8197 (match_operand 8 "const_int_operand" " i, i")
8199 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8201 [(match_operand:V_VLS 3 "register_operand" " vr, vr")
8202 (match_operand:<VINDEX> 4 "register_operand" " vr, vr")] UNSPEC_VRGATHER)
8203 (match_operand:V_VLS 2 "vector_merge_operand" " vu, 0")))]
8205 "vrgather.vv\t%0,%3,%4%p1"
8206 [(set_attr "type" "vgather")
8207 (set_attr "mode" "<MODE>")])
8209 (define_insn "@pred_gather<mode>_scalar"
8210 [(set (match_operand:V_VLS 0 "register_operand" "=&vr, &vr")
8213 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
8214 (match_operand 5 "vector_length_operand" " rK, rK")
8215 (match_operand 6 "const_int_operand" " i, i")
8216 (match_operand 7 "const_int_operand" " i, i")
8217 (match_operand 8 "const_int_operand" " i, i")
8219 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8221 [(match_operand:V_VLS 3 "register_operand" " vr, vr")
8222 (match_operand 4 "pmode_reg_or_uimm5_operand" " rK, rK")] UNSPEC_VRGATHER)
8223 (match_operand:V_VLS 2 "vector_merge_operand" " vu, 0")))]
8225 "vrgather.v%o4\t%0,%3,%4%p1"
8226 [(set_attr "type" "vgather")
8227 (set_attr "mode" "<MODE>")])
8230 (define_insn "@pred_gatherei16<mode>"
8231 [(set (match_operand:VEI16 0 "register_operand" "=&vr, &vr")
8234 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
8235 (match_operand 5 "vector_length_operand" " rK, rK")
8236 (match_operand 6 "const_int_operand" " i, i")
8237 (match_operand 7 "const_int_operand" " i, i")
8238 (match_operand 8 "const_int_operand" " i, i")
8240 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8242 [(match_operand:VEI16 3 "register_operand" " vr, vr")
8243 (match_operand:<VINDEXEI16> 4 "register_operand" " vr, vr")] UNSPEC_VRGATHEREI16)
8244 (match_operand:VEI16 2 "vector_merge_operand" " vu, 0")))]
8246 "vrgatherei16.vv\t%0,%3,%4%p1"
8247 [(set_attr "type" "vgather")
8248 (set_attr "mode" "<MODE>")])
8251 (define_insn "@pred_compress<mode>"
8252 [(set (match_operand:V_VLS 0 "register_operand" "=&vr, &vr")
8255 [(match_operand:<VM> 3 "register_operand" " vm, vm")
8256 (match_operand 4 "vector_length_operand" " rK, rK")
8257 (match_operand 5 "const_int_operand" " i, i")
8258 (match_operand 6 "const_int_operand" " i, i")
8260 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8261 (match_operand:V_VLS 2 "register_operand" " vr, vr")
8262 (match_operand:V_VLS 1 "vector_merge_operand" " vu, 0")] UNSPEC_VCOMPRESS))]
8264 "vcompress.vm\t%0,%2,%3"
8265 [(set_attr "type" "vcompress")
8266 (set_attr "mode" "<MODE>")])
8268 ;; -------------------------------------------------------------------------------
8269 ;; ---- Predicated Fault-Only-First loads
8270 ;; -------------------------------------------------------------------------------
8272 ;; - 7.7. Unit-stride Fault-Only-First Loads
8273 ;; -------------------------------------------------------------------------------
8275 (define_insn "read_vlsi"
8276 [(set (match_operand:SI 0 "register_operand" "=r")
8277 (reg:SI VL_REGNUM))]
8280 [(set_attr "type" "rdvl")
8281 (set_attr "mode" "SI")])
8283 (define_insn "read_vldi_zero_extend"
8284 [(set (match_operand:DI 0 "register_operand" "=r")
8285 (zero_extend:DI (reg:SI VL_REGNUM)))]
8286 "TARGET_VECTOR && TARGET_64BIT"
8288 [(set_attr "type" "rdvl")
8289 (set_attr "mode" "DI")])
8291 (define_insn "@pred_fault_load<mode>"
8292 [(set (match_operand:V 0 "register_operand" "=vd, vd, vr, vr")
8295 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm, Wc1, Wc1")
8296 (match_operand 4 "vector_length_operand" " rK, rK, rK, rK")
8297 (match_operand 5 "const_int_operand" " i, i, i, i")
8298 (match_operand 6 "const_int_operand" " i, i, i, i")
8299 (match_operand 7 "const_int_operand" " i, i, i, i")
8301 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8303 [(match_operand:V 3 "memory_operand" " m, m, m, m")] UNSPEC_VLEFF)
8304 (match_operand:V 2 "vector_merge_operand" " vu, 0, vu, 0")))
8305 (set (reg:SI VL_REGNUM)
8309 [(match_dup 1) (match_dup 4) (match_dup 5)
8310 (match_dup 6) (match_dup 7)
8311 (reg:SI VL_REGNUM) (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8312 (unspec:V [(match_dup 3)] UNSPEC_VLEFF)
8313 (match_dup 2))] UNSPEC_MODIFY_VL))]
8315 "vle<sew>ff.v\t%0,%3%p1"
8316 [(set_attr "type" "vldff")
8317 (set_attr "mode" "<MODE>")])
8320 ;; -------------------------------------------------------------------------------
8321 ;; ---- Predicated Segment loads/stores
8322 ;; -------------------------------------------------------------------------------
8324 ;; - 7.8.1. Vector Unit-Stride Segment Loads and Stores
8325 ;; - 7.8.2. Vector Strided Segment Loads and Stores
8326 ;; - 7.8.3. Vector Indexed Segment Loads and Stores
8327 ;; -------------------------------------------------------------------------------
8329 (define_insn "@pred_unit_strided_load<mode>"
8330 [(set (match_operand:VT 0 "register_operand" "=vr, vr, vd")
8333 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1, Wc1, vm")
8334 (match_operand 4 "vector_length_operand" " rK, rK, rK")
8335 (match_operand 5 "const_int_operand" " i, i, i")
8336 (match_operand 6 "const_int_operand" " i, i, i")
8337 (match_operand 7 "const_int_operand" " i, i, i")
8339 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8341 [(match_operand 3 "pmode_reg_or_0_operand" " rJ, rJ, rJ")
8342 (mem:BLK (scratch))] UNSPEC_UNIT_STRIDED)
8343 (match_operand:VT 2 "vector_merge_operand" " 0, vu, vu")))]
8345 "vlseg<nf>e<sew>.v\t%0,(%z3)%p1"
8346 [(set_attr "type" "vlsegde")
8347 (set_attr "mode" "<MODE>")])
8349 (define_insn "@pred_unit_strided_store<mode>"
8350 [(set (mem:BLK (scratch))
8353 [(match_operand:<VM> 0 "vector_mask_operand" "vmWc1")
8354 (match_operand 3 "vector_length_operand" " rK")
8355 (match_operand 4 "const_int_operand" " i")
8357 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8358 (match_operand 1 "pmode_reg_or_0_operand" " rJ")
8359 (match_operand:VT 2 "register_operand" " vr")
8360 (mem:BLK (scratch))] UNSPEC_UNIT_STRIDED))]
8362 "vsseg<nf>e<sew>.v\t%2,(%z1)%p0"
8363 [(set_attr "type" "vssegte")
8364 (set_attr "mode" "<MODE>")])
8366 (define_insn "@pred_strided_load<mode>"
8367 [(set (match_operand:VT 0 "register_operand" "=vr, vr, vd")
8370 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1, Wc1, vm")
8371 (match_operand 5 "vector_length_operand" " rK, rK, rK")
8372 (match_operand 6 "const_int_operand" " i, i, i")
8373 (match_operand 7 "const_int_operand" " i, i, i")
8374 (match_operand 8 "const_int_operand" " i, i, i")
8376 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8378 [(match_operand 3 "pmode_reg_or_0_operand" " rJ, rJ, rJ")
8379 (match_operand 4 "pmode_reg_or_0_operand" " rJ, rJ, rJ")
8380 (mem:BLK (scratch))] UNSPEC_STRIDED)
8381 (match_operand:VT 2 "vector_merge_operand" " 0, vu, vu")))]
8383 "vlsseg<nf>e<sew>.v\t%0,(%z3),%z4%p1"
8384 [(set_attr "type" "vlsegds")
8385 (set_attr "mode" "<MODE>")])
8387 (define_insn "@pred_strided_store<mode>"
8388 [(set (mem:BLK (scratch))
8391 [(match_operand:<VM> 0 "vector_mask_operand" "vmWc1")
8392 (match_operand 4 "vector_length_operand" " rK")
8393 (match_operand 5 "const_int_operand" " i")
8395 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8396 (match_operand 1 "pmode_reg_or_0_operand" " rJ")
8397 (match_operand 2 "pmode_reg_or_0_operand" " rJ")
8398 (match_operand:VT 3 "register_operand" " vr")
8399 (mem:BLK (scratch))] UNSPEC_STRIDED))]
8401 "vssseg<nf>e<sew>.v\t%3,(%z1),%z2%p0"
8402 [(set_attr "type" "vssegts")
8403 (set_attr "mode" "<MODE>")])
8405 (define_insn "@pred_fault_load<mode>"
8406 [(set (match_operand:VT 0 "register_operand" "=vr, vr, vd")
8409 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1, Wc1, vm")
8410 (match_operand 4 "vector_length_operand" " rK, rK, rK")
8411 (match_operand 5 "const_int_operand" " i, i, i")
8412 (match_operand 6 "const_int_operand" " i, i, i")
8413 (match_operand 7 "const_int_operand" " i, i, i")
8415 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8417 [(match_operand 3 "pmode_reg_or_0_operand" " rJ, rJ, rJ")
8418 (mem:BLK (scratch))] UNSPEC_VLEFF)
8419 (match_operand:VT 2 "vector_merge_operand" " 0, vu, vu")))
8420 (set (reg:SI VL_REGNUM)
8424 [(match_dup 1) (match_dup 4) (match_dup 5)
8425 (match_dup 6) (match_dup 7)
8427 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8429 [(match_dup 3) (mem:BLK (scratch))] UNSPEC_VLEFF)
8430 (match_dup 2))] UNSPEC_MODIFY_VL))]
8432 "vlseg<nf>e<sew>ff.v\t%0,(%z3)%p1"
8433 [(set_attr "type" "vlsegdff")
8434 (set_attr "mode" "<MODE>")])
8436 (define_insn "@pred_indexed_<order>load<V1T:mode><RATIO64I:mode>"
8437 [(set (match_operand:V1T 0 "register_operand" "=&vr, &vr")
8440 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
8441 (match_operand 5 "vector_length_operand" " rK, rK")
8442 (match_operand 6 "const_int_operand" " i, i")
8443 (match_operand 7 "const_int_operand" " i, i")
8444 (match_operand 8 "const_int_operand" " i, i")
8446 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8448 [(match_operand 3 "pmode_reg_or_0_operand" " rJ, rJ")
8450 (match_operand:RATIO64I 4 "register_operand" " vr, vr")] ORDER)
8451 (match_operand:V1T 2 "vector_merge_operand" " vu, 0")))]
8453 "vl<order>xseg<nf>ei<RATIO64I:sew>.v\t%0,(%z3),%4%p1"
8454 [(set_attr "type" "vlsegd<order>x")
8455 (set_attr "mode" "<V1T:MODE>")])
8457 (define_insn "@pred_indexed_<order>load<V2T:mode><RATIO32I:mode>"
8458 [(set (match_operand:V2T 0 "register_operand" "=&vr, &vr")
8461 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
8462 (match_operand 5 "vector_length_operand" " rK, rK")
8463 (match_operand 6 "const_int_operand" " i, i")
8464 (match_operand 7 "const_int_operand" " i, i")
8465 (match_operand 8 "const_int_operand" " i, i")
8467 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8469 [(match_operand 3 "pmode_reg_or_0_operand" " rJ, rJ")
8471 (match_operand:RATIO32I 4 "register_operand" " vr, vr")] ORDER)
8472 (match_operand:V2T 2 "vector_merge_operand" " vu, 0")))]
8474 "vl<order>xseg<nf>ei<RATIO32I:sew>.v\t%0,(%z3),%4%p1"
8475 [(set_attr "type" "vlsegd<order>x")
8476 (set_attr "mode" "<V2T:MODE>")])
8478 (define_insn "@pred_indexed_<order>load<V4T:mode><RATIO16I:mode>"
8479 [(set (match_operand:V4T 0 "register_operand" "=&vr, &vr")
8482 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
8483 (match_operand 5 "vector_length_operand" " rK, rK")
8484 (match_operand 6 "const_int_operand" " i, i")
8485 (match_operand 7 "const_int_operand" " i, i")
8486 (match_operand 8 "const_int_operand" " i, i")
8488 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8490 [(match_operand 3 "pmode_reg_or_0_operand" " rJ, rJ")
8492 (match_operand:RATIO16I 4 "register_operand" " vr, vr")] ORDER)
8493 (match_operand:V4T 2 "vector_merge_operand" " vu, 0")))]
8495 "vl<order>xseg<nf>ei<RATIO16I:sew>.v\t%0,(%z3),%4%p1"
8496 [(set_attr "type" "vlsegd<order>x")
8497 (set_attr "mode" "<V4T:MODE>")])
8499 (define_insn "@pred_indexed_<order>load<V8T:mode><RATIO8I:mode>"
8500 [(set (match_operand:V8T 0 "register_operand" "=&vr, &vr")
8503 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
8504 (match_operand 5 "vector_length_operand" " rK, rK")
8505 (match_operand 6 "const_int_operand" " i, i")
8506 (match_operand 7 "const_int_operand" " i, i")
8507 (match_operand 8 "const_int_operand" " i, i")
8509 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8511 [(match_operand 3 "pmode_reg_or_0_operand" " rJ, rJ")
8513 (match_operand:RATIO8I 4 "register_operand" " vr, vr")] ORDER)
8514 (match_operand:V8T 2 "vector_merge_operand" " vu, 0")))]
8516 "vl<order>xseg<nf>ei<RATIO8I:sew>.v\t%0,(%z3),%4%p1"
8517 [(set_attr "type" "vlsegd<order>x")
8518 (set_attr "mode" "<V8T:MODE>")])
8520 (define_insn "@pred_indexed_<order>load<V16T:mode><RATIO4I:mode>"
8521 [(set (match_operand:V16T 0 "register_operand" "=&vr, &vr")
8524 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
8525 (match_operand 5 "vector_length_operand" " rK, rK")
8526 (match_operand 6 "const_int_operand" " i, i")
8527 (match_operand 7 "const_int_operand" " i, i")
8528 (match_operand 8 "const_int_operand" " i, i")
8530 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8532 [(match_operand 3 "pmode_reg_or_0_operand" " rJ, rJ")
8534 (match_operand:RATIO4I 4 "register_operand" " vr, vr")] ORDER)
8535 (match_operand:V16T 2 "vector_merge_operand" " vu, 0")))]
8537 "vl<order>xseg<nf>ei<RATIO4I:sew>.v\t%0,(%z3),%4%p1"
8538 [(set_attr "type" "vlsegd<order>x")
8539 (set_attr "mode" "<V16T:MODE>")])
8541 (define_insn "@pred_indexed_<order>load<V32T:mode><RATIO2I:mode>"
8542 [(set (match_operand:V32T 0 "register_operand" "=&vr, &vr")
8545 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
8546 (match_operand 5 "vector_length_operand" " rK, rK")
8547 (match_operand 6 "const_int_operand" " i, i")
8548 (match_operand 7 "const_int_operand" " i, i")
8549 (match_operand 8 "const_int_operand" " i, i")
8551 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8553 [(match_operand 3 "pmode_reg_or_0_operand" " rJ, rJ")
8555 (match_operand:RATIO2I 4 "register_operand" " vr, vr")] ORDER)
8556 (match_operand:V32T 2 "vector_merge_operand" " vu, 0")))]
8558 "vl<order>xseg<nf>ei<RATIO2I:sew>.v\t%0,(%z3),%4%p1"
8559 [(set_attr "type" "vlsegd<order>x")
8560 (set_attr "mode" "<V32T:MODE>")])
8562 (define_insn "@pred_indexed_<order>store<V1T:mode><RATIO64I:mode>"
8563 [(set (mem:BLK (scratch))
8566 [(match_operand:<VM> 0 "vector_mask_operand" "vmWc1")
8567 (match_operand 4 "vector_length_operand" " rK")
8568 (match_operand 5 "const_int_operand" " i")
8570 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8571 (match_operand 1 "pmode_reg_or_0_operand" " rJ")
8572 (match_operand:RATIO64I 2 "register_operand" " vr")
8573 (match_operand:V1T 3 "register_operand" " vr")] ORDER))]
8575 "vs<order>xseg<nf>ei<RATIO64I:sew>.v\t%3,(%z1),%2%p0"
8576 [(set_attr "type" "vssegt<order>x")
8577 (set_attr "mode" "<V1T:MODE>")])
8579 (define_insn "@pred_indexed_<order>store<V2T:mode><RATIO32I:mode>"
8580 [(set (mem:BLK (scratch))
8583 [(match_operand:<VM> 0 "vector_mask_operand" "vmWc1")
8584 (match_operand 4 "vector_length_operand" " rK")
8585 (match_operand 5 "const_int_operand" " i")
8587 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8588 (match_operand 1 "pmode_reg_or_0_operand" " rJ")
8589 (match_operand:RATIO32I 2 "register_operand" " vr")
8590 (match_operand:V2T 3 "register_operand" " vr")] ORDER))]
8592 "vs<order>xseg<nf>ei<RATIO32I:sew>.v\t%3,(%z1),%2%p0"
8593 [(set_attr "type" "vssegt<order>x")
8594 (set_attr "mode" "<V2T:MODE>")])
8596 (define_insn "@pred_indexed_<order>store<V4T:mode><RATIO16I:mode>"
8597 [(set (mem:BLK (scratch))
8600 [(match_operand:<VM> 0 "vector_mask_operand" "vmWc1")
8601 (match_operand 4 "vector_length_operand" " rK")
8602 (match_operand 5 "const_int_operand" " i")
8604 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8605 (match_operand 1 "pmode_reg_or_0_operand" " rJ")
8606 (match_operand:RATIO16I 2 "register_operand" " vr")
8607 (match_operand:V4T 3 "register_operand" " vr")] ORDER))]
8609 "vs<order>xseg<nf>ei<RATIO16I:sew>.v\t%3,(%z1),%2%p0"
8610 [(set_attr "type" "vssegt<order>x")
8611 (set_attr "mode" "<V4T:MODE>")])
8613 (define_insn "@pred_indexed_<order>store<V8T:mode><RATIO8I:mode>"
8614 [(set (mem:BLK (scratch))
8617 [(match_operand:<VM> 0 "vector_mask_operand" "vmWc1")
8618 (match_operand 4 "vector_length_operand" " rK")
8619 (match_operand 5 "const_int_operand" " i")
8621 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8622 (match_operand 1 "pmode_reg_or_0_operand" " rJ")
8623 (match_operand:RATIO8I 2 "register_operand" " vr")
8624 (match_operand:V8T 3 "register_operand" " vr")] ORDER))]
8626 "vs<order>xseg<nf>ei<RATIO8I:sew>.v\t%3,(%z1),%2%p0"
8627 [(set_attr "type" "vssegt<order>x")
8628 (set_attr "mode" "<V8T:MODE>")])
8630 (define_insn "@pred_indexed_<order>store<V16T:mode><RATIO4I:mode>"
8631 [(set (mem:BLK (scratch))
8634 [(match_operand:<VM> 0 "vector_mask_operand" "vmWc1")
8635 (match_operand 4 "vector_length_operand" " rK")
8636 (match_operand 5 "const_int_operand" " i")
8638 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8639 (match_operand 1 "pmode_reg_or_0_operand" " rJ")
8640 (match_operand:RATIO4I 2 "register_operand" " vr")
8641 (match_operand:V16T 3 "register_operand" " vr")] ORDER))]
8643 "vs<order>xseg<nf>ei<RATIO4I:sew>.v\t%3,(%z1),%2%p0"
8644 [(set_attr "type" "vssegt<order>x")
8645 (set_attr "mode" "<V16T:MODE>")])
8647 (define_insn "@pred_indexed_<order>store<V32T:mode><RATIO2I:mode>"
8648 [(set (mem:BLK (scratch))
8651 [(match_operand:<VM> 0 "vector_mask_operand" "vmWc1")
8652 (match_operand 4 "vector_length_operand" " rK")
8653 (match_operand 5 "const_int_operand" " i")
8655 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
8656 (match_operand 1 "pmode_reg_or_0_operand" " rJ")
8657 (match_operand:RATIO2I 2 "register_operand" " vr")
8658 (match_operand:V32T 3 "register_operand" " vr")] ORDER))]
8660 "vs<order>xseg<nf>ei<RATIO2I:sew>.v\t%3,(%z1),%2%p0"
8661 [(set_attr "type" "vssegt<order>x")
8662 (set_attr "mode" "<V32T:MODE>")])
8664 (include "autovec.md")
8665 (include "autovec-opt.md")