Revision a7812ae4 tcg/tcg-op.h

b/tcg/tcg-op.h
30 30

  
31 31
int gen_new_label(void);
32 32

  
33
static inline void tcg_gen_op1(int opc, TCGv arg1)
33
static inline void tcg_gen_op1_i32(int opc, TCGv_i32 arg1)
34 34
{
35 35
    *gen_opc_ptr++ = opc;
36
    *gen_opparam_ptr++ = GET_TCGV(arg1);
36
    *gen_opparam_ptr++ = GET_TCGV_I32(arg1);
37
}
38

  
39
static inline void tcg_gen_op1_i64(int opc, TCGv_i64 arg1)
40
{
41
    *gen_opc_ptr++ = opc;
42
    *gen_opparam_ptr++ = GET_TCGV_I64(arg1);
37 43
}
38 44

  
39 45
static inline void tcg_gen_op1i(int opc, TCGArg arg1)
......
42 48
    *gen_opparam_ptr++ = arg1;
43 49
}
44 50

  
45
static inline void tcg_gen_op2(int opc, TCGv arg1, TCGv arg2)
51
static inline void tcg_gen_op2_i32(int opc, TCGv_i32 arg1, TCGv_i32 arg2)
52
{
53
    *gen_opc_ptr++ = opc;
54
    *gen_opparam_ptr++ = GET_TCGV_I32(arg1);
55
    *gen_opparam_ptr++ = GET_TCGV_I32(arg2);
56
}
57

  
58
static inline void tcg_gen_op2_i64(int opc, TCGv_i64 arg1, TCGv_i64 arg2)
59
{
60
    *gen_opc_ptr++ = opc;
61
    *gen_opparam_ptr++ = GET_TCGV_I64(arg1);
62
    *gen_opparam_ptr++ = GET_TCGV_I64(arg2);
63
}
64

  
65
static inline void tcg_gen_op2i_i32(int opc, TCGv_i32 arg1, TCGArg arg2)
46 66
{
47 67
    *gen_opc_ptr++ = opc;
48
    *gen_opparam_ptr++ = GET_TCGV(arg1);
49
    *gen_opparam_ptr++ = GET_TCGV(arg2);
68
    *gen_opparam_ptr++ = GET_TCGV_I32(arg1);
69
    *gen_opparam_ptr++ = arg2;
50 70
}
51 71

  
52
static inline void tcg_gen_op2i(int opc, TCGv arg1, TCGArg arg2)
72
static inline void tcg_gen_op2i_i64(int opc, TCGv_i64 arg1, TCGArg arg2)
53 73
{
54 74
    *gen_opc_ptr++ = opc;
55
    *gen_opparam_ptr++ = GET_TCGV(arg1);
75
    *gen_opparam_ptr++ = GET_TCGV_I64(arg1);
56 76
    *gen_opparam_ptr++ = arg2;
57 77
}
58 78

  
......
63 83
    *gen_opparam_ptr++ = arg2;
64 84
}
65 85

  
66
static inline void tcg_gen_op3(int opc, TCGv arg1, TCGv arg2, TCGv arg3)
86
static inline void tcg_gen_op3_i32(int opc, TCGv_i32 arg1, TCGv_i32 arg2,
87
                                   TCGv_i32 arg3)
88
{
89
    *gen_opc_ptr++ = opc;
90
    *gen_opparam_ptr++ = GET_TCGV_I32(arg1);
91
    *gen_opparam_ptr++ = GET_TCGV_I32(arg2);
92
    *gen_opparam_ptr++ = GET_TCGV_I32(arg3);
93
}
94

  
95
static inline void tcg_gen_op3_i64(int opc, TCGv_i64 arg1, TCGv_i64 arg2,
96
                                   TCGv_i64 arg3)
97
{
98
    *gen_opc_ptr++ = opc;
99
    *gen_opparam_ptr++ = GET_TCGV_I64(arg1);
100
    *gen_opparam_ptr++ = GET_TCGV_I64(arg2);
101
    *gen_opparam_ptr++ = GET_TCGV_I64(arg3);
102
}
103

  
104
static inline void tcg_gen_op3i_i32(int opc, TCGv_i32 arg1, TCGv_i32 arg2,
105
                                    TCGArg arg3)
67 106
{
68 107
    *gen_opc_ptr++ = opc;
69
    *gen_opparam_ptr++ = GET_TCGV(arg1);
70
    *gen_opparam_ptr++ = GET_TCGV(arg2);
71
    *gen_opparam_ptr++ = GET_TCGV(arg3);
108
    *gen_opparam_ptr++ = GET_TCGV_I32(arg1);
109
    *gen_opparam_ptr++ = GET_TCGV_I32(arg2);
110
    *gen_opparam_ptr++ = arg3;
72 111
}
73 112

  
74
static inline void tcg_gen_op3i(int opc, TCGv arg1, TCGv arg2, TCGArg arg3)
113
static inline void tcg_gen_op3i_i64(int opc, TCGv_i64 arg1, TCGv_i64 arg2,
114
                                    TCGArg arg3)
75 115
{
76 116
    *gen_opc_ptr++ = opc;
77
    *gen_opparam_ptr++ = GET_TCGV(arg1);
78
    *gen_opparam_ptr++ = GET_TCGV(arg2);
117
    *gen_opparam_ptr++ = GET_TCGV_I64(arg1);
118
    *gen_opparam_ptr++ = GET_TCGV_I64(arg2);
79 119
    *gen_opparam_ptr++ = arg3;
80 120
}
81 121

  
82
static inline void tcg_gen_op4(int opc, TCGv arg1, TCGv arg2, TCGv arg3, 
83
                               TCGv arg4)
122
static inline void tcg_gen_ldst_op_i32(int opc, TCGv_i32 val, TCGv_ptr base,
123
                                       TCGArg offset)
124
{
125
    *gen_opc_ptr++ = opc;
126
    *gen_opparam_ptr++ = GET_TCGV_I32(val);
127
    *gen_opparam_ptr++ = GET_TCGV_PTR(base);
128
    *gen_opparam_ptr++ = offset;
129
}
130

  
131
static inline void tcg_gen_ldst_op_i64(int opc, TCGv_i64 val, TCGv_ptr base,
132
                                       TCGArg offset)
133
{
134
    *gen_opc_ptr++ = opc;
135
    *gen_opparam_ptr++ = GET_TCGV_I32(val);
136
    *gen_opparam_ptr++ = GET_TCGV_PTR(base);
137
    *gen_opparam_ptr++ = offset;
138
}
139

  
140
static inline void tcg_gen_qemu_ldst_op_i64_i32(int opc, TCGv_i64 val, TCGv_i32 addr,
141
                                                TCGArg mem_index)
142
{
143
    *gen_opc_ptr++ = opc;
144
    *gen_opparam_ptr++ = GET_TCGV_I64(val);
145
    *gen_opparam_ptr++ = GET_TCGV_I32(addr);
146
    *gen_opparam_ptr++ = mem_index;
147
}
148

  
149
static inline void tcg_gen_qemu_ldst_op_i64_i64(int opc, TCGv_i64 val, TCGv_i64 addr,
150
                                                TCGArg mem_index)
151
{
152
    *gen_opc_ptr++ = opc;
153
    *gen_opparam_ptr++ = GET_TCGV_I64(val);
154
    *gen_opparam_ptr++ = GET_TCGV_I64(addr);
155
    *gen_opparam_ptr++ = mem_index;
156
}
157

  
158
static inline void tcg_gen_op4_i32(int opc, TCGv_i32 arg1, TCGv_i32 arg2,
159
                                   TCGv_i32 arg3, TCGv_i32 arg4)
160
{
161
    *gen_opc_ptr++ = opc;
162
    *gen_opparam_ptr++ = GET_TCGV_I32(arg1);
163
    *gen_opparam_ptr++ = GET_TCGV_I32(arg2);
164
    *gen_opparam_ptr++ = GET_TCGV_I32(arg3);
165
    *gen_opparam_ptr++ = GET_TCGV_I32(arg4);
166
}
167

  
168
static inline void tcg_gen_op4_i64(int opc, TCGv_i64 arg1, TCGv_i64 arg2,
169
                                   TCGv_i64 arg3, TCGv_i32 arg4)
170
{
171
    *gen_opc_ptr++ = opc;
172
    *gen_opparam_ptr++ = GET_TCGV_I64(arg1);
173
    *gen_opparam_ptr++ = GET_TCGV_I64(arg2);
174
    *gen_opparam_ptr++ = GET_TCGV_I64(arg3);
175
    *gen_opparam_ptr++ = GET_TCGV_I64(arg4);
176
}
177

  
178
static inline void tcg_gen_op4i_i32(int opc, TCGv_i32 arg1, TCGv_i32 arg2,
179
                                    TCGv_i32 arg3, TCGArg arg4)
180
{
181
    *gen_opc_ptr++ = opc;
182
    *gen_opparam_ptr++ = GET_TCGV_I32(arg1);
183
    *gen_opparam_ptr++ = GET_TCGV_I32(arg2);
184
    *gen_opparam_ptr++ = GET_TCGV_I32(arg3);
185
    *gen_opparam_ptr++ = arg4;
186
}
187

  
188
static inline void tcg_gen_op4i_i64(int opc, TCGv_i64 arg1, TCGv_i64 arg2,
189
                                    TCGv_i64 arg3, TCGArg arg4)
84 190
{
85 191
    *gen_opc_ptr++ = opc;
86
    *gen_opparam_ptr++ = GET_TCGV(arg1);
87
    *gen_opparam_ptr++ = GET_TCGV(arg2);
88
    *gen_opparam_ptr++ = GET_TCGV(arg3);
89
    *gen_opparam_ptr++ = GET_TCGV(arg4);
192
    *gen_opparam_ptr++ = GET_TCGV_I64(arg1);
193
    *gen_opparam_ptr++ = GET_TCGV_I64(arg2);
194
    *gen_opparam_ptr++ = GET_TCGV_I64(arg3);
195
    *gen_opparam_ptr++ = arg4;
90 196
}
91 197

  
92
static inline void tcg_gen_op4i(int opc, TCGv arg1, TCGv arg2, TCGv arg3, 
93
                                TCGArg arg4)
198
static inline void tcg_gen_op4ii_i32(int opc, TCGv_i32 arg1, TCGv_i32 arg2,
199
                                     TCGArg arg3, TCGArg arg4)
