xref: /openbmc/qemu/include/exec/helper-gen.h.inc (revision e9206163)
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Helper file for declaring TCG helper functions.
4 * This one expands generation functions for tcg opcodes.
5 * Define HELPER_H for the header file to be expanded,
6 * and static inline to change from global file scope.
7 */
8
9#include "tcg/tcg.h"
10#include "tcg/helper-info.h"
11#include "exec/helper-head.h"
12
13#define DEF_HELPER_FLAGS_0(name, flags, ret)                            \
14extern TCGHelperInfo glue(helper_info_, name);                          \
15static inline void glue(gen_helper_, name)(dh_retvar_decl0(ret))        \
16{                                                                       \
17    tcg_gen_call0(&glue(helper_info_, name), dh_retvar(ret));           \
18}
19
20#define DEF_HELPER_FLAGS_1(name, flags, ret, t1)                        \
21extern TCGHelperInfo glue(helper_info_, name);                          \
22static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
23    dh_arg_decl(t1, 1))                                                 \
24{                                                                       \
25    tcg_gen_call1(&glue(helper_info_, name), dh_retvar(ret),            \
26                  dh_arg(t1, 1));                                       \
27}
28
29#define DEF_HELPER_FLAGS_2(name, flags, ret, t1, t2)                    \
30extern TCGHelperInfo glue(helper_info_, name);                          \
31static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
32    dh_arg_decl(t1, 1), dh_arg_decl(t2, 2))                             \
33{                                                                       \
34    tcg_gen_call2(&glue(helper_info_, name), dh_retvar(ret),            \
35                  dh_arg(t1, 1), dh_arg(t2, 2));                        \
36}
37
38#define DEF_HELPER_FLAGS_3(name, flags, ret, t1, t2, t3)                \
39extern TCGHelperInfo glue(helper_info_, name);                          \
40static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
41    dh_arg_decl(t1, 1), dh_arg_decl(t2, 2), dh_arg_decl(t3, 3))         \
42{                                                                       \
43    tcg_gen_call3(&glue(helper_info_, name), dh_retvar(ret),            \
44                  dh_arg(t1, 1), dh_arg(t2, 2), dh_arg(t3, 3));         \
45}
46
47#define DEF_HELPER_FLAGS_4(name, flags, ret, t1, t2, t3, t4)            \
48extern TCGHelperInfo glue(helper_info_, name);                          \
49static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
50    dh_arg_decl(t1, 1), dh_arg_decl(t2, 2),                             \
51    dh_arg_decl(t3, 3), dh_arg_decl(t4, 4))                             \
52{                                                                       \
53    tcg_gen_call4(&glue(helper_info_, name), dh_retvar(ret),            \
54                  dh_arg(t1, 1), dh_arg(t2, 2),                         \
55                  dh_arg(t3, 3), dh_arg(t4, 4));                        \
56}
57
58#define DEF_HELPER_FLAGS_5(name, flags, ret, t1, t2, t3, t4, t5)        \
59extern TCGHelperInfo glue(helper_info_, name);                          \
60static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
61    dh_arg_decl(t1, 1), dh_arg_decl(t2, 2), dh_arg_decl(t3, 3),         \
62    dh_arg_decl(t4, 4), dh_arg_decl(t5, 5))                             \
63{                                                                       \
64    tcg_gen_call5(&glue(helper_info_, name), dh_retvar(ret),            \
65                  dh_arg(t1, 1), dh_arg(t2, 2), dh_arg(t3, 3),          \
66                  dh_arg(t4, 4), dh_arg(t5, 5));                        \
67}
68
69#define DEF_HELPER_FLAGS_6(name, flags, ret, t1, t2, t3, t4, t5, t6)    \
70extern TCGHelperInfo glue(helper_info_, name);                          \
71static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
72    dh_arg_decl(t1, 1), dh_arg_decl(t2, 2), dh_arg_decl(t3, 3),         \
73    dh_arg_decl(t4, 4), dh_arg_decl(t5, 5), dh_arg_decl(t6, 6))         \
74{                                                                       \
75    tcg_gen_call6(&glue(helper_info_, name), dh_retvar(ret),            \
76                  dh_arg(t1, 1), dh_arg(t2, 2), dh_arg(t3, 3),          \
77                  dh_arg(t4, 4), dh_arg(t5, 5), dh_arg(t6, 6));         \
78}
79
80#define DEF_HELPER_FLAGS_7(name, flags, ret, t1, t2, t3, t4, t5, t6, t7)\
81extern TCGHelperInfo glue(helper_info_, name);                          \
82static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
83    dh_arg_decl(t1, 1), dh_arg_decl(t2, 2), dh_arg_decl(t3, 3),         \
84    dh_arg_decl(t4, 4), dh_arg_decl(t5, 5), dh_arg_decl(t6, 6),         \
85    dh_arg_decl(t7, 7))                                                 \
86{                                                                       \
87    tcg_gen_call7(&glue(helper_info_, name), dh_retvar(ret),            \
88                  dh_arg(t1, 1), dh_arg(t2, 2), dh_arg(t3, 3),          \
89                  dh_arg(t4, 4), dh_arg(t5, 5), dh_arg(t6, 6),          \
90                  dh_arg(t7, 7));                                       \
91}
92
93#include HELPER_H
94
95#undef DEF_HELPER_FLAGS_0
96#undef DEF_HELPER_FLAGS_1
97#undef DEF_HELPER_FLAGS_2
98#undef DEF_HELPER_FLAGS_3
99#undef DEF_HELPER_FLAGS_4
100#undef DEF_HELPER_FLAGS_5
101#undef DEF_HELPER_FLAGS_6
102#undef DEF_HELPER_FLAGS_7
103