libstdc++: Fix std::codecvt<wchar_t, char, mbstate_t> for empty dest [PR37475]
[official-gcc.git] / gcc / config / riscv / riscv-vsetvl.def
blob8f624f5cf264f63dfbbe85352f6c35df7d99c539
1 /* VSETVL pass def for RISC-V 'V' Extension for GNU compiler.
2 Copyright (C) 2023-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)
10 any later version.
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 /* DEF_XXX_RULE (prev_demand, next_demand, fused_demand, compatible_p,
22 available_p, fuse)
23 prev_demand: the prev vector insn's sew_lmul_type
24 next_demand: the next vector insn's sew_lmul_type
25 fused_demand: if them are compatible, change prev_info demand to the
26 fused_demand after fuse prev_info and next_info
27 compatible_p: check if prev_demand and next_demand are compatible
28 available_p: check if prev_demand is available for next_demand
29 fuse: if them are compatible, how to modify prev_info */
31 #ifndef DEF_SEW_LMUL_RULE
32 #define DEF_SEW_LMUL_RULE(prev_demand, next_demand, fused_demand, \
33 compatible_p, available_p, fuse)
34 #endif
36 #ifndef DEF_POLICY_RULE
37 #define DEF_POLICY_RULE(prev_demand, next_demand, fused_demand, compatible_p, \
38 available_p, fuse)
39 #endif
41 #ifndef DEF_AVL_RULE
42 #define DEF_AVL_RULE(prev_demand, next_demand, fused_demand, compatible_p, \
43 available_p, fuse)
44 #endif
46 /* Define SEW and LMUL rules. */
47 DEF_SEW_LMUL_RULE (sew_lmul, sew_lmul, sew_lmul, sew_lmul_eq_p, sew_lmul_eq_p,
48 nop)
49 DEF_SEW_LMUL_RULE (sew_lmul, ratio_only, sew_lmul, ratio_eq_p, ratio_eq_p, nop)
50 DEF_SEW_LMUL_RULE (sew_lmul, sew_only, sew_lmul, sew_eq_p, sew_eq_p, nop)
51 DEF_SEW_LMUL_RULE (sew_lmul, ge_sew, sew_lmul,
52 sew_ge_and_prev_sew_le_next_max_sew_p,
53 sew_ge_and_prev_sew_le_next_max_sew_p, nop)
54 DEF_SEW_LMUL_RULE (
55 sew_lmul, ratio_and_ge_sew, sew_lmul,
56 sew_ge_and_prev_sew_le_next_max_sew_and_next_ratio_valid_for_prev_sew_p,
57 sew_ge_and_prev_sew_le_next_max_sew_and_next_ratio_valid_for_prev_sew_p, nop)
59 DEF_SEW_LMUL_RULE (ratio_only, sew_lmul, sew_lmul, ratio_eq_p, always_false,
60 use_next_sew_lmul)
61 /* use_next_sew_lmul for testcase no change. */
62 DEF_SEW_LMUL_RULE (ratio_only, ratio_only, ratio_only, ratio_eq_p, ratio_eq_p,
63 use_next_sew_lmul)
64 DEF_SEW_LMUL_RULE (ratio_only, sew_only, sew_lmul,
65 prev_ratio_valid_for_next_sew_p, always_false,
66 use_next_sew_with_prev_ratio)
67 DEF_SEW_LMUL_RULE (ratio_only, ge_sew, ratio_and_ge_sew,
68 prev_ratio_valid_for_next_sew_p, always_false,
69 use_next_sew_with_prev_ratio)
70 DEF_SEW_LMUL_RULE (ratio_only, ratio_and_ge_sew, ratio_and_ge_sew, ratio_eq_p,
71 always_false, use_next_sew_lmul)
73 DEF_SEW_LMUL_RULE (sew_only, sew_lmul, sew_lmul, sew_eq_p, always_false,
74 use_next_sew_lmul)
75 DEF_SEW_LMUL_RULE (sew_only, ratio_only, sew_lmul,
76 next_ratio_valid_for_prev_sew_p, always_false,
77 modify_lmul_with_next_ratio)
78 DEF_SEW_LMUL_RULE (sew_only, sew_only, sew_only, sew_eq_p, sew_eq_p, nop)
79 DEF_SEW_LMUL_RULE (sew_only, ge_sew, sew_only,
80 sew_ge_and_prev_sew_le_next_max_sew_p, sew_ge_p, nop)
81 DEF_SEW_LMUL_RULE (
82 sew_only, ratio_and_ge_sew, sew_lmul,
83 sew_ge_and_prev_sew_le_next_max_sew_and_next_ratio_valid_for_prev_sew_p,
84 always_false, modify_lmul_with_next_ratio)
86 DEF_SEW_LMUL_RULE (ge_sew, sew_lmul, sew_lmul,
87 sew_le_and_next_sew_le_prev_max_sew_p, always_false,
88 use_next_sew_lmul)
89 DEF_SEW_LMUL_RULE (ge_sew, ratio_only, ratio_and_ge_sew,
90 next_ratio_valid_for_prev_sew_p, always_false,
91 modify_lmul_with_next_ratio)
92 DEF_SEW_LMUL_RULE (ge_sew, sew_only, sew_only,
93 sew_le_and_next_sew_le_prev_max_sew_p, always_false,
94 use_next_sew)
95 DEF_SEW_LMUL_RULE (ge_sew, ge_sew, ge_sew, max_sew_overlap_p, sew_ge_p,
96 use_max_sew)
97 DEF_SEW_LMUL_RULE (ge_sew, ratio_and_ge_sew, ratio_and_ge_sew,
98 max_sew_overlap_and_next_ratio_valid_for_prev_sew_p,
99 always_false, use_max_sew_and_lmul_with_next_ratio)
101 DEF_SEW_LMUL_RULE (ratio_and_ge_sew, sew_lmul, sew_lmul,
102 sew_le_and_next_sew_le_prev_max_sew_and_ratio_eq_p,
103 always_false, use_next_sew_lmul)
104 DEF_SEW_LMUL_RULE (ratio_and_ge_sew, ratio_only, ratio_and_ge_sew, ratio_eq_p,
105 ratio_eq_p, use_max_sew_and_lmul_with_prev_ratio)
106 DEF_SEW_LMUL_RULE (
107 ratio_and_ge_sew, sew_only, sew_only,
108 sew_le_and_next_sew_le_prev_max_sew_and_prev_ratio_valid_for_next_sew_p,
109 always_false, use_next_sew_with_prev_ratio)
110 DEF_SEW_LMUL_RULE (ratio_and_ge_sew, ge_sew, ratio_and_ge_sew,
111 max_sew_overlap_and_prev_ratio_valid_for_next_sew_p,
112 sew_ge_p, use_max_sew_and_lmul_with_prev_ratio)
113 DEF_SEW_LMUL_RULE (ratio_and_ge_sew, ratio_and_ge_sew, ratio_and_ge_sew,
114 max_sew_overlap_and_ratio_eq_p, sew_ge_and_ratio_eq_p,
115 use_max_sew_and_lmul_with_prev_ratio)
117 /* Define TAIL and MASK compatible and merge rules. */
119 DEF_POLICY_RULE (tail_mask_policy, tail_mask_policy, tail_mask_policy,
120 tail_mask_policy_eq_p, tail_mask_policy_eq_p,
121 use_tail_mask_policy)
122 DEF_POLICY_RULE (tail_mask_policy, tail_policy_only, tail_mask_policy,
123 tail_policy_eq_p, tail_policy_eq_p, use_tail_policy)
124 DEF_POLICY_RULE (tail_mask_policy, mask_policy_only, tail_mask_policy,
125 mask_policy_eq_p, mask_policy_eq_p, use_mask_policy)
126 DEF_POLICY_RULE (tail_mask_policy, ignore_policy, tail_mask_policy, always_true,
127 always_true, nop)
129 DEF_POLICY_RULE (tail_policy_only, tail_mask_policy, tail_mask_policy,
130 tail_policy_eq_p, always_false, use_mask_policy)
131 DEF_POLICY_RULE (tail_policy_only, tail_policy_only, tail_policy_only,
132 tail_policy_eq_p, tail_policy_eq_p, use_tail_policy)
133 DEF_POLICY_RULE (tail_policy_only, mask_policy_only, tail_mask_policy,
134 always_true, always_false, use_mask_policy)
135 DEF_POLICY_RULE (tail_policy_only, ignore_policy, tail_policy_only, always_true,
136 always_true, nop)
138 DEF_POLICY_RULE (mask_policy_only, tail_mask_policy, tail_mask_policy,
139 mask_policy_eq_p, always_false, use_tail_policy)
140 DEF_POLICY_RULE (mask_policy_only, tail_policy_only, tail_mask_policy,
141 always_true, always_false, use_tail_policy)
142 DEF_POLICY_RULE (mask_policy_only, mask_policy_only, mask_policy_only,
143 mask_policy_eq_p, mask_policy_eq_p, use_mask_policy)
144 DEF_POLICY_RULE (mask_policy_only, ignore_policy, mask_policy_only, always_true,
145 always_true, nop)
147 DEF_POLICY_RULE (ignore_policy, tail_mask_policy, tail_mask_policy, always_true,
148 always_false, use_tail_mask_policy)
149 DEF_POLICY_RULE (ignore_policy, tail_policy_only, tail_policy_only, always_true,
150 always_false, use_tail_policy)
151 DEF_POLICY_RULE (ignore_policy, mask_policy_only, mask_policy_only, always_true,
152 always_false, use_mask_policy)
153 DEF_POLICY_RULE (ignore_policy, ignore_policy, ignore_policy, always_true,
154 always_true, nop)
156 /* Define AVL compatible and merge rules. */
158 DEF_AVL_RULE (avl, avl, avl, avl_equal_p, avl_equal_p, nop)
159 DEF_AVL_RULE (avl, non_zero_avl, avl, avl_equal_or_prev_avl_non_zero_p,
160 avl_equal_or_prev_avl_non_zero_p, nop)
161 DEF_AVL_RULE (avl, ignore_avl, avl, always_true, always_true, nop)
163 DEF_AVL_RULE (non_zero_avl, avl, avl,
164 avl_equal_or_next_avl_non_zero_and_can_use_next_avl_p,
165 always_false, use_next_avl_when_not_equal)
167 DEF_AVL_RULE (non_zero_avl, non_zero_avl, non_zero_avl, always_true,
168 always_true, nop)
169 DEF_AVL_RULE (non_zero_avl, ignore_avl, non_zero_avl, always_true, always_true,
170 nop)
172 DEF_AVL_RULE (ignore_avl, avl, avl, can_use_next_avl_p, always_false,
173 use_next_avl)
174 DEF_AVL_RULE (ignore_avl, non_zero_avl, non_zero_avl, can_use_next_avl_p,
175 always_false, use_next_avl)
176 DEF_AVL_RULE (ignore_avl, ignore_avl, ignore_avl, always_true, always_true, nop)
178 #undef DEF_SEW_LMUL_RULE
179 #undef DEF_POLICY_RULE
180 #undef DEF_AVL_RULE