94 200
{
95 201
    *gen_opc_ptr++ = opc;
96
    *gen_opparam_ptr++ = GET_TCGV(arg1);
97
    *gen_opparam_ptr++ = GET_TCGV(arg2);
98
    *gen_opparam_ptr++ = GET_TCGV(arg3);
202
    *gen_opparam_ptr++ = GET_TCGV_I32(arg1);
203
    *gen_opparam_ptr++ = GET_TCGV_I32(arg2);
204
    *gen_opparam_ptr++ = arg3;
99 205
    *gen_opparam_ptr++ = arg4;
100 206
}
101 207

  
102
static inline void tcg_gen_op4ii(int opc, TCGv arg1, TCGv arg2, TCGArg arg3, 
103
                                 TCGArg arg4)
208
static inline void tcg_gen_op4ii_i64(int opc, TCGv_i64 arg1, TCGv_i64 arg2,
209
                                     TCGArg arg3, TCGArg arg4)
104 210
{
105 211
    *gen_opc_ptr++ = opc;
106
    *gen_opparam_ptr++ = GET_TCGV(arg1);
107
    *gen_opparam_ptr++ = GET_TCGV(arg2);
212
    *gen_opparam_ptr++ = GET_TCGV_I64(arg1);
213
    *gen_opparam_ptr++ = GET_TCGV_I64(arg2);
108 214
    *gen_opparam_ptr++ = arg3;
109 215
    *gen_opparam_ptr++ = arg4;
110 216
}
111 217

  
112
static inline void tcg_gen_op5(int opc, TCGv arg1, TCGv arg2, 
113
                               TCGv arg3, TCGv arg4,
114
                               TCGv arg5)
218
static inline void tcg_gen_op5_i32(int opc, TCGv_i32 arg1, TCGv_i32 arg2,
219
                                   TCGv_i32 arg3, TCGv_i32 arg4, TCGv_i32 arg5)
220
{
221
    *gen_opc_ptr++ = opc;
222
    *gen_opparam_ptr++ = GET_TCGV_I32(arg1);
223
    *gen_opparam_ptr++ = GET_TCGV_I32(arg2);
224
    *gen_opparam_ptr++ = GET_TCGV_I32(arg3);
225
    *gen_opparam_ptr++ = GET_TCGV_I32(arg4);
226
    *gen_opparam_ptr++ = GET_TCGV_I32(arg5);
227
}
228

  
229
static inline void tcg_gen_op5_i64(int opc, TCGv_i64 arg1, TCGv_i64 arg2,
230
                                   TCGv_i64 arg3, TCGv_i64 arg4, TCGv_i64 arg5)
231
{
232
    *gen_opc_ptr++ = opc;
233
    *gen_opparam_ptr++ = GET_TCGV_I64(arg1);
234
    *gen_opparam_ptr++ = GET_TCGV_I64(arg2);
235
    *gen_opparam_ptr++ = GET_TCGV_I64(arg3);
236
    *gen_opparam_ptr++ = GET_TCGV_I64(arg4);
237
    *gen_opparam_ptr++ = GET_TCGV_I64(arg5);
238
}
239

  
240
static inline void tcg_gen_op5i_i32(int opc, TCGv_i32 arg1, TCGv_i32 arg2,
241
                                    TCGv_i32 arg3, TCGv_i32 arg4, TCGArg arg5)
115 242
{
116 243
    *gen_opc_ptr++ = opc;
117
    *gen_opparam_ptr++ = GET_TCGV(arg1);
118
    *gen_opparam_ptr++ = GET_TCGV(arg2);
119
    *gen_opparam_ptr++ = GET_TCGV(arg3);
120
    *gen_opparam_ptr++ = GET_TCGV(arg4);
121
    *gen_opparam_ptr++ = GET_TCGV(arg5);
244
    *gen_opparam_ptr++ = GET_TCGV_I32(arg1);
245
    *gen_opparam_ptr++ = GET_TCGV_I32(arg2);
246
    *gen_opparam_ptr++ = GET_TCGV_I32(arg3);
247
    *gen_opparam_ptr++ = GET_TCGV_I32(arg4);
248
    *gen_opparam_ptr++ = arg5;
122 249
}
123 250

  
124
static inline void tcg_gen_op5i(int opc, TCGv arg1, TCGv arg2, 
125
                                TCGv arg3, TCGv arg4,
126
                                TCGArg arg5)
251
static inline void tcg_gen_op5i_i64(int opc, TCGv_i64 arg1, TCGv_i64 arg2,
252
                                    TCGv_i64 arg3, TCGv_i64 arg4, TCGArg arg5)
127 253
{
128 254
    *gen_opc_ptr++ = opc;
129
    *gen_opparam_ptr++ = GET_TCGV(arg1);
130
    *gen_opparam_ptr++ = GET_TCGV(arg2);
131
    *gen_opparam_ptr++ = GET_TCGV(arg3);
132
    *gen_opparam_ptr++ = GET_TCGV(arg4);
255
    *gen_opparam_ptr++ = GET_TCGV_I64(arg1);
256
    *gen_opparam_ptr++ = GET_TCGV_I64(arg2);
257
    *gen_opparam_ptr++ = GET_TCGV_I64(arg3);
258
    *gen_opparam_ptr++ = GET_TCGV_I64(arg4);
133 259
    *gen_opparam_ptr++ = arg5;
134 260
}
135 261

  
136
static inline void tcg_gen_op6(int opc, TCGv arg1, TCGv arg2, 
137
                               TCGv arg3, TCGv arg4,
138
                               TCGv arg5, TCGv arg6)
262
static inline void tcg_gen_op6_i32(int opc, TCGv_i32 arg1, TCGv_i32 arg2,
263
                                   TCGv_i32 arg3, TCGv_i32 arg4, TCGv_i32 arg5,
264
                                   TCGv_i32 arg6)
265
{
266
    *gen_opc_ptr++ = opc;
267
    *gen_opparam_ptr++ = GET_TCGV_I32(arg1);
268
    *gen_opparam_ptr++ = GET_TCGV_I32(arg2);
269
    *gen_opparam_ptr++ = GET_TCGV_I32(arg3);
270
    *gen_opparam_ptr++ = GET_TCGV_I32(arg4);
271
    *gen_opparam_ptr++ = GET_TCGV_I32(arg5);
272
    *gen_opparam_ptr++ = GET_TCGV_I32(arg6);
273
}
274

  
275
static inline void tcg_gen_op6_i64(int opc, TCGv_i64 arg1, TCGv_i64 arg2,
276
                                   TCGv_i64 arg3, TCGv_i64 arg4, TCGv_i64 arg5,
277
                                   TCGv_i64 arg6)
139 278
{
140 279
    *gen_opc_ptr++ = opc;
141
    *gen_opparam_ptr++ = GET_TCGV(arg1);
142
    *gen_opparam_ptr++ = GET_TCGV(arg2);
143
    *gen_opparam_ptr++ = GET_TCGV(arg3);
144
    *gen_opparam_ptr++ = GET_TCGV(arg4);
145
    *gen_opparam_ptr++ = GET_TCGV(arg5);
146
    *gen_opparam_ptr++ = GET_TCGV(arg6);
280
    *gen_opparam_ptr++ = GET_TCGV_I64(arg1);
281
    *gen_opparam_ptr++ = GET_TCGV_I64(arg2);
282
    *gen_opparam_ptr++ = GET_TCGV_I64(arg3);
283
    *gen_opparam_ptr++ = GET_TCGV_I64(arg4);
284
    *gen_opparam_ptr++ = GET_TCGV_I64(arg5);
285
    *gen_opparam_ptr++ = GET_TCGV_I64(arg6);
147 286
}
148 287

  
149
static inline void tcg_gen_op6ii(int opc, TCGv arg1, TCGv arg2, 
150
                                 TCGv arg3, TCGv arg4,
151
                                 TCGArg arg5, TCGArg arg6)
288
static inline void tcg_gen_op6ii_i32(int opc, TCGv_i32 arg1, TCGv_i32 arg2,
289
                                     TCGv_i32 arg3, TCGv_i32 arg4, TCGArg arg5,
290
                                     TCGArg arg6)
152 291
{
153 292
    *gen_opc_ptr++ = opc;
154
    *gen_opparam_ptr++ = GET_TCGV(arg1);
155
    *gen_opparam_ptr++ = GET_TCGV(arg2);
156
    *gen_opparam_ptr++ = GET_TCGV(arg3);
157
    *gen_opparam_ptr++ = GET_TCGV(arg4);
293
    *gen_opparam_ptr++ = GET_TCGV_I32(arg1);
294
    *gen_opparam_ptr++ = GET_TCGV_I32(arg2);
295
    *gen_opparam_ptr++ = GET_TCGV_I32(arg3);
296
    *gen_opparam_ptr++ = GET_TCGV_I32(arg4);
297
    *gen_opparam_ptr++ = arg5;
298
    *gen_opparam_ptr++ = arg6;
299
}
300

  
301
static inline void tcg_gen_op6ii_i64(int opc, TCGv_i64 arg1, TCGv_i64 arg2,
302
                                     TCGv_i64 arg3, TCGv_i64 arg4, TCGArg arg5,
303
                                     TCGArg arg6)
304
{
305
    *gen_opc_ptr++ = opc;
306
    *gen_opparam_ptr++ = GET_TCGV_I64(arg1);
307
    *gen_opparam_ptr++ = GET_TCGV_I64(arg2);
308
    *gen_opparam_ptr++ = GET_TCGV_I64(arg3);
309
    *gen_opparam_ptr++ = GET_TCGV_I64(arg4);
158 310
    *gen_opparam_ptr++ = arg5;
159 311
    *gen_opparam_ptr++ = arg6;
160 312
}
......
169 321
    tcg_gen_op1i(INDEX_op_br, label);
170 322
}
171 323

  
172
static inline void tcg_gen_mov_i32(TCGv ret, TCGv arg)
324
static inline void tcg_gen_mov_i32(TCGv_i32 ret, TCGv_i32 arg)
173 325
{
174
    if (GET_TCGV(ret) != GET_TCGV(arg))
175
        tcg_gen_op2(INDEX_op_mov_i32, ret, arg);
326
    if (GET_TCGV_I32(ret) != GET_TCGV_I32(arg))
327
        tcg_gen_op2_i32(INDEX_op_mov_i32, ret, arg);
176 328
}
177 329

  
178
static inline void tcg_gen_movi_i32(TCGv ret, int32_t arg)
330
static inline void tcg_gen_movi_i32(TCGv_i32 ret, int32_t arg)
179 331
{
180
    tcg_gen_op2i(INDEX_op_movi_i32, ret, arg);
332
    tcg_gen_op2i_i32(INDEX_op_movi_i32, ret, arg);
181 333
}
182 334

  
183 335
/* helper calls */
184
#define TCG_HELPER_CALL_FLAGS 0
336
static inline void tcg_gen_helperN(void *func, int flags, int sizemask,
337
                                   TCGArg ret, int nargs, TCGArg *args)
