target/riscv: add vector stride load and store instructions
[qemu.git] / target / riscv / helper.h
1 /* Exceptions */
2 DEF_HELPER_2(raise_exception, noreturn, env, i32)
3
4 /* Floating Point - rounding mode */
5 DEF_HELPER_FLAGS_2(set_rounding_mode, TCG_CALL_NO_WG, void, env, i32)
6
7 /* Floating Point - fused */
8 DEF_HELPER_FLAGS_4(fmadd_s, TCG_CALL_NO_RWG, i64, env, i64, i64, i64)
9 DEF_HELPER_FLAGS_4(fmadd_d, TCG_CALL_NO_RWG, i64, env, i64, i64, i64)
10 DEF_HELPER_FLAGS_4(fmsub_s, TCG_CALL_NO_RWG, i64, env, i64, i64, i64)
11 DEF_HELPER_FLAGS_4(fmsub_d, TCG_CALL_NO_RWG, i64, env, i64, i64, i64)
12 DEF_HELPER_FLAGS_4(fnmsub_s, TCG_CALL_NO_RWG, i64, env, i64, i64, i64)
13 DEF_HELPER_FLAGS_4(fnmsub_d, TCG_CALL_NO_RWG, i64, env, i64, i64, i64)
14 DEF_HELPER_FLAGS_4(fnmadd_s, TCG_CALL_NO_RWG, i64, env, i64, i64, i64)
15 DEF_HELPER_FLAGS_4(fnmadd_d, TCG_CALL_NO_RWG, i64, env, i64, i64, i64)
16
17 /* Floating Point - Single Precision */
18 DEF_HELPER_FLAGS_3(fadd_s, TCG_CALL_NO_RWG, i64, env, i64, i64)
19 DEF_HELPER_FLAGS_3(fsub_s, TCG_CALL_NO_RWG, i64, env, i64, i64)
20 DEF_HELPER_FLAGS_3(fmul_s, TCG_CALL_NO_RWG, i64, env, i64, i64)
21 DEF_HELPER_FLAGS_3(fdiv_s, TCG_CALL_NO_RWG, i64, env, i64, i64)
22 DEF_HELPER_FLAGS_3(fmin_s, TCG_CALL_NO_RWG, i64, env, i64, i64)
23 DEF_HELPER_FLAGS_3(fmax_s, TCG_CALL_NO_RWG, i64, env, i64, i64)
24 DEF_HELPER_FLAGS_2(fsqrt_s, TCG_CALL_NO_RWG, i64, env, i64)
25 DEF_HELPER_FLAGS_3(fle_s, TCG_CALL_NO_RWG, tl, env, i64, i64)
26 DEF_HELPER_FLAGS_3(flt_s, TCG_CALL_NO_RWG, tl, env, i64, i64)
27 DEF_HELPER_FLAGS_3(feq_s, TCG_CALL_NO_RWG, tl, env, i64, i64)
28 DEF_HELPER_FLAGS_2(fcvt_w_s, TCG_CALL_NO_RWG, tl, env, i64)
29 DEF_HELPER_FLAGS_2(fcvt_wu_s, TCG_CALL_NO_RWG, tl, env, i64)
30 #if defined(TARGET_RISCV64)
31 DEF_HELPER_FLAGS_2(fcvt_l_s, TCG_CALL_NO_RWG, tl, env, i64)
32 DEF_HELPER_FLAGS_2(fcvt_lu_s, TCG_CALL_NO_RWG, tl, env, i64)
33 #endif
34 DEF_HELPER_FLAGS_2(fcvt_s_w, TCG_CALL_NO_RWG, i64, env, tl)
35 DEF_HELPER_FLAGS_2(fcvt_s_wu, TCG_CALL_NO_RWG, i64, env, tl)
36 #if defined(TARGET_RISCV64)
37 DEF_HELPER_FLAGS_2(fcvt_s_l, TCG_CALL_NO_RWG, i64, env, tl)
38 DEF_HELPER_FLAGS_2(fcvt_s_lu, TCG_CALL_NO_RWG, i64, env, tl)
39 #endif
40 DEF_HELPER_FLAGS_1(fclass_s, TCG_CALL_NO_RWG_SE, tl, i64)
41
42 /* Floating Point - Double Precision */
43 DEF_HELPER_FLAGS_3(fadd_d, TCG_CALL_NO_RWG, i64, env, i64, i64)
44 DEF_HELPER_FLAGS_3(fsub_d, TCG_CALL_NO_RWG, i64, env, i64, i64)
45 DEF_HELPER_FLAGS_3(fmul_d, TCG_CALL_NO_RWG, i64, env, i64, i64)
46 DEF_HELPER_FLAGS_3(fdiv_d, TCG_CALL_NO_RWG, i64, env, i64, i64)
47 DEF_HELPER_FLAGS_3(fmin_d, TCG_CALL_NO_RWG, i64, env, i64, i64)
48 DEF_HELPER_FLAGS_3(fmax_d, TCG_CALL_NO_RWG, i64, env, i64, i64)
49 DEF_HELPER_FLAGS_2(fcvt_s_d, TCG_CALL_NO_RWG, i64, env, i64)
50 DEF_HELPER_FLAGS_2(fcvt_d_s, TCG_CALL_NO_RWG, i64, env, i64)
51 DEF_HELPER_FLAGS_2(fsqrt_d, TCG_CALL_NO_RWG, i64, env, i64)
52 DEF_HELPER_FLAGS_3(fle_d, TCG_CALL_NO_RWG, tl, env, i64, i64)
53 DEF_HELPER_FLAGS_3(flt_d, TCG_CALL_NO_RWG, tl, env, i64, i64)
54 DEF_HELPER_FLAGS_3(feq_d, TCG_CALL_NO_RWG, tl, env, i64, i64)
55 DEF_HELPER_FLAGS_2(fcvt_w_d, TCG_CALL_NO_RWG, tl, env, i64)
56 DEF_HELPER_FLAGS_2(fcvt_wu_d, TCG_CALL_NO_RWG, tl, env, i64)
57 #if defined(TARGET_RISCV64)
58 DEF_HELPER_FLAGS_2(fcvt_l_d, TCG_CALL_NO_RWG, tl, env, i64)
59 DEF_HELPER_FLAGS_2(fcvt_lu_d, TCG_CALL_NO_RWG, tl, env, i64)
60 #endif
61 DEF_HELPER_FLAGS_2(fcvt_d_w, TCG_CALL_NO_RWG, i64, env, tl)
62 DEF_HELPER_FLAGS_2(fcvt_d_wu, TCG_CALL_NO_RWG, i64, env, tl)
63 #if defined(TARGET_RISCV64)
64 DEF_HELPER_FLAGS_2(fcvt_d_l, TCG_CALL_NO_RWG, i64, env, tl)
65 DEF_HELPER_FLAGS_2(fcvt_d_lu, TCG_CALL_NO_RWG, i64, env, tl)
66 #endif
67 DEF_HELPER_FLAGS_1(fclass_d, TCG_CALL_NO_RWG_SE, tl, i64)
68
69 /* Special functions */
70 DEF_HELPER_3(csrrw, tl, env, tl, tl)
71 DEF_HELPER_4(csrrs, tl, env, tl, tl, tl)
72 DEF_HELPER_4(csrrc, tl, env, tl, tl, tl)
73 #ifndef CONFIG_USER_ONLY
74 DEF_HELPER_2(sret, tl, env, tl)
75 DEF_HELPER_2(mret, tl, env, tl)
76 DEF_HELPER_1(wfi, void, env)
77 DEF_HELPER_1(tlb_flush, void, env)
78 #endif
79
80 /* Hypervisor functions */
81 #ifndef CONFIG_USER_ONLY
82 DEF_HELPER_1(hyp_tlb_flush, void, env)
83 #endif
84
85 /* Vector functions */
86 DEF_HELPER_3(vsetvl, tl, env, tl, tl)
87 DEF_HELPER_5(vlb_v_b, void, ptr, ptr, tl, env, i32)
88 DEF_HELPER_5(vlb_v_b_mask, void, ptr, ptr, tl, env, i32)
89 DEF_HELPER_5(vlb_v_h, void, ptr, ptr, tl, env, i32)
90 DEF_HELPER_5(vlb_v_h_mask, void, ptr, ptr, tl, env, i32)
91 DEF_HELPER_5(vlb_v_w, void, ptr, ptr, tl, env, i32)
92 DEF_HELPER_5(vlb_v_w_mask, void, ptr, ptr, tl, env, i32)
93 DEF_HELPER_5(vlb_v_d, void, ptr, ptr, tl, env, i32)
94 DEF_HELPER_5(vlb_v_d_mask, void, ptr, ptr, tl, env, i32)
95 DEF_HELPER_5(vlh_v_h, void, ptr, ptr, tl, env, i32)
96 DEF_HELPER_5(vlh_v_h_mask, void, ptr, ptr, tl, env, i32)
97 DEF_HELPER_5(vlh_v_w, void, ptr, ptr, tl, env, i32)
98 DEF_HELPER_5(vlh_v_w_mask, void, ptr, ptr, tl, env, i32)
99 DEF_HELPER_5(vlh_v_d, void, ptr, ptr, tl, env, i32)
100 DEF_HELPER_5(vlh_v_d_mask, void, ptr, ptr, tl, env, i32)
101 DEF_HELPER_5(vlw_v_w, void, ptr, ptr, tl, env, i32)
102 DEF_HELPER_5(vlw_v_w_mask, void, ptr, ptr, tl, env, i32)
103 DEF_HELPER_5(vlw_v_d, void, ptr, ptr, tl, env, i32)
104 DEF_HELPER_5(vlw_v_d_mask, void, ptr, ptr, tl, env, i32)
105 DEF_HELPER_5(vle_v_b, void, ptr, ptr, tl, env, i32)
106 DEF_HELPER_5(vle_v_b_mask, void, ptr, ptr, tl, env, i32)
107 DEF_HELPER_5(vle_v_h, void, ptr, ptr, tl, env, i32)
108 DEF_HELPER_5(vle_v_h_mask, void, ptr, ptr, tl, env, i32)
109 DEF_HELPER_5(vle_v_w, void, ptr, ptr, tl, env, i32)
110 DEF_HELPER_5(vle_v_w_mask, void, ptr, ptr, tl, env, i32)
111 DEF_HELPER_5(vle_v_d, void, ptr, ptr, tl, env, i32)
112 DEF_HELPER_5(vle_v_d_mask, void, ptr, ptr, tl, env, i32)
113 DEF_HELPER_5(vlbu_v_b, void, ptr, ptr, tl, env, i32)
114 DEF_HELPER_5(vlbu_v_b_mask, void, ptr, ptr, tl, env, i32)
115 DEF_HELPER_5(vlbu_v_h, void, ptr, ptr, tl, env, i32)
116 DEF_HELPER_5(vlbu_v_h_mask, void, ptr, ptr, tl, env, i32)
117 DEF_HELPER_5(vlbu_v_w, void, ptr, ptr, tl, env, i32)
118 DEF_HELPER_5(vlbu_v_w_mask, void, ptr, ptr, tl, env, i32)
119 DEF_HELPER_5(vlbu_v_d, void, ptr, ptr, tl, env, i32)
120 DEF_HELPER_5(vlbu_v_d_mask, void, ptr, ptr, tl, env, i32)
121 DEF_HELPER_5(vlhu_v_h, void, ptr, ptr, tl, env, i32)
122 DEF_HELPER_5(vlhu_v_h_mask, void, ptr, ptr, tl, env, i32)
123 DEF_HELPER_5(vlhu_v_w, void, ptr, ptr, tl, env, i32)
124 DEF_HELPER_5(vlhu_v_w_mask, void, ptr, ptr, tl, env, i32)
125 DEF_HELPER_5(vlhu_v_d, void, ptr, ptr, tl, env, i32)
126 DEF_HELPER_5(vlhu_v_d_mask, void, ptr, ptr, tl, env, i32)
127 DEF_HELPER_5(vlwu_v_w, void, ptr, ptr, tl, env, i32)
128 DEF_HELPER_5(vlwu_v_w_mask, void, ptr, ptr, tl, env, i32)
129 DEF_HELPER_5(vlwu_v_d, void, ptr, ptr, tl, env, i32)
130 DEF_HELPER_5(vlwu_v_d_mask, void, ptr, ptr, tl, env, i32)
131 DEF_HELPER_5(vsb_v_b, void, ptr, ptr, tl, env, i32)
132 DEF_HELPER_5(vsb_v_b_mask, void, ptr, ptr, tl, env, i32)
133 DEF_HELPER_5(vsb_v_h, void, ptr, ptr, tl, env, i32)
134 DEF_HELPER_5(vsb_v_h_mask, void, ptr, ptr, tl, env, i32)
135 DEF_HELPER_5(vsb_v_w, void, ptr, ptr, tl, env, i32)
136 DEF_HELPER_5(vsb_v_w_mask, void, ptr, ptr, tl, env, i32)
137 DEF_HELPER_5(vsb_v_d, void, ptr, ptr, tl, env, i32)
138 DEF_HELPER_5(vsb_v_d_mask, void, ptr, ptr, tl, env, i32)
139 DEF_HELPER_5(vsh_v_h, void, ptr, ptr, tl, env, i32)
140 DEF_HELPER_5(vsh_v_h_mask, void, ptr, ptr, tl, env, i32)
141 DEF_HELPER_5(vsh_v_w, void, ptr, ptr, tl, env, i32)
142 DEF_HELPER_5(vsh_v_w_mask, void, ptr, ptr, tl, env, i32)
143 DEF_HELPER_5(vsh_v_d, void, ptr, ptr, tl, env, i32)
144 DEF_HELPER_5(vsh_v_d_mask, void, ptr, ptr, tl, env, i32)
145 DEF_HELPER_5(vsw_v_w, void, ptr, ptr, tl, env, i32)
146 DEF_HELPER_5(vsw_v_w_mask, void, ptr, ptr, tl, env, i32)
147 DEF_HELPER_5(vsw_v_d, void, ptr, ptr, tl, env, i32)
148 DEF_HELPER_5(vsw_v_d_mask, void, ptr, ptr, tl, env, i32)
149 DEF_HELPER_5(vse_v_b, void, ptr, ptr, tl, env, i32)
150 DEF_HELPER_5(vse_v_b_mask, void, ptr, ptr, tl, env, i32)
151 DEF_HELPER_5(vse_v_h, void, ptr, ptr, tl, env, i32)
152 DEF_HELPER_5(vse_v_h_mask, void, ptr, ptr, tl, env, i32)
153 DEF_HELPER_5(vse_v_w, void, ptr, ptr, tl, env, i32)
154 DEF_HELPER_5(vse_v_w_mask, void, ptr, ptr, tl, env, i32)
155 DEF_HELPER_5(vse_v_d, void, ptr, ptr, tl, env, i32)
156 DEF_HELPER_5(vse_v_d_mask, void, ptr, ptr, tl, env, i32)
157 DEF_HELPER_6(vlsb_v_b, void, ptr, ptr, tl, tl, env, i32)
158 DEF_HELPER_6(vlsb_v_h, void, ptr, ptr, tl, tl, env, i32)
159 DEF_HELPER_6(vlsb_v_w, void, ptr, ptr, tl, tl, env, i32)
160 DEF_HELPER_6(vlsb_v_d, void, ptr, ptr, tl, tl, env, i32)
161 DEF_HELPER_6(vlsh_v_h, void, ptr, ptr, tl, tl, env, i32)
162 DEF_HELPER_6(vlsh_v_w, void, ptr, ptr, tl, tl, env, i32)
163 DEF_HELPER_6(vlsh_v_d, void, ptr, ptr, tl, tl, env, i32)
164 DEF_HELPER_6(vlsw_v_w, void, ptr, ptr, tl, tl, env, i32)
165 DEF_HELPER_6(vlsw_v_d, void, ptr, ptr, tl, tl, env, i32)
166 DEF_HELPER_6(vlse_v_b, void, ptr, ptr, tl, tl, env, i32)
167 DEF_HELPER_6(vlse_v_h, void, ptr, ptr, tl, tl, env, i32)
168 DEF_HELPER_6(vlse_v_w, void, ptr, ptr, tl, tl, env, i32)
169 DEF_HELPER_6(vlse_v_d, void, ptr, ptr, tl, tl, env, i32)
170 DEF_HELPER_6(vlsbu_v_b, void, ptr, ptr, tl, tl, env, i32)
171 DEF_HELPER_6(vlsbu_v_h, void, ptr, ptr, tl, tl, env, i32)
172 DEF_HELPER_6(vlsbu_v_w, void, ptr, ptr, tl, tl, env, i32)
173 DEF_HELPER_6(vlsbu_v_d, void, ptr, ptr, tl, tl, env, i32)
174 DEF_HELPER_6(vlshu_v_h, void, ptr, ptr, tl, tl, env, i32)
175 DEF_HELPER_6(vlshu_v_w, void, ptr, ptr, tl, tl, env, i32)
176 DEF_HELPER_6(vlshu_v_d, void, ptr, ptr, tl, tl, env, i32)
177 DEF_HELPER_6(vlswu_v_w, void, ptr, ptr, tl, tl, env, i32)
178 DEF_HELPER_6(vlswu_v_d, void, ptr, ptr, tl, tl, env, i32)
179 DEF_HELPER_6(vssb_v_b, void, ptr, ptr, tl, tl, env, i32)
180 DEF_HELPER_6(vssb_v_h, void, ptr, ptr, tl, tl, env, i32)
181 DEF_HELPER_6(vssb_v_w, void, ptr, ptr, tl, tl, env, i32)
182 DEF_HELPER_6(vssb_v_d, void, ptr, ptr, tl, tl, env, i32)
183 DEF_HELPER_6(vssh_v_h, void, ptr, ptr, tl, tl, env, i32)
184 DEF_HELPER_6(vssh_v_w, void, ptr, ptr, tl, tl, env, i32)
185 DEF_HELPER_6(vssh_v_d, void, ptr, ptr, tl, tl, env, i32)
186 DEF_HELPER_6(vssw_v_w, void, ptr, ptr, tl, tl, env, i32)
187 DEF_HELPER_6(vssw_v_d, void, ptr, ptr, tl, tl, env, i32)
188 DEF_HELPER_6(vsse_v_b, void, ptr, ptr, tl, tl, env, i32)
189 DEF_HELPER_6(vsse_v_h, void, ptr, ptr, tl, tl, env, i32)
190 DEF_HELPER_6(vsse_v_w, void, ptr, ptr, tl, tl, env, i32)
191 DEF_HELPER_6(vsse_v_d, void, ptr, ptr, tl, tl, env, i32)