xref: /openbmc/qemu/include/exec/helper-gen.h.inc (revision 19ed42e8)
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.inc"
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).func,                         \
18                  &glue(helper_info_,name), dh_retvar(ret));            \
19}
20
21#define DEF_HELPER_FLAGS_1(name, flags, ret, t1)                        \
22extern TCGHelperInfo glue(helper_info_, name);                          \
23static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
24    dh_arg_decl(t1, 1))                                                 \
25{                                                                       \
26    tcg_gen_call1(glue(helper_info_,name).func,                         \
27                  &glue(helper_info_,name), dh_retvar(ret),             \
28                  dh_arg(t1, 1));                                       \
29}
30
31#define DEF_HELPER_FLAGS_2(name, flags, ret, t1, t2)                    \
32extern TCGHelperInfo glue(helper_info_, name);                          \
33static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
34    dh_arg_decl(t1, 1), dh_arg_decl(t2, 2))                             \
35{                                                                       \
36    tcg_gen_call2(glue(helper_info_,name).func,                         \
37                  &glue(helper_info_,name), dh_retvar(ret),             \
38                  dh_arg(t1, 1), dh_arg(t2, 2));                        \
39}
40
41#define DEF_HELPER_FLAGS_3(name, flags, ret, t1, t2, t3)                \
42extern TCGHelperInfo glue(helper_info_, name);                          \
43static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
44    dh_arg_decl(t1, 1), dh_arg_decl(t2, 2), dh_arg_decl(t3, 3))         \
45{                                                                       \
46    tcg_gen_call3(glue(helper_info_,name).func,                         \
47                  &glue(helper_info_,name), dh_retvar(ret),             \
48                  dh_arg(t1, 1), dh_arg(t2, 2), dh_arg(t3, 3));         \
49}
50
51#define DEF_HELPER_FLAGS_4(name, flags, ret, t1, t2, t3, t4)            \
52extern TCGHelperInfo glue(helper_info_, name);                          \
53static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
54    dh_arg_decl(t1, 1), dh_arg_decl(t2, 2),                             \
55    dh_arg_decl(t3, 3), dh_arg_decl(t4, 4))                             \
56{                                                                       \
57    tcg_gen_call4(glue(helper_info_,name).func,                         \
58                  &glue(helper_info_,name), dh_retvar(ret),             \
59                  dh_arg(t1, 1), dh_arg(t2, 2),                         \
60                  dh_arg(t3, 3), dh_arg(t4, 4));                        \
61}
62
63#define DEF_HELPER_FLAGS_5(name, flags, ret, t1, t2, t3, t4, t5)        \
64extern TCGHelperInfo glue(helper_info_, name);                          \
65static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
66    dh_arg_decl(t1, 1), dh_arg_decl(t2, 2), dh_arg_decl(t3, 3),         \
67    dh_arg_decl(t4, 4), dh_arg_decl(t5, 5))                             \
68{                                                                       \
69    tcg_gen_call5(glue(helper_info_,name).func,                         \
70                  &glue(helper_info_,name), dh_retvar(ret),             \
71                  dh_arg(t1, 1), dh_arg(t2, 2), dh_arg(t3, 3),          \
72                  dh_arg(t4, 4), dh_arg(t5, 5));                        \
73}
74
75#define DEF_HELPER_FLAGS_6(name, flags, ret, t1, t2, t3, t4, t5, t6)    \
76extern TCGHelperInfo glue(helper_info_, name);                          \
77static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
78    dh_arg_decl(t1, 1), dh_arg_decl(t2, 2), dh_arg_decl(t3, 3),         \
79    dh_arg_decl(t4, 4), dh_arg_decl(t5, 5), dh_arg_decl(t6, 6))         \
80{                                                                       \
81    tcg_gen_call6(glue(helper_info_,name).func,                         \
82                  &glue(helper_info_,name), dh_retvar(ret),             \
83                  dh_arg(t1, 1), dh_arg(t2, 2), dh_arg(t3, 3),          \
84                  dh_arg(t4, 4), dh_arg(t5, 5), dh_arg(t6, 6));         \
85}
86
87#define DEF_HELPER_FLAGS_7(name, flags, ret, t1, t2, t3, t4, t5, t6, t7)\
88extern TCGHelperInfo glue(helper_info_, name);                          \
89static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
90    dh_arg_decl(t1, 1), dh_arg_decl(t2, 2), dh_arg_decl(t3, 3),         \
91    dh_arg_decl(t4, 4), dh_arg_decl(t5, 5), dh_arg_decl(t6, 6),         \
92    dh_arg_decl(t7, 7))                                                 \
93{                                                                       \
94    tcg_gen_call7(glue(helper_info_,name).func,                         \
95                  &glue(helper_info_,name), dh_retvar(ret),             \
96                  dh_arg(t1, 1), dh_arg(t2, 2), dh_arg(t3, 3),          \
97                  dh_arg(t4, 4), dh_arg(t5, 5), dh_arg(t6, 6),          \
98                  dh_arg(t7, 7));                                       \
99}
100
101#include HELPER_H
102
103#undef DEF_HELPER_FLAGS_0
104#undef DEF_HELPER_FLAGS_1
105#undef DEF_HELPER_FLAGS_2
106#undef DEF_HELPER_FLAGS_3
107#undef DEF_HELPER_FLAGS_4
108#undef DEF_HELPER_FLAGS_5
109#undef DEF_HELPER_FLAGS_6
110#undef DEF_HELPER_FLAGS_7
111