338
{
339
    TCGv_ptr fn;
340
    fn = tcg_const_ptr((tcg_target_long)func);
341
    tcg_gen_callN(&tcg_ctx, fn, flags, sizemask, ret,
342
                  nargs, args);
343
    tcg_temp_free_ptr(fn);
344
}
185 345

  
186
static inline void tcg_gen_helper_0_0(void *func)
346
/* FIXME: Should this be pure?  */
347
static inline void tcg_gen_helper64(void *func, TCGv_i64 ret,
348
                                    TCGv_i64 a, TCGv_i64 b)
187 349
{
188
    TCGv t0;
189
    t0 = tcg_const_ptr((tcg_target_long)func);
190
    tcg_gen_call(&tcg_ctx, 
191
                 t0, TCG_HELPER_CALL_FLAGS,
192
                 0, NULL, 0, NULL);
193
    tcg_temp_free(t0);
194
}
195

  
196
static inline void tcg_gen_helper_0_1(void *func, TCGv arg)
197
{
198
    TCGv t0;
199
    t0 = tcg_const_ptr((tcg_target_long)func);
200
    tcg_gen_call(&tcg_ctx,
201
                 t0, TCG_HELPER_CALL_FLAGS,
202
                 0, NULL, 1, &arg);
203
    tcg_temp_free(t0);
204
}
205

  
206
static inline void tcg_gen_helper_0_2(void *func, TCGv arg1, TCGv arg2)
207
{
208
    TCGv args[2];
209
    TCGv t0;
210
    args[0] = arg1;
211
    args[1] = arg2;
212
    t0 = tcg_const_ptr((tcg_target_long)func);
213
    tcg_gen_call(&tcg_ctx, 
214
                 t0, TCG_HELPER_CALL_FLAGS,
215
                 0, NULL, 2, args);
216
    tcg_temp_free(t0);
217
}
218

  
219
static inline void tcg_gen_helper_0_3(void *func,
220
                                      TCGv arg1, TCGv arg2, TCGv arg3)
221
{
222
    TCGv args[3];
223
    TCGv t0;
224
    args[0] = arg1;
225
    args[1] = arg2;
226
    args[2] = arg3;
227
    t0 = tcg_const_ptr((tcg_target_long)func);
228
    tcg_gen_call(&tcg_ctx,
229
                 t0, TCG_HELPER_CALL_FLAGS,
230
                 0, NULL, 3, args);
231
    tcg_temp_free(t0);
232
}
233

  
234
static inline void tcg_gen_helper_0_4(void *func, TCGv arg1, TCGv arg2,
235
                                      TCGv arg3, TCGv arg4)
236
{
237
    TCGv args[4];
238
    TCGv t0;
239
    args[0] = arg1;
240
    args[1] = arg2;
241
    args[2] = arg3;
242
    args[3] = arg4;
243
    t0 = tcg_const_ptr((tcg_target_long)func);
244
    tcg_gen_call(&tcg_ctx,
245
                 t0, TCG_HELPER_CALL_FLAGS,
246
                 0, NULL, 4, args);
247
    tcg_temp_free(t0);
248
}
249

  
250
static inline void tcg_gen_helper_1_0(void *func, TCGv ret)
251
{
252
    TCGv t0;
253
    t0 = tcg_const_ptr((tcg_target_long)func);
254
    tcg_gen_call(&tcg_ctx,
255
                 t0, TCG_HELPER_CALL_FLAGS,
256
                 1, &ret, 0, NULL);
257
    tcg_temp_free(t0);
258
}
259

  
260
static inline void tcg_gen_helper_1_1(void *func, TCGv ret, TCGv arg1)
261
{
262
    TCGv t0;
263
    t0 = tcg_const_ptr((tcg_target_long)func);
264
    tcg_gen_call(&tcg_ctx,
265
                 t0, TCG_HELPER_CALL_FLAGS,
266
                 1, &ret, 1, &arg1);
267
    tcg_temp_free(t0);
268
}
269

  
270
static inline void tcg_gen_helper_1_2(void *func, TCGv ret, 
271
                                      TCGv arg1, TCGv arg2)
272
{
273
    TCGv args[2];
274
    TCGv t0;
275
    args[0] = arg1;
276
    args[1] = arg2;
277
    t0 = tcg_const_ptr((tcg_target_long)func);
278
    tcg_gen_call(&tcg_ctx, 
279
                 t0, TCG_HELPER_CALL_FLAGS,
280
                 1, &ret, 2, args);
281
    tcg_temp_free(t0);
282
}
283

  
284
static inline void tcg_gen_helper_1_3(void *func, TCGv ret,
285
                                      TCGv arg1, TCGv arg2, TCGv arg3)
286
{
287
    TCGv args[3];
288
    TCGv t0;
289
    args[0] = arg1;
290
    args[1] = arg2;
291
    args[2] = arg3;
292
    t0 = tcg_const_ptr((tcg_target_long)func);
293
    tcg_gen_call(&tcg_ctx,
294
                 t0, TCG_HELPER_CALL_FLAGS,
295
                 1, &ret, 3, args);
296
    tcg_temp_free(t0);
297
}
298

  
299
static inline void tcg_gen_helper_1_4(void *func, TCGv ret,
300
                                      TCGv arg1, TCGv arg2, TCGv arg3,
301
                                      TCGv arg4)
