1 ;; Machine description for RISC-V for GNU compiler.
2 ;; Copyright (C) 2024-2025 Free Software Foundation, Inc.
3 ;; Contributed by SiFive and PLCT Lab.
4 ;; Based on RISC-V target for GNU compiler.
6 ;; This file is part of GCC.
8 ;; GCC is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation; either version 3, or (at your option)
13 ;; GCC is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING3. If not see
20 ;; <http://www.gnu.org/licenses/>.
22 (define_insn "@pred_matrix_mul_plus<u><mode>_qoq"
23 [(set (match_operand:SF_VSI 0 "register_operand" "=&vr")
26 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1")
27 (match_operand 5 "vector_length_operand" " rK")
28 (match_operand 6 "const_int_operand" " i")
29 (match_operand 7 "const_int_operand" " i")
30 (match_operand 8 "const_int_operand" " i")
32 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
36 (match_operand:RVVM1QI 3 "register_operand" " vr"))
38 (match_operand:<SF_VQMACC_QOQ> 4 "register_operand" " vr")))
39 (match_operand:SF_VSI 2 "register_operand" " 0"))
41 "TARGET_VECTOR && TARGET_XSFVQMACCQOQ"
42 "sf.vqmacc<u>.4x8x4\t%0,%3,%4"
43 [(set_attr "type" "sf_vqmacc")
44 (set_attr "mode" "<MODE>")])
46 (define_insn "@pred_matrix_mul_plussu<mode>_qoq"
47 [(set (match_operand:SF_VSI 0 "register_operand" "=&vr")
50 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1")
51 (match_operand 5 "vector_length_operand" " rK")
52 (match_operand 6 "const_int_operand" " i")
53 (match_operand 7 "const_int_operand" " i")
54 (match_operand 8 "const_int_operand" " i")
56 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
60 (match_operand:RVVM1QI 3 "register_operand" " vr"))
62 (match_operand:<SF_VQMACC_QOQ> 4 "register_operand" " vr")))
63 (match_operand:SF_VSI 2 "register_operand" " 0"))
65 "TARGET_VECTOR && TARGET_XSFVQMACCQOQ"
66 "sf.vqmaccsu.4x8x4\t%0,%3,%4"
67 [(set_attr "type" "sf_vqmacc")
68 (set_attr "mode" "<MODE>")])
70 (define_insn "@pred_matrix_mul_plusus<mode>_qoq"
71 [(set (match_operand:SF_VSI 0 "register_operand" "=&vr")
74 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1")
75 (match_operand 5 "vector_length_operand" " rK")
76 (match_operand 6 "const_int_operand" " i")
77 (match_operand 7 "const_int_operand" " i")
78 (match_operand 8 "const_int_operand" " i")
80 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
84 (match_operand:RVVM1QI 3 "register_operand" " vr"))
86 (match_operand:<SF_VQMACC_QOQ> 4 "register_operand" " vr")))
87 (match_operand:SF_VSI 2 "register_operand" " 0"))
89 "TARGET_VECTOR && TARGET_XSFVQMACCQOQ"
90 "sf.vqmaccus.4x8x4\t%0,%3,%4"
91 [(set_attr "type" "sf_vqmacc")
92 (set_attr "mode" "<MODE>")])
94 (define_insn "@pred_matrix_mul_plus<u><mode>_dod"
95 [(set (match_operand:SF_VSI 0 "register_operand" "=&vr")
98 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1")
99 (match_operand 5 "vector_length_operand" " rK")
100 (match_operand 6 "const_int_operand" " i")
101 (match_operand 7 "const_int_operand" " i")
102 (match_operand 8 "const_int_operand" " i")
104 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
108 (match_operand:RVVM1QI 3 "register_operand" " vr"))
110 (match_operand:<SF_VQMACC_DOD> 4 "register_operand" " vr")))
111 (match_operand:SF_VSI 2 "register_operand" " 0"))
113 "TARGET_VECTOR && TARGET_XSFVQMACCDOD"
114 "sf.vqmacc<u>.2x8x2\t%0,%3,%4"
115 [(set_attr "type" "sf_vqmacc")
116 (set_attr "mode" "<MODE>")])
118 (define_insn "@pred_matrix_mul_plussu<mode>_dod"
119 [(set (match_operand:SF_VSI 0 "register_operand" "=&vr")
122 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1")
123 (match_operand 5 "vector_length_operand" " rK")
124 (match_operand 6 "const_int_operand" " i")
125 (match_operand 7 "const_int_operand" " i")
126 (match_operand 8 "const_int_operand" " i")
128 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
132 (match_operand:RVVM1QI 3 "register_operand" " vr"))
134 (match_operand:<SF_VQMACC_DOD> 4 "register_operand" " vr")))
135 (match_operand:SF_VSI 2 "register_operand" " 0"))
137 "TARGET_VECTOR && TARGET_XSFVQMACCDOD"
138 "sf.vqmaccsu.2x8x2\t%0,%3,%4"
139 [(set_attr "type" "sf_vqmacc")
140 (set_attr "mode" "<MODE>")])
142 (define_insn "@pred_matrix_mul_plusus<mode>_dod"
143 [(set (match_operand:SF_VSI 0 "register_operand" "=&vr")
146 [(match_operand:<VM> 1 "vector_mask_operand" "vmWc1")
147 (match_operand 5 "vector_length_operand" " rK")
148 (match_operand 6 "const_int_operand" " i")
149 (match_operand 7 "const_int_operand" " i")
150 (match_operand 8 "const_int_operand" " i")
152 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
156 (match_operand:RVVM1QI 3 "register_operand" " vr"))
158 (match_operand:<SF_VQMACC_DOD> 4 "register_operand" " vr")))
159 (match_operand:SF_VSI 2 "register_operand" " 0"))
161 "TARGET_VECTOR && TARGET_XSFVQMACCDOD"
162 "sf.vqmaccus.2x8x2\t%0,%3,%4"
163 [(set_attr "type" "sf_vqmacc")
164 (set_attr "mode" "<MODE>")])
166 (define_insn "@pred_sf_vfnrclip<v_su><mode>_x_f_qf"
167 [(set (match_operand:SF_XF 0 "register_operand" "=vd, vd, vr, vr")
170 [(match_operand:<VM> 1 "vector_mask_operand" " vm, vm,Wc1,Wc1")
171 (match_operand 5 "vector_length_operand" " rK, rK, rK, rK")
172 (match_operand 6 "const_int_operand" " i, i, i, i")
173 (match_operand 7 "const_int_operand" " i, i, i, i")
174 (match_operand 8 "const_int_operand" " i, i, i, i")
176 (reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
178 [(match_operand:SF 4 "register_operand" " f, f, f, f")
179 (match_operand:<SF_XFQF> 3 "register_operand" " vr, vr, vr, vr")] SF_VFNRCLIP)
180 (match_operand:SF_XF 2 "vector_merge_operand" " vu, 0, vu, 0")))]
181 "TARGET_VECTOR && TARGET_XSFVFNRCLIPXFQF"
182 "sf.vfnrclip.x<v_su>.f.qf\t%0,%3,%4%p1"
183 [(set_attr "type" "sf_vfnrclip")
184 (set_attr "mode" "<MODE>")])