codegen: use gen_frame_target for generic bit operations
[ajla.git] / ipret-a3.inc
blob827fc217192bc4ac0537a08a14c8de6088967a14
1 /*
2  * Copyright (C) 2024 Mikulas Patocka
3  *
4  * This file is part of Ajla.
5  *
6  * Ajla is free software: you can redistribute it and/or modify it under the
7  * terms of the GNU General Public License as published by the Free Software
8  * Foundation, either version 3 of the License, or (at your option) any later
9  * version.
10  *
11  * Ajla is distributed in the hope that it will be useful, but WITHOUT ANY
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13  * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along with
16  * Ajla. If not, see <https://www.gnu.org/licenses/>.
17  */
19 #define OPC(op)         (OPCODE_REAL_OP + cat(OPCODE_REAL_OP_,op) * OPCODE_REAL_OP_MULT + cat(OPCODE_REAL_TYPE_,type) * OPCODE_REAL_TYPE_MULT)
21 #if cat3(REAL,TYPE_BITS,_ALT1_TYPES) & TYPE_MASK
23 #define orig_op         add
24 #define op              add_alt1
25 #define OPF             cat4(REAL,TYPE_BITS,_,ALT1_)
26 #define DEF(type)       DEFINE_FIXED_REAL_BINARY_OPCODE(REAL_, type, op)
27 #include "ipret-b1.inc"
29 #define orig_op         add
30 #define op              add_alt2
31 #define OPF             cat4(REAL,TYPE_BITS,_,ALT2_)
32 #define DEF(type)       DEFINE_FIXED_REAL_BINARY_OPCODE(REAL_, type, op)
33 #include "ipret-b1.inc"
35 #define orig_op         subtract
36 #define op              subtract_alt1
37 #define OPF             cat4(REAL,TYPE_BITS,_,ALT1_)
38 #define DEF(type)       DEFINE_FIXED_REAL_BINARY_OPCODE(REAL_, type, op)
39 #include "ipret-b1.inc"
41 #define orig_op         subtract
42 #define op              subtract_alt2
43 #define OPF             cat4(REAL,TYPE_BITS,_,ALT2_)
44 #define DEF(type)       DEFINE_FIXED_REAL_BINARY_OPCODE(REAL_, type, op)
45 #include "ipret-b1.inc"
47 #define orig_op         multiply
48 #define op              multiply_alt1
49 #define OPF             cat4(REAL,TYPE_BITS,_,ALT1_)
50 #define DEF(type)       DEFINE_FIXED_REAL_BINARY_OPCODE(REAL_, type, op)
51 #include "ipret-b1.inc"
53 #define orig_op         multiply
54 #define op              multiply_alt2
55 #define OPF             cat4(REAL,TYPE_BITS,_,ALT2_)
56 #define DEF(type)       DEFINE_FIXED_REAL_BINARY_OPCODE(REAL_, type, op)
57 #include "ipret-b1.inc"
59 #define orig_op         divide
60 #define op              divide_alt1
61 #define OPF             cat4(REAL,TYPE_BITS,_,ALT1_)
62 #define DEF(type)       DEFINE_FIXED_REAL_BINARY_OPCODE(REAL_, type, op)
63 #include "ipret-b1.inc"
65 #define orig_op         divide
66 #define op              divide_alt2
67 #define OPF             cat4(REAL,TYPE_BITS,_,ALT2_)
68 #define DEF(type)       DEFINE_FIXED_REAL_BINARY_OPCODE(REAL_, type, op)
69 #include "ipret-b1.inc"
71 #define orig_op         equal
72 #define op              equal_alt1
73 #define OPF             cat4(REAL,TYPE_BITS,_,ALT1_)
74 #define DEF(type)       DEFINE_FIXED_REAL_BINARY_OPCODE(REAL_, type, op)
75 #include "ipret-b1.inc"
77 #define orig_op         equal
78 #define op              equal_alt2
79 #define OPF             cat4(REAL,TYPE_BITS,_,ALT2_)
80 #define DEF(type)       DEFINE_FIXED_REAL_BINARY_OPCODE(REAL_, type, op)
81 #include "ipret-b1.inc"
83 #define orig_op         not_equal
84 #define op              not_equal_alt1
85 #define OPF             cat4(REAL,TYPE_BITS,_,ALT1_)
86 #define DEF(type)       DEFINE_FIXED_REAL_BINARY_OPCODE(REAL_, type, op)
87 #include "ipret-b1.inc"
89 #define orig_op         not_equal
90 #define op              not_equal_alt2
91 #define OPF             cat4(REAL,TYPE_BITS,_,ALT2_)
92 #define DEF(type)       DEFINE_FIXED_REAL_BINARY_OPCODE(REAL_, type, op)
93 #include "ipret-b1.inc"
95 #define orig_op         less
96 #define op              less_alt1
97 #define OPF             cat4(REAL,TYPE_BITS,_,ALT1_)
98 #define DEF(type)       DEFINE_FIXED_REAL_BINARY_OPCODE(REAL_, type, op)
99 #include "ipret-b1.inc"
101 #define orig_op         less
102 #define op              less_alt2
103 #define OPF             cat4(REAL,TYPE_BITS,_,ALT2_)
104 #define DEF(type)       DEFINE_FIXED_REAL_BINARY_OPCODE(REAL_, type, op)
105 #include "ipret-b1.inc"
107 #define orig_op         less_equal
108 #define op              less_equal_alt1
109 #define OPF             cat4(REAL,TYPE_BITS,_,ALT1_)
110 #define DEF(type)       DEFINE_FIXED_REAL_BINARY_OPCODE(REAL_, type, op)
111 #include "ipret-b1.inc"
113 #define orig_op         less_equal
114 #define op              less_equal_alt2
115 #define OPF             cat4(REAL,TYPE_BITS,_,ALT2_)
116 #define DEF(type)       DEFINE_FIXED_REAL_BINARY_OPCODE(REAL_, type, op)
117 #include "ipret-b1.inc"
119 #if TYPE_MASK != 1
120 #define orig_op         neg
121 #define op              neg_alt1
122 #define OPF             cat4(REAL,TYPE_BITS,_,ALT1_)
123 #define DEF(type)       DEFINE_FIXED_REAL_UNARY_OPCODE(REAL_, type, op)
124 #include "ipret-b1.inc"
126 #define orig_op         neg
127 #define op              neg_alt2
128 #define OPF             cat4(REAL,TYPE_BITS,_,ALT2_)
129 #define DEF(type)       DEFINE_FIXED_REAL_UNARY_OPCODE(REAL_, type, op)
130 #include "ipret-b1.inc"
132 #define orig_op         sqrt
133 #define op              sqrt_alt1
134 #define OPF             cat4(REAL,TYPE_BITS,_,ALT1_)
135 #define DEF(type)       DEFINE_FIXED_REAL_UNARY_OPCODE(REAL_, type, op)
136 #include "ipret-b1.inc"
138 #define orig_op         sqrt
139 #define op              sqrt_alt2
140 #define OPF             cat4(REAL,TYPE_BITS,_,ALT2_)
141 #define DEF(type)       DEFINE_FIXED_REAL_UNARY_OPCODE(REAL_, type, op)
142 #include "ipret-b1.inc"
143 #endif
145 #define orig_op         to_int
146 #define op              to_int_alt1
147 #define OPF             cat4(REAL,TYPE_BITS,_,ALT1_)
148 #define DEF(type)       DEFINE_REAL_TO_INT(type, op)
149 #include "ipret-b1.inc"
151 #if TYPE_MASK != 1
152 #define orig_op         to_int
153 #define op              to_int_alt2
154 #define OPF             cat4(REAL,TYPE_BITS,_,ALT2_)
155 #define DEF(type)       DEFINE_REAL_TO_INT(type, op)
156 #include "ipret-b1.inc"
157 #endif
159 #define orig_op         from_int
160 #define op              from_int_alt1
161 #define OPF             cat4(REAL,TYPE_BITS,_,ALT1_)
162 #define DEF(type)       DEFINE_REAL_FROM_INT(type, op)
163 #include "ipret-b1.inc"
165 #if TYPE_MASK != 1
166 #define orig_op         from_int
167 #define op              from_int_alt2
168 #define OPF             cat4(REAL,TYPE_BITS,_,ALT2_)
169 #define DEF(type)       DEFINE_REAL_FROM_INT(type, op)
170 #include "ipret-b1.inc"
171 #endif
173 #if TYPE_MASK != 1
174 #define orig_op         is_exception
175 #define op              is_exception_alt1
176 #define OPF             cat4(REAL,TYPE_BITS,_,ALT1_)
177 #define DEF(type)       DEFINE_FIXED_REAL_UNARY_OPCODE(REAL_, type, op)
178 #include "ipret-b1.inc"
180 #define orig_op         is_exception
181 #define op              is_exception_alt2
182 #define OPF             cat4(REAL,TYPE_BITS,_,ALT2_)
183 #define DEF(type)       DEFINE_FIXED_REAL_UNARY_OPCODE(REAL_, type, op)
184 #include "ipret-b1.inc"
185 #endif
187 #endif
189 #undef OPC