302
{
303
    TCGv args[4];
304
    TCGv t0;
305
    args[0] = arg1;
306
    args[1] = arg2;
307
    args[2] = arg3;
308
    args[3] = arg4;
309
    t0 = tcg_const_ptr((tcg_target_long)func);
310
    tcg_gen_call(&tcg_ctx,
311
                 t0, TCG_HELPER_CALL_FLAGS,
312
                 1, &ret, 4, args);
313
    tcg_temp_free(t0);
350
    TCGv_ptr fn;
351
    TCGArg args[2];
352
    fn = tcg_const_ptr((tcg_target_long)func);
353
    args[0] = GET_TCGV_I64(a);
354
    args[1] = GET_TCGV_I64(b);
355
    tcg_gen_callN(&tcg_ctx, fn, 0, 7, GET_TCGV_I64(ret), 2, args);
356
    tcg_temp_free_ptr(fn);
314 357
}
315 358

  
316 359
/* 32 bit ops */
317 360

  
318
static inline void tcg_gen_ld8u_i32(TCGv ret, TCGv arg2, tcg_target_long offset)
361
static inline void tcg_gen_ld8u_i32(TCGv_i32 ret, TCGv_ptr arg2, tcg_target_long offset)
319 362
{
320
    tcg_gen_op3i(INDEX_op_ld8u_i32, ret, arg2, offset);
363
    tcg_gen_ldst_op_i32(INDEX_op_ld8u_i32, ret, arg2, offset);
321 364
}
322 365

  
323
static inline void tcg_gen_ld8s_i32(TCGv ret, TCGv arg2, tcg_target_long offset)
366
static inline void tcg_gen_ld8s_i32(TCGv_i32 ret, TCGv_ptr arg2, tcg_target_long offset)
324 367
{
325
    tcg_gen_op3i(INDEX_op_ld8s_i32, ret, arg2, offset);
368
    tcg_gen_ldst_op_i32(INDEX_op_ld8s_i32, ret, arg2, offset);
326 369
}
327 370

  
328
static inline void tcg_gen_ld16u_i32(TCGv ret, TCGv arg2, tcg_target_long offset)
371
static inline void tcg_gen_ld16u_i32(TCGv_i32 ret, TCGv_ptr arg2, tcg_target_long offset)
329 372
{
330
    tcg_gen_op3i(INDEX_op_ld16u_i32, ret, arg2, offset);
373
    tcg_gen_ldst_op_i32(INDEX_op_ld16u_i32, ret, arg2, offset);
331 374
}
332 375

  
333
static inline void tcg_gen_ld16s_i32(TCGv ret, TCGv arg2, tcg_target_long offset)
376
static inline void tcg_gen_ld16s_i32(TCGv_i32 ret, TCGv_ptr arg2, tcg_target_long offset)
334 377
{
335
    tcg_gen_op3i(INDEX_op_ld16s_i32, ret, arg2, offset);
378
    tcg_gen_ldst_op_i32(INDEX_op_ld16s_i32, ret, arg2, offset);
336 379
}
337 380

  
338
static inline void tcg_gen_ld_i32(TCGv ret, TCGv arg2, tcg_target_long offset)
381
static inline void tcg_gen_ld_i32(TCGv_i32 ret, TCGv_ptr arg2, tcg_target_long offset)
339 382
{
340
    tcg_gen_op3i(INDEX_op_ld_i32, ret, arg2, offset);
383
    tcg_gen_ldst_op_i32(INDEX_op_ld_i32, ret, arg2, offset);
341 384
}
342 385

  
343
static inline void tcg_gen_st8_i32(TCGv arg1, TCGv arg2, tcg_target_long offset)
386
static inline void tcg_gen_st8_i32(TCGv_i32 arg1, TCGv_ptr arg2, tcg_target_long offset)
344 387
{
345
    tcg_gen_op3i(INDEX_op_st8_i32, arg1, arg2, offset);
388
    tcg_gen_ldst_op_i32(INDEX_op_st8_i32, arg1, arg2, offset);
346 389
}
347 390

  
348
static inline void tcg_gen_st16_i32(TCGv arg1, TCGv arg2, tcg_target_long offset)
391
static inline void tcg_gen_st16_i32(TCGv_i32 arg1, TCGv_ptr arg2, tcg_target_long offset)
349 392
{
350
    tcg_gen_op3i(INDEX_op_st16_i32, arg1, arg2, offset);
393
    tcg_gen_ldst_op_i32(INDEX_op_st16_i32, arg1, arg2, offset);
351 394
}
352 395

  
353
static inline void tcg_gen_st_i32(TCGv arg1, TCGv arg2, tcg_target_long offset)
396
static inline void tcg_gen_st_i32(TCGv_i32 arg1, TCGv_ptr arg2, tcg_target_long offset)
354 397
{
355
    tcg_gen_op3i(INDEX_op_st_i32, arg1, arg2, offset);
398
    tcg_gen_ldst_op_i32(INDEX_op_st_i32, arg1, arg2, offset);
356 399
}
357 400

  
358
static inline void tcg_gen_add_i32(TCGv ret, TCGv arg1, TCGv arg2)
401
static inline void tcg_gen_add_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
359 402
{
360
    tcg_gen_op3(INDEX_op_add_i32, ret, arg1, arg2);
403
    tcg_gen_op3_i32(INDEX_op_add_i32, ret, arg1, arg2);
361 404
}
362 405

  
363
static inline void tcg_gen_addi_i32(TCGv ret, TCGv arg1, int32_t arg2)
406
static inline void tcg_gen_addi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2)
364 407
{
365 408
    /* some cases can be optimized here */
366 409
    if (arg2 == 0) {
367 410
        tcg_gen_mov_i32(ret, arg1);
368 411
    } else {
369
        TCGv t0 = tcg_const_i32(arg2);
412
        TCGv_i32 t0 = tcg_const_i32(arg2);
370 413
        tcg_gen_add_i32(ret, arg1, t0);
371
        tcg_temp_free(t0);
414
        tcg_temp_free_i32(t0);
372 415
    }
373 416
}
374 417

  
375
static inline void tcg_gen_sub_i32(TCGv ret, TCGv arg1, TCGv arg2)
418
static inline void tcg_gen_sub_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
376 419
{
377
    tcg_gen_op3(INDEX_op_sub_i32, ret, arg1, arg2);
420
    tcg_gen_op3_i32(INDEX_op_sub_i32, ret, arg1, arg2);
378 421
}
379 422

  
380
static inline void tcg_gen_subfi_i32(TCGv ret, int32_t arg1, TCGv arg2)
423
static inline void tcg_gen_subfi_i32(TCGv_i32 ret, int32_t arg1, TCGv_i32 arg2)
381 424
{
382
    TCGv t0 = tcg_const_i32(arg1);
425
    TCGv_i32 t0 = tcg_const_i32(arg1);
383 426
    tcg_gen_sub_i32(ret, t0, arg2);
384
    tcg_temp_free(t0);
427
    tcg_temp_free_i32(t0);
385 428
}
386 429

  
387
static inline void tcg_gen_subi_i32(TCGv ret, TCGv arg1, int32_t arg2)
430
static inline void tcg_gen_subi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2)
388 431
{
389 432
    /* some cases can be optimized here */
390 433
    if (arg2 == 0) {
391 434
        tcg_gen_mov_i32(ret, arg1);
392 435
    } else {
393
        TCGv t0 = tcg_const_i32(arg2);
436
        TCGv_i32 t0 = tcg_const_i32(arg2);
394 437
        tcg_gen_sub_i32(ret, arg1, t0);
395
        tcg_temp_free(t0);
438
        tcg_temp_free_i32(t0);
396 439
    }
397 440
}
398 441

  
399
static inline void tcg_gen_and_i32(TCGv ret, TCGv arg1, TCGv arg2)
442
static inline void tcg_gen_and_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
400 443
{
401
    tcg_gen_op3(INDEX_op_and_i32, ret, arg1, arg2);
444
    tcg_gen_op3_i32(INDEX_op_and_i32, ret, arg1, arg2);
402 445
}
403 446

  
404
static inline void tcg_gen_andi_i32(TCGv ret, TCGv arg1, int32_t arg2)
447
static inline void tcg_gen_andi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2)
405 448
{
406 449
    /* some cases can be optimized here */
407 450
    if (arg2 == 0) {
......
409 452
    } else if (arg2 == 0xffffffff) {
410 453
        tcg_gen_mov_i32(ret, arg1);
411 454
    } else {
412
        TCGv t0 = tcg_const_i32(arg2);
455
        TCGv_i32 t0 = tcg_const_i32(arg2);
413 456
        tcg_gen_and_i32(ret, arg1, t0);
414
        tcg_temp_free(t0);
457
        tcg_temp_free_i32(t0);
415 458
    }
416 459
}
417 460

  
418
static inline void tcg_gen_or_i32(TCGv ret, TCGv arg1, TCGv arg2)
461
static inline void tcg_gen_or_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
419 462
{
420
    tcg_gen_op3(INDEX_op_or_i32, ret, arg1, arg2);
463
    tcg_gen_op3_i32(INDEX_op_or_i32, ret, arg1, arg2);
421 464
}
422 465

  
423
static inline void tcg_gen_ori_i32(TCGv ret, TCGv arg1, int32_t arg2)
466
static inline void tcg_gen_ori_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2)
424 467
{
425 468
    /* some cases can be optimized here */
426 469
    if (arg2 == 0xffffffff) {
......
428 471
    } else if (arg2 == 0) {
429 472
        tcg_gen_mov_i32(ret, arg1);
430 473
    } else {
431
        TCGv t0 = tcg_const_i32(arg2);
474
        TCGv_i32 t0 = tcg_const_i32(arg2);
432 475
        tcg_gen_or_i32(ret, arg1, t0);
433
        tcg_temp_free(t0);
476
        tcg_temp_free_i32(t0);
434 477
    }
435 478
}
436 479

  
437
static inline void tcg_gen_xor_i32(TCGv ret, TCGv arg1, TCGv arg2)
480
static inline void tcg_gen_xor_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
438 481
{
439
    tcg_gen_op3(INDEX_op_xor_i32, ret, arg1, arg2);
482
    tcg_gen_op3_i32(INDEX_op_xor_i32, ret, arg1, arg2);
440 483
}
441 484

  
442
static inline void tcg_gen_xori_i32(TCGv ret, TCGv arg1, int32_t arg2)
485
static inline void tcg_gen_xori_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2)
443 486
{
444 487
    /* some cases can be optimized here */
445 488
    if (arg2 == 0) {
446 489
        tcg_gen_mov_i32(ret, arg1);
447 490
    } else {
448
        TCGv t0 = tcg_const_i32(arg2);
491
        TCGv_i32 t0 = tcg_const_i32(arg2);
449 492
        tcg_gen_xor_i32(ret, arg1, t0);
450
        tcg_temp_free(t0);
493
        tcg_temp_free_i32(t0);
451 494
    }
452 495
}
453 496

  
454
static inline void tcg_gen_shl_i32(TCGv ret, TCGv arg1, TCGv arg2)
497
static inline void tcg_gen_shl_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
455 498
{
456
    tcg_gen_op3(INDEX_op_shl_i32, ret, arg1, arg2);
499
    tcg_gen_op3_i32(INDEX_op_shl_i32, ret, arg1, arg2);
457 500
}
458 501

  
459
static inline void tcg_gen_shli_i32(TCGv ret, TCGv arg1, int32_t arg2)
502
static inline void tcg_gen_shli_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2)
460 503
{
461 504
    if (arg2 == 0) {
462 505
        tcg_gen_mov_i32(ret, arg1);
463 506
    } else {
464
        TCGv t0 = tcg_const_i32(arg2);
507
        TCGv_i32 t0 = tcg_const_i32(arg2);
465 508
        tcg_gen_shl_i32(ret, arg1, t0);
466
        tcg_temp_free(t0);
509
        tcg_temp_free_i32(t0);
467 510
    }
468 511
}
469 512

  
470
static inline void tcg_gen_shr_i32(TCGv ret, TCGv arg1, TCGv arg2)
513
static inline void tcg_gen_shr_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
471 514
{
472
    tcg_gen_op3(INDEX_op_shr_i32, ret, arg1, arg2);
515
    tcg_gen_op3_i32(INDEX_op_shr_i32, ret, arg1, arg2);
473 516
}
474 517

  
475
static inline void tcg_gen_shri_i32(TCGv ret, TCGv arg1, int32_t arg2)
518
static inline void tcg_gen_shri_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2)
476 519
{
477 520
    if (arg2 == 0) {
478 521
        tcg_gen_mov_i32(ret, arg1);
479 522
    } else {
480
        TCGv t0 = tcg_const_i32(arg2);
523
        TCGv_i32 t0 = tcg_const_i32(arg2);
481 524
        tcg_gen_shr_i32(ret, arg1, t0);
482
        tcg_temp_free(t0);
525
        tcg_temp_free_i32(t0);
483 526
    }
484 527
}
485 528

  
486
static inline void tcg_gen_sar_i32(TCGv ret, TCGv arg1, TCGv arg2)
529
static inline void tcg_gen_sar_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
487 530
{
488
    tcg_gen_op3(INDEX_op_sar_i32, ret, arg1, arg2);
531
    tcg_gen_op3_i32(INDEX_op_sar_i32, ret, arg1, arg2);
489 532
}
490 533

  
491
static inline void tcg_gen_sari_i32(TCGv ret, TCGv arg1, int32_t arg2)
534
static inline void tcg_gen_sari_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2)
492 535
{
493 536
    if (arg2 == 0) {
494 537
        tcg_gen_mov_i32(ret, arg1);
495 538
    } else {
496
        TCGv t0 = tcg_const_i32(arg2);
539
        TCGv_i32 t0 = tcg_const_i32(arg2);
497 540
        tcg_gen_sar_i32(ret, arg1, t0);
498
        tcg_temp_free(t0);
541
        tcg_temp_free_i32(t0);
499 542
    }
500 543
}
501 544

  
502
static inline void tcg_gen_brcond_i32(int cond, TCGv arg1, TCGv arg2, 
545
static inline void tcg_gen_brcond_i32(int cond, TCGv_i32 arg1, TCGv_i32 arg2,
503 546
                                      int label_index)
504 547
{
505
    tcg_gen_op4ii(INDEX_op_brcond_i32, arg1, arg2, cond, label_index);
548
    tcg_gen_op4ii_i32(INDEX_op_brcond_i32, arg1, arg2, cond, label_index);
506 549
}
507 550

  
508
static inline void tcg_gen_brcondi_i32(int cond, TCGv arg1, int32_t arg2, 
551
static inline void tcg_gen_brcondi_i32(int cond, TCGv_i32 arg1, int32_t arg2,
509 552
                                       int label_index)
510 553
{
511
    TCGv t0 = tcg_const_i32(arg2);
554
    TCGv_i32 t0 = tcg_const_i32(arg2);
512 555
    tcg_gen_brcond_i32(cond, arg1, t0, label_index);
513
    tcg_temp_free(t0);
556
    tcg_temp_free_i32(t0);
514 557
}
515 558

  
516
static inline void tcg_gen_mul_i32(TCGv ret, TCGv arg1, TCGv arg2)
559
static inline void tcg_gen_mul_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
517 560
{
518
    tcg_gen_op3(INDEX_op_mul_i32, ret, arg1, arg2);
561
    tcg_gen_op3_i32(INDEX_op_mul_i32, ret, arg1, arg2);
519 562
}
520 563

  
521
static inline void tcg_gen_muli_i32(TCGv ret, TCGv arg1, int32_t arg2)
564
static inline void tcg_gen_muli_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2)
522 565
{
523
    TCGv t0 = tcg_const_i32(arg2);
566
    TCGv_i32 t0 = tcg_const_i32(arg2);
524 567
    tcg_gen_mul_i32(ret, arg1, t0);
525
    tcg_temp_free(t0);
568
    tcg_temp_free_i32(t0);
526 569
}
527 570

  
528 571
#ifdef TCG_TARGET_HAS_div_i32
529
static inline void tcg_gen_div_i32(TCGv ret, TCGv arg1, TCGv arg2)
572
static inline void tcg_gen_div_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
530 573
{
531
    tcg_gen_op3(INDEX_op_div_i32, ret, arg1, arg2);
574
    tcg_gen_op3_i32(INDEX_op_div_i32, ret, arg1, arg2);
532 575
}
533 576

  
534
static inline void tcg_gen_rem_i32(TCGv ret, TCGv arg1, TCGv arg2)
577
static inline void tcg_gen_rem_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
535 578
{
536
    tcg_gen_op3(INDEX_op_rem_i32, ret, arg1, arg2);
579
    tcg_gen_op3_i32(INDEX_op_rem_i32, ret, arg1, arg2);
537 580
}
538 581

  
539
static inline void tcg_gen_divu_i32(TCGv ret, TCGv arg1, TCGv arg2)
582
static inline void tcg_gen_divu_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
540 583
{
541
    tcg_gen_op3(INDEX_op_divu_i32, ret, arg1, arg2);
584
    tcg_gen_op3_i32(INDEX_op_divu_i32, ret, arg1, arg2);
542 585
}
543 586

  
544
static inline void tcg_gen_remu_i32(TCGv ret, TCGv arg1, TCGv arg2)
587
static inline void tcg_gen_remu_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
545 588
{
546
    tcg_gen_op3(INDEX_op_remu_i32, ret, arg1, arg2);
589
    tcg_gen_op3_i32(INDEX_op_remu_i32, ret, arg1, arg2);
547 590
}
548 591
#else
549
static inline void tcg_gen_div_i32(TCGv ret, TCGv arg1, TCGv arg2)
592
static inline void tcg_gen_div_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
550 593
{
551
    TCGv t0;
552
    t0 = tcg_temp_new(TCG_TYPE_I32);
594
    TCGv_i32 t0;
595
    t0 = tcg_temp_new_i32();
553 596
    tcg_gen_sari_i32(t0, arg1, 31);
554
    tcg_gen_op5(INDEX_op_div2_i32, ret, t0, arg1, t0, arg2);
555
    tcg_temp_free(t0);
597
    tcg_gen_op5_i32(INDEX_op_div2_i32, ret, t0, arg1, t0, arg2);
598
    tcg_temp_free_i32(t0);
556 599
}
557 600

  
558
static inline void tcg_gen_rem_i32(TCGv ret, TCGv arg1, TCGv arg2)
601
static inline void tcg_gen_rem_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
559 602
{
560
    TCGv t0;
561
    t0 = tcg_temp_new(TCG_TYPE_I32);
603
    TCGv_i32 t0;
604
    t0 = tcg_temp_new_i32();
562 605
    tcg_gen_sari_i32(t0, arg1, 31);
563
    tcg_gen_op5(INDEX_op_div2_i32, t0, ret, arg1, t0, arg2);
564
    tcg_temp_free(t0);
606
    tcg_gen_op5_i32(INDEX_op_div2_i32, t0, ret, arg1, t0, arg2);
607
    tcg_temp_free_i32(t0);
565 608
}
566 609

  
567
static inline void tcg_gen_divu_i32(TCGv ret, TCGv arg1, TCGv arg2)
610
static inline void tcg_gen_divu_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
568 611
{
569
    TCGv t0;
570
    t0 = tcg_temp_new(TCG_TYPE_I32);
612
    TCGv_i32 t0;
613
    t0 = tcg_temp_new_i32();
571 614
    tcg_gen_movi_i32(t0, 0);
572
    tcg_gen_op5(INDEX_op_divu2_i32, ret, t0, arg1, t0, arg2);
573
    tcg_temp_free(t0);
615
    tcg_gen_op5_i32(INDEX_op_divu2_i32, ret, t0, arg1, t0, arg2);
616
    tcg_temp_free_i32(t0);
574 617
}
575 618

  
576
static inline void tcg_gen_remu_i32(TCGv ret, TCGv arg1, TCGv arg2)
619
static inline void tcg_gen_remu_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
577 620
{
578
    TCGv t0;
579
    t0 = tcg_temp_new(TCG_TYPE_I32);
621
    TCGv_i32 t0;
622
    t0 = tcg_temp_new_i32();
580 623
    tcg_gen_movi_i32(t0, 0);
581
    tcg_gen_op5(INDEX_op_divu2_i32, t0, ret, arg1, t0, arg2);
582
    tcg_temp_free(t0);
624
    tcg_gen_op5_i32(INDEX_op_divu2_i32, t0, ret, arg1, t0, arg2);
625
    tcg_temp_free_i32(t0);
583 626
}
584 627
#endif
585 628

  
586 629
#if TCG_TARGET_REG_BITS == 32
587 630

  
588
static inline void tcg_gen_mov_i64(TCGv ret, TCGv arg)
631
static inline void tcg_gen_mov_i64(TCGv_i64 ret, TCGv_i64 arg)
589 632
{
590
    if (GET_TCGV(ret) != GET_TCGV(arg)) {
591
        tcg_gen_mov_i32(ret, arg);
633
    if (GET_TCGV_I64(ret) != GET_TCGV_I64(arg)) {
634
        tcg_gen_mov_i32(TCGV_LOW(ret), TCGV_LOW(arg));
592 635
        tcg_gen_mov_i32(TCGV_HIGH(ret), TCGV_HIGH(arg));
593 636
    }
594 637
}
595 638

  
596
static inline void tcg_gen_movi_i64(TCGv ret, int64_t arg)
639
static inline void tcg_gen_movi_i64(TCGv_i64 ret, int64_t arg)
597 640
{
598
    tcg_gen_movi_i32(ret, arg);
641
    tcg_gen_movi_i32(TCGV_LOW(ret), arg);
599 642
    tcg_gen_movi_i32(TCGV_HIGH(ret), arg >> 32);
600 643
}
601 644

  
602
static inline void tcg_gen_ld8u_i64(TCGv ret, TCGv arg2, tcg_target_long offset)
645
static inline void tcg_gen_ld8u_i64(TCGv_i64 ret, TCGv_ptr arg2,
646
                                    tcg_target_long offset)
603 647
{
604
    tcg_gen_ld8u_i32(ret, arg2, offset);
648
    tcg_gen_ld8u_i32(TCGV_LOW(ret), arg2, offset);
605 649
    tcg_gen_movi_i32(TCGV_HIGH(ret), 0);
606 650
}
607 651

  
608
static inline void tcg_gen_ld8s_i64(TCGv ret, TCGv arg2, tcg_target_long offset)
652
static inline void tcg_gen_ld8s_i64(TCGv_i64 ret, TCGv_ptr arg2,
653
                                    tcg_target_long offset)
609 654
{
610
    tcg_gen_ld8s_i32(ret, arg2, offset);
611
    tcg_gen_sari_i32(TCGV_HIGH(ret), ret, 31);
655
    tcg_gen_ld8s_i32(TCGV_LOW(ret), arg2, offset);
656
    tcg_gen_sari_i32(TCGV_HIGH(ret), TCGV_HIGH(ret), 31);
612 657
}
613 658

  
614
static inline void tcg_gen_ld16u_i64(TCGv ret, TCGv arg2, tcg_target_long offset)
659
static inline void tcg_gen_ld16u_i64(TCGv_i64 ret, TCGv_ptr arg2,
660
                                     tcg_target_long offset)
615 661
{
616
    tcg_gen_ld16u_i32(ret, arg2, offset);
662
    tcg_gen_ld16u_i32(TCGV_LOW(ret), TCGV_LOW(arg2), offset);
617 663
    tcg_gen_movi_i32(TCGV_HIGH(ret), 0);
618 664
}
619 665

  
620
static inline void tcg_gen_ld16s_i64(TCGv ret, TCGv arg2, tcg_target_long offset)
666
static inline void tcg_gen_ld16s_i64(TCGv_i64 ret, TCGv_ptr arg2,
667
                                     tcg_target_long offset)
621 668
{
622
    tcg_gen_ld16s_i32(ret, arg2, offset);
623
    tcg_gen_sari_i32(TCGV_HIGH(ret), ret, 31);
669
    tcg_gen_ld16s_i32(TCGV_LOW(ret), arg2, offset);
670
    tcg_gen_sari_i32(TCGV_HIGH(ret), TCGV_LOW(ret), 31);
624 671
}
625 672

  
626
static inline void tcg_gen_ld32u_i64(TCGv ret, TCGv arg2, tcg_target_long offset)
673
static inline void tcg_gen_ld32u_i64(TCGv_i64 ret, TCGv_ptr arg2,
674
                                     tcg_target_long offset)
627 675
{
628
    tcg_gen_ld_i32(ret, arg2, offset);
676
    tcg_gen_ld_i32(TCGV_LOW(ret), arg2, offset);
629 677
    tcg_gen_movi_i32(TCGV_HIGH(ret), 0);
630 678
}
631 679

  
632
static inline void tcg_gen_ld32s_i64(TCGv ret, TCGv arg2, tcg_target_long offset)
680
static inline void tcg_gen_ld32s_i64(TCGv_i64 ret, TCGv_ptr arg2,
681
                                     tcg_target_long offset)
633 682
{
634
    tcg_gen_ld_i32(ret, arg2, offset);
635
    tcg_gen_sari_i32(TCGV_HIGH(ret), ret, 31);
683
    tcg_gen_ld_i32(TCGV_LOW(ret), arg2, offset);
684
    tcg_gen_sari_i32(TCGV_HIGH(ret), TCGV_LOW(ret), 31);
636 685
}
637 686

  
638
static inline void tcg_gen_ld_i64(TCGv ret, TCGv arg2, tcg_target_long offset)
687
static inline void tcg_gen_ld_i64(TCGv_i64 ret, TCGv_ptr arg2,
688
                                  tcg_target_long offset)
639 689
{
640 690
    /* since arg2 and ret have different types, they cannot be the
641 691
       same temporary */
642 692
#ifdef TCG_TARGET_WORDS_BIGENDIAN
643 693
    tcg_gen_ld_i32(TCGV_HIGH(ret), arg2, offset);
644
    tcg_gen_ld_i32(ret, arg2, offset + 4);
694
    tcg_gen_ld_i32(TCGV_LOW(ret), arg2, offset + 4);
645 695
#else
646
    tcg_gen_ld_i32(ret, arg2, offset);
696
    tcg_gen_ld_i32(TCGV_LOW(ret), arg2, offset);
647 697
    tcg_gen_ld_i32(TCGV_HIGH(ret), arg2, offset + 4);
648 698
#endif
649 699
}
650 700

  
651
static inline void tcg_gen_st8_i64(TCGv arg1, TCGv arg2, tcg_target_long offset)
701
static inline void tcg_gen_st8_i64(TCGv_i64 arg1, TCGv_ptr arg2,
702
                                   tcg_target_long offset)
652 703
{
653
    tcg_gen_st8_i32(arg1, arg2, offset);
704
    tcg_gen_st8_i32(TCGV_LOW(arg1), arg2, offset);
654 705
}
655 706

  
656
static inline void tcg_gen_st16_i64(TCGv arg1, TCGv arg2, tcg_target_long offset)
707
static inline void tcg_gen_st16_i64(TCGv_i64 arg1, TCGv_ptr arg2,
708
                                    tcg_target_long offset)
657 709
{
658
    tcg_gen_st16_i32(arg1, arg2, offset);
710
    tcg_gen_st16_i32(TCGV_LOW(arg1), arg2, offset);
659 711
}
660 712

  
661
static inline void tcg_gen_st32_i64(TCGv arg1, TCGv arg2, tcg_target_long offset)
713
static inline void tcg_gen_st32_i64(TCGv_i64 arg1, TCGv_ptr arg2,
714
                                    tcg_target_long offset)
662 715
{
663
    tcg_gen_st_i32(arg1, arg2, offset);
716
    tcg_gen_st_i32(TCGV_LOW(arg1), arg2, offset);
664 717
}
665 718

  
666
static inline void tcg_gen_st_i64(TCGv arg1, TCGv arg2, tcg_target_long offset)
719
static inline void tcg_gen_st_i64(TCGv_i64 arg1, TCGv_ptr arg2,
720
                                  tcg_target_long offset)
667 721
{
668 722
#ifdef TCG_TARGET_WORDS_BIGENDIAN
669 723
    tcg_gen_st_i32(TCGV_HIGH(arg1), arg2, offset);
670
    tcg_gen_st_i32(arg1, arg2, offset + 4);
724
    tcg_gen_st_i32(TCGV_LOW(arg1), arg2, offset + 4);
671 725
#else
672
    tcg_gen_st_i32(arg1, arg2, offset);
726
    tcg_gen_st_i32(TCGV_LOW(arg1), arg2, offset);
673 727
    tcg_gen_st_i32(TCGV_HIGH(arg1), arg2, offset + 4);
674 728
#endif
675 729
}
676 730

  
677
static inline void tcg_gen_add_i64(TCGv ret, TCGv arg1, TCGv arg2)
731
static inline void tcg_gen_add_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
678 732
{
679
    tcg_gen_op6(INDEX_op_add2_i32, ret, TCGV_HIGH(ret), 
680
                arg1, TCGV_HIGH(arg1), arg2, TCGV_HIGH(arg2));
733
    tcg_gen_op6_i32(INDEX_op_add2_i32, TCGV_LOW(ret), TCGV_HIGH(ret),
734
                    TCGV_LOW(arg1), TCGV_HIGH(arg1), TCGV_LOW(arg2),
735
                    TCGV_HIGH(arg2));
681 736
}
682 737

  
683
static inline void tcg_gen_sub_i64(TCGv ret, TCGv arg1, TCGv arg2)
738
static inline void tcg_gen_sub_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
684 739
{
685
    tcg_gen_op6(INDEX_op_sub2_i32, ret, TCGV_HIGH(ret), 
686
                arg1, TCGV_HIGH(arg1), arg2, TCGV_HIGH(arg2));
740
    tcg_gen_op6_i32(INDEX_op_sub2_i32, TCGV_LOW(ret), TCGV_HIGH(ret),
741
                    TCGV_LOW(arg1), TCGV_HIGH(arg1), TCGV_LOW(arg2),
742
                    TCGV_HIGH(arg2));
687 743
}
688 744

  
689
static inline void tcg_gen_and_i64(TCGv ret, TCGv arg1, TCGv arg2)
745
static inline void tcg_gen_and_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
690 746
{
691
    tcg_gen_and_i32(ret, arg1, arg2);
747
    tcg_gen_and_i32(TCGV_LOW(ret), TCGV_LOW(arg1), TCGV_LOW(arg2));
692 748
    tcg_gen_and_i32(TCGV_HIGH(ret), TCGV_HIGH(arg1), TCGV_HIGH(arg2));
693 749
}
694 750

  
695
static inline void tcg_gen_andi_i64(TCGv ret, TCGv arg1, int64_t arg2)
751
static inline void tcg_gen_andi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2)
696 752
{
697
    tcg_gen_andi_i32(ret, arg1, arg2);
753
    tcg_gen_andi_i32(TCGV_LOW(ret), TCGV_LOW(arg1), arg2);
698 754
    tcg_gen_andi_i32(TCGV_HIGH(ret), TCGV_HIGH(arg1), arg2 >> 32);
699 755
}
700 756

  
701
static inline void tcg_gen_or_i64(TCGv ret, TCGv arg1, TCGv arg2)
757
static inline void tcg_gen_or_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
702 758
{
703
    tcg_gen_or_i32(ret, arg1, arg2);
759
    tcg_gen_or_i32(TCGV_LOW(ret), TCGV_LOW(arg1), TCGV_LOW(arg2));
704 760
    tcg_gen_or_i32(TCGV_HIGH(ret), TCGV_HIGH(arg1), TCGV_HIGH(arg2));
705 761
}
706 762

  
707
static inline void tcg_gen_ori_i64(TCGv ret, TCGv arg1, int64_t arg2)
763
static inline void tcg_gen_ori_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2)
708 764
{
709
    tcg_gen_ori_i32(ret, arg1, arg2);
765
    tcg_gen_ori_i32(TCGV_LOW(ret), TCGV_LOW(arg1), arg2);
710 766
    tcg_gen_ori_i32(TCGV_HIGH(ret), TCGV_HIGH(arg1), arg2 >> 32);
711 767
}
712 768

  
713
static inline void tcg_gen_xor_i64(TCGv ret, TCGv arg1, TCGv arg2)
769
static inline void tcg_gen_xor_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
714 770
{
715
    tcg_gen_xor_i32(ret, arg1, arg2);
771
    tcg_gen_xor_i32(TCGV_LOW(ret), TCGV_LOW(arg1), TCGV_LOW(arg2));
716 772
    tcg_gen_xor_i32(TCGV_HIGH(ret), TCGV_HIGH(arg1), TCGV_HIGH(arg2));
717 773
}
718 774

  
719
static inline void tcg_gen_xori_i64(TCGv ret, TCGv arg1, int64_t arg2)
775
static inline void tcg_gen_xori_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2)
720 776
{
721
    tcg_gen_xori_i32(ret, arg1, arg2);
777
    tcg_gen_xori_i32(TCGV_LOW(ret), TCGV_LOW(arg1), arg2);
722 778
    tcg_gen_xori_i32(TCGV_HIGH(ret), TCGV_HIGH(arg1), arg2 >> 32);
723 779
}
724 780

  
725 781
/* XXX: use generic code when basic block handling is OK or CPU
726 782
   specific code (x86) */
727
static inline void tcg_gen_shl_i64(TCGv ret, TCGv arg1, TCGv arg2)
783
static inline void tcg_gen_shl_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
728 784
{
729
    tcg_gen_helper_1_2(tcg_helper_shl_i64, ret, arg1, arg2);
785
    tcg_gen_helper64(tcg_helper_shl_i64, ret, arg1, arg2);
730 786
}
731 787

  
732
static inline void tcg_gen_shli_i64(TCGv ret, TCGv arg1, int64_t arg2)
788
static inline void tcg_gen_shli_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2)
733 789
{
734 790
    tcg_gen_shifti_i64(ret, arg1, arg2, 0, 0);
735 791
}
736 792

  
737
static inline void tcg_gen_shr_i64(TCGv ret, TCGv arg1, TCGv arg2)
793
static inline void tcg_gen_shr_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
738 794
{
739
    tcg_gen_helper_1_2(tcg_helper_shr_i64, ret, arg1, arg2);
795
    tcg_gen_helper64(tcg_helper_shr_i64, ret, arg1, arg2);
740 796
}
741 797

  
742
static inline void tcg_gen_shri_i64(TCGv ret, TCGv arg1, int64_t arg2)
798
static inline void tcg_gen_shri_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2)
743 799
{
744 800
    tcg_gen_shifti_i64(ret, arg1, arg2, 1, 0);
745 801
}
746 802

  
747
static inline void tcg_gen_sar_i64(TCGv ret, TCGv arg1, TCGv arg2)
803
static inline void tcg_gen_sar_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
748 804
{
749
    tcg_gen_helper_1_2(tcg_helper_sar_i64, ret, arg1, arg2);
805
    tcg_gen_helper64(tcg_helper_sar_i64, ret, arg1, arg2);
750 806
}
751 807

  
752
static inline void tcg_gen_sari_i64(TCGv ret, TCGv arg1, int64_t arg2)
808
static inline void tcg_gen_sari_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2)
753 809
{
754 810
    tcg_gen_shifti_i64(ret, arg1, arg2, 1, 1);
755 811
}
756 812

  
757
static inline void tcg_gen_brcond_i64(int cond, TCGv arg1, TCGv arg2, 
813
static inline void tcg_gen_brcond_i64(int cond, TCGv_i64 arg1, TCGv_i64 arg2,
758 814
                                      int label_index)
759 815
{
760
    tcg_gen_op6ii(INDEX_op_brcond2_i32, 
761
                  arg1, TCGV_HIGH(arg1), arg2, TCGV_HIGH(arg2),
762
                  cond, label_index);
816
    tcg_gen_op6ii_i32(INDEX_op_brcond2_i32,
817
                      TCGV_LOW(arg1), TCGV_HIGH(arg1), TCGV_LOW(arg2),
818
                      TCGV_HIGH(arg2), cond, label_index);
763 819
}
764 820

  
765
static inline void tcg_gen_mul_i64(TCGv ret, TCGv arg1, TCGv arg2)
821
static inline void tcg_gen_mul_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
766 822
{
767
    TCGv t0, t1;
768
    
769
    t0 = tcg_temp_new(TCG_TYPE_I64);
770
    t1 = tcg_temp_new(TCG_TYPE_I32);
823
    TCGv_i64 t0;
824
    TCGv_i32 t1;
771 825

  
772
    tcg_gen_op4(INDEX_op_mulu2_i32, t0, TCGV_HIGH(t0), arg1, arg2);
773
    
774
    tcg_gen_mul_i32(t1, arg1, TCGV_HIGH(arg2));
826
    t0 = tcg_temp_new_i64();
827
    t1 = tcg_temp_new_i32();
828

  
829
    tcg_gen_op4_i32(INDEX_op_mulu2_i32, TCGV_LOW(t0), TCGV_HIGH(t0),
830
                    TCGV_LOW(arg1), TCGV_LOW(arg2));
831

  
832
    tcg_gen_mul_i32(t1, TCGV_LOW(arg1), TCGV_HIGH(arg2));
775 833
    tcg_gen_add_i32(TCGV_HIGH(t0), TCGV_HIGH(t0), t1);
776
    tcg_gen_mul_i32(t1, TCGV_HIGH(arg1), arg2);
834
    tcg_gen_mul_i32(t1, TCGV_HIGH(arg1), TCGV_LOW(arg2));
777 835
    tcg_gen_add_i32(TCGV_HIGH(t0), TCGV_HIGH(t0), t1);
778
    
836

  
779 837
    tcg_gen_mov_i64(ret, t0);
780
    tcg_temp_free(t0);
781
    tcg_temp_free(t1);
838
    tcg_temp_free_i64(t0);
839
    tcg_temp_free_i32(t1);
782 840
}
783 841

  
784
static inline void tcg_gen_div_i64(TCGv ret, TCGv arg1, TCGv arg2)
842
static inline void tcg_gen_div_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
785 843
{
786
    tcg_gen_helper_1_2(tcg_helper_div_i64, ret, arg1, arg2);
844
    tcg_gen_helper64(tcg_helper_div_i64, ret, arg1, arg2);
787 845
}
788 846

  
789
static inline void tcg_gen_rem_i64(TCGv ret, TCGv arg1, TCGv arg2)
847
static inline void tcg_gen_rem_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
790 848
{
791
    tcg_gen_helper_1_2(tcg_helper_rem_i64, ret, arg1, arg2);
849
    tcg_gen_helper64(tcg_helper_rem_i64, ret, arg1, arg2);
792 850
}
793 851

  
794
static inline void tcg_gen_divu_i64(TCGv ret, TCGv arg1, TCGv arg2)
852
static inline void tcg_gen_divu_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
795 853
{
796
    tcg_gen_helper_1_2(tcg_helper_divu_i64, ret, arg1, arg2);
854
    tcg_gen_helper64(tcg_helper_divu_i64, ret, arg1, arg2);
797 855
}
798 856

  
799
static inline void tcg_gen_remu_i64(TCGv ret, TCGv arg1, TCGv arg2)
857
static inline void tcg_gen_remu_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
800 858
{
801
    tcg_gen_helper_1_2(tcg_helper_remu_i64, ret, arg1, arg2);
859
    tcg_gen_helper64(tcg_helper_remu_i64, ret, arg1, arg2);
802 860
}
803 861

  
804 862
#else
805 863

  
806
static inline void tcg_gen_mov_i64(TCGv ret, TCGv arg)
864
static inline void tcg_gen_mov_i64(TCGv_i64 ret, TCGv_i64 arg)
807 865
{
808
    if (GET_TCGV(ret) != GET_TCGV(arg))
809
        tcg_gen_op2(INDEX_op_mov_i64, ret, arg);
866
    if (GET_TCGV_I64(ret) != GET_TCGV_I64(arg))
867
        tcg_gen_op2_i64(INDEX_op_mov_i64, ret, arg);
810 868
}
811 869

  
812
static inline void tcg_gen_movi_i64(TCGv ret, int64_t arg)
870
static inline void tcg_gen_movi_i64(TCGv_i64 ret, int64_t arg)
813 871
{
814
    tcg_gen_op2i(INDEX_op_movi_i64, ret, arg);
872
    tcg_gen_op2i_i64(INDEX_op_movi_i64, ret, arg);
815 873
}
816 874

  
817
static inline void tcg_gen_ld8u_i64(TCGv ret, TCGv arg2,
875
static inline void tcg_gen_ld8u_i64(TCGv_i64 ret, TCGv_i64 arg2,
818 876
                                    tcg_target_long offset)
819 877
{
820
    tcg_gen_op3i(INDEX_op_ld8u_i64, ret, arg2, offset);
878
    tcg_gen_ldst_op_i64(INDEX_op_ld8u_i64, ret, arg2, offset);
821 879
}
822 880

  
823
static inline void tcg_gen_ld8s_i64(TCGv ret, TCGv arg2,
881
static inline void tcg_gen_ld8s_i64(TCGv_i64 ret, TCGv_i64 arg2,
824 882
                                    tcg_target_long offset)
825 883
{
826
    tcg_gen_op3i(INDEX_op_ld8s_i64, ret, arg2, offset);
884
    tcg_gen_ldst_op_i64(INDEX_op_ld8s_i64, ret, arg2, offset);
827 885
}
828 886

  
829
static inline void tcg_gen_ld16u_i64(TCGv ret, TCGv arg2,
887
static inline void tcg_gen_ld16u_i64(TCGv_i64 ret, TCGv_i64 arg2,
830 888
                                     tcg_target_long offset)
831 889
{
832
    tcg_gen_op3i(INDEX_op_ld16u_i64, ret, arg2, offset);
890
    tcg_gen_ldst_op_i64(INDEX_op_ld16u_i64, ret, arg2, offset);
833 891
}
834 892

  
835
static inline void tcg_gen_ld16s_i64(TCGv ret, TCGv arg2,
893
static inline void tcg_gen_ld16s_i64(TCGv_i64 ret, TCGv_i64 arg2,
836 894
                                     tcg_target_long offset)
837 895
{
838
    tcg_gen_op3i(INDEX_op_ld16s_i64, ret, arg2, offset);
896
    tcg_gen_ldst_op_i64(INDEX_op_ld16s_i64, ret, arg2, offset);
839 897
}
840 898

  
841
static inline void tcg_gen_ld32u_i64(TCGv ret, TCGv arg2,
899
static inline void tcg_gen_ld32u_i64(TCGv_i64 ret, TCGv_i64 arg2,
842 900
                                     tcg_target_long offset)
843 901
{
844
    tcg_gen_op3i(INDEX_op_ld32u_i64, ret, arg2, offset);
902
    tcg_gen_ldst_op_i64(INDEX_op_ld32u_i64, ret, arg2, offset);
845 903
}
846 904

  
847
static inline void tcg_gen_ld32s_i64(TCGv ret, TCGv arg2,
905
static inline void tcg_gen_ld32s_i64(TCGv_i64 ret, TCGv_i64 arg2,
848 906
                                     tcg_target_long offset)
849 907
{
850
    tcg_gen_op3i(INDEX_op_ld32s_i64, ret, arg2, offset);
908
    tcg_gen_ldst_op_i64(INDEX_op_ld32s_i64, ret, arg2, offset);
851 909
}
852 910

  
853
static inline void tcg_gen_ld_i64(TCGv ret, TCGv arg2, tcg_target_long offset)
911
static inline void tcg_gen_ld_i64(TCGv_i64 ret, TCGv_i64 arg2, tcg_target_long offset)
854 912
{
855
    tcg_gen_op3i(INDEX_op_ld_i64, ret, arg2, offset);
913
    tcg_gen_ldst_op_i64(INDEX_op_ld_i64, ret, arg2, offset);
856 914
}
857 915

  
858
static inline void tcg_gen_st8_i64(TCGv arg1, TCGv arg2,
916
static inline void tcg_gen_st8_i64(TCGv_i64 arg1, TCGv_i64 arg2,
859 917
                                   tcg_target_long offset)
860 918
{
861
    tcg_gen_op3i(INDEX_op_st8_i64, arg1, arg2, offset);
919
    tcg_gen_ldst_op_i64(INDEX_op_st8_i64, arg1, arg2, offset);
862 920
}
863 921

  
864
static inline void tcg_gen_st16_i64(TCGv arg1, TCGv arg2,
922
static inline void tcg_gen_st16_i64(TCGv_i64 arg1, TCGv_i64 arg2,
865 923
                                    tcg_target_long offset)
866 924
{
867
    tcg_gen_op3i(INDEX_op_st16_i64, arg1, arg2, offset);
925
    tcg_gen_ldst_op_i64(INDEX_op_st16_i64, arg1, arg2, offset);
868 926
}
869 927

  
870
static inline void tcg_gen_st32_i64(TCGv arg1, TCGv arg2,
928
static inline void tcg_gen_st32_i64(TCGv_i64 arg1, TCGv_i64 arg2,
871 929
                                    tcg_target_long offset)
872 930
{
873
    tcg_gen_op3i(INDEX_op_st32_i64, arg1, arg2, offset);
931
    tcg_gen_ldst_op_i64(INDEX_op_st32_i64, arg1, arg2, offset);
874 932
}
875 933

  
876
static inline void tcg_gen_st_i64(TCGv arg1, TCGv arg2, tcg_target_long offset)
934
static inline void tcg_gen_st_i64(TCGv_i64 arg1, TCGv_i64 arg2, tcg_target_long offset)
877 935
{
878
    tcg_gen_op3i(INDEX_op_st_i64, arg1, arg2, offset);
936
    tcg_gen_ldst_op_i64(INDEX_op_st_i64, arg1, arg2, offset);
879 937
}
880 938

  
881
static inline void tcg_gen_add_i64(TCGv ret, TCGv arg1, TCGv arg2)
939
static inline void tcg_gen_add_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
882 940
{
883
    tcg_gen_op3(INDEX_op_add_i64, ret, arg1, arg2);
941
    tcg_gen_op3_i64(INDEX_op_add_i64, ret, arg1, arg2);
884 942
}
885 943

  
886
static inline void tcg_gen_sub_i64(TCGv ret, TCGv arg1, TCGv arg2)
944
static inline void tcg_gen_sub_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
887 945
{
888
    tcg_gen_op3(INDEX_op_sub_i64, ret, arg1, arg2);
946
    tcg_gen_op3_i64(INDEX_op_sub_i64, ret, arg1, arg2);
889 947
}
890 948

  
891
static inline void tcg_gen_and_i64(TCGv ret, TCGv arg1, TCGv arg2)
949
static inline void tcg_gen_and_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
892 950
{
893
    tcg_gen_op3(INDEX_op_and_i64, ret, arg1, arg2);
951
    tcg_gen_op3_i64(INDEX_op_and_i64, ret, arg1, arg2);
894 952
}
895 953

  
896
static inline void tcg_gen_andi_i64(TCGv ret, TCGv arg1, int64_t arg2)
954
static inline void tcg_gen_andi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2)
897 955
{
898
    TCGv t0 = tcg_const_i64(arg2);
956
    TCGv_i64 t0 = tcg_const_i64(arg2);
899 957
    tcg_gen_and_i64(ret, arg1, t0);
900
    tcg_temp_free(t0);
958
    tcg_temp_free_i64(t0);
901 959
}
902 960

  
903
static inline void tcg_gen_or_i64(TCGv ret, TCGv arg1, TCGv arg2)
961
static inline void tcg_gen_or_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
904 962
{
905
    tcg_gen_op3(INDEX_op_or_i64, ret, arg1, arg2);
963
    tcg_gen_op3_i64(INDEX_op_or_i64, ret, arg1, arg2);
906 964
}
907 965

  
908
static inline void tcg_gen_ori_i64(TCGv ret, TCGv arg1, int64_t arg2)
966
static inline void tcg_gen_ori_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2)
909 967
{
910
    TCGv t0 = tcg_const_i64(arg2);
968
    TCGv_i64 t0 = tcg_const_i64(arg2);
911 969
    tcg_gen_or_i64(ret, arg1, t0);
912
    tcg_temp_free(t0);
970
    tcg_temp_free_i64(t0);
913 971
}
914 972

  
915
static inline void tcg_gen_xor_i64(TCGv ret, TCGv arg1, TCGv arg2)
973
static inline void tcg_gen_xor_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
916 974
{
917
    tcg_gen_op3(INDEX_op_xor_i64, ret, arg1, arg2);
975
    tcg_gen_op3_i64(INDEX_op_xor_i64, ret, arg1, arg2);
918 976
}
919 977

  
920
static inline void tcg_gen_xori_i64(TCGv ret, TCGv arg1, int64_t arg2)
978
static inline void tcg_gen_xori_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2)
921 979
{
922
    TCGv t0 = tcg_const_i64(arg2);
980
    TCGv_i64 t0 = tcg_const_i64(arg2);
923 981
    tcg_gen_xor_i64(ret, arg1, t0);
924
    tcg_temp_free(t0);
982
    tcg_temp_free_i64(t0);
925 983
}
926 984

  
927
static inline void tcg_gen_shl_i64(TCGv ret, TCGv arg1, TCGv arg2)
985
static inline void tcg_gen_shl_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
928 986
{
929
    tcg_gen_op3(INDEX_op_shl_i64, ret, arg1, arg2);
987
    tcg_gen_op3_i64(INDEX_op_shl_i64, ret, arg1, arg2);
930 988
}
931 989

  
932
static inline void tcg_gen_shli_i64(TCGv ret, TCGv arg1, int64_t arg2)
990
static inline void tcg_gen_shli_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2)
933 991
{
934 992
    if (arg2 == 0) {
935 993
        tcg_gen_mov_i64(ret, arg1);
936 994
    } else {
937
        TCGv t0 = tcg_const_i64(arg2);
995
        TCGv_i64 t0 = tcg_const_i64(arg2);
938 996
        tcg_gen_shl_i64(ret, arg1, t0);
939
        tcg_temp_free(t0);
997
        tcg_temp_free_i64(t0);
940 998
    }
941 999
}
942 1000

  
943
static inline void tcg_gen_shr_i64(TCGv ret, TCGv arg1, TCGv arg2)
1001
static inline void tcg_gen_shr_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
944 1002
{
945
    tcg_gen_op3(INDEX_op_shr_i64, ret, arg1, arg2);
1003
    tcg_gen_op3_i64(INDEX_op_shr_i64, ret, arg1, arg2);
946 1004
}
947 1005

  
948
static inline void tcg_gen_shri_i64(TCGv ret, TCGv arg1, int64_t arg2)
1006
static inline void tcg_gen_shri_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2)
949 1007
{
950 1008
    if (arg2 == 0) {
951 1009
        tcg_gen_mov_i64(ret, arg1);
952 1010
    } else {
953
        TCGv t0 = tcg_const_i64(arg2);
1011
        TCGv_i64 t0 = tcg_const_i64(arg2);
954 1012
        tcg_gen_shr_i64(ret, arg1, t0);
955
        tcg_temp_free(t0);
1013
        tcg_temp_free_i64(t0);
956 1014
    }
957 1015
}
958 1016

  
959
static inline void tcg_gen_sar_i64(TCGv ret, TCGv arg1, TCGv arg2)
1017
static inline void tcg_gen_sar_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
960 1018
{
961
    tcg_gen_op3(INDEX_op_sar_i64, ret, arg1, arg2);
1019
    tcg_gen_op3_i64(INDEX_op_sar_i64, ret, arg1, arg2);
962 1020
}
963 1021

  
964
static inline void tcg_gen_sari_i64(TCGv ret, TCGv arg1, int64_t arg2)
1022
static inline void tcg_gen_sari_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2)
965 1023
{
966 1024
    if (arg2 == 0) {
967 1025
        tcg_gen_mov_i64(ret, arg1);
968 1026
    } else {
969
        TCGv t0 = tcg_const_i64(arg2);
1027
        TCGv_i64 t0 = tcg_const_i64(arg2);
970 1028
        tcg_gen_sar_i64(ret, arg1, t0);
971
        tcg_temp_free(t0);
1029
        tcg_temp_free_i64(t0);
972 1030
    }
973 1031
}
974 1032

  
975
static inline void tcg_gen_brcond_i64(int cond, TCGv arg1, TCGv arg2, 
1033
static inline void tcg_gen_brcond_i64(int cond, TCGv_i64 arg1, TCGv_i64 arg2,
976 1034
                                      int label_index)
977 1035
{
978
    tcg_gen_op4ii(INDEX_op_brcond_i64, arg1, arg2, cond, label_index);
1036
    tcg_gen_op4ii_i64(INDEX_op_brcond_i64, arg1, arg2, cond, label_index);
979 1037
}
980 1038

  
981
static inline void tcg_gen_mul_i64(TCGv ret, TCGv arg1, TCGv arg2)
1039
static inline void tcg_gen_mul_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
982 1040
{
983
    tcg_gen_op3(INDEX_op_mul_i64, ret, arg1, arg2);
1041
    tcg_gen_op3_i64(INDEX_op_mul_i64, ret, arg1, arg2);
984 1042
}
985 1043

  
986 1044
#ifdef TCG_TARGET_HAS_div_i64
987
static inline void tcg_gen_div_i64(TCGv ret, TCGv arg1, TCGv arg2)
1045
static inline void tcg_gen_div_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
988 1046
{
989
    tcg_gen_op3(INDEX_op_div_i64, ret, arg1, arg2);
1047
    tcg_gen_op3_i64(INDEX_op_div_i64, ret, arg1, arg2);
990 1048
}
991 1049

  
992
static inline void tcg_gen_rem_i64(TCGv ret, TCGv arg1, TCGv arg2)
1050
static inline void tcg_gen_rem_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
993 1051
{
994
    tcg_gen_op3(INDEX_op_rem_i64, ret, arg1, arg2);
1052
    tcg_gen_op3_i64(INDEX_op_rem_i64, ret, arg1, arg2);
995 1053
}
996 1054

  
997
static inline void tcg_gen_divu_i64(TCGv ret, TCGv arg1, TCGv arg2)
1055
static inline void tcg_gen_divu_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
998 1056
{
999
    tcg_gen_op3(INDEX_op_divu_i64, ret, arg1, arg2);
1057
    tcg_gen_op3_i64(INDEX_op_divu_i64, ret, arg1, arg2);
1000 1058
}
1001 1059

  
1002
static inline void tcg_gen_remu_i64(TCGv ret, TCGv arg1, TCGv arg2)
1060
static inline void tcg_gen_remu_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
1003 1061
{
1004
    tcg_gen_op3(INDEX_op_remu_i64, ret, arg1, arg2);
1062
    tcg_gen_op3_i64(INDEX_op_remu_i64, ret, arg1, arg2);
1005 1063
}
1006 1064
#else
1007
static inline void tcg_gen_div_i64(TCGv ret, TCGv arg1, TCGv arg2)
1065
static inline void tcg_gen_div_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
1008 1066
{
1009
    TCGv t0;
1010
    t0 = tcg_temp_new(TCG_TYPE_I64);
1067
    TCGv_i64 t0;
1068
    t0 = tcg_temp_new_i64();
1011 1069
    tcg_gen_sari_i64(t0, arg1, 63);
1012
    tcg_gen_op5(INDEX_op_div2_i64, ret, t0, arg1, t0, arg2);
1013
    tcg_temp_free(t0);
1070
    tcg_gen_op5_i64(INDEX_op_div2_i64, ret, t0, arg1, t0, arg2);
1071
    tcg_temp_free_i64(t0);
1014 1072
}
1015 1073

  
1016
static inline void tcg_gen_rem_i64(TCGv ret, TCGv arg1, TCGv arg2)
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff