Revision 31d66551 tcg/tcg-op.h

b/tcg/tcg-op.h
365 365
}
366 366

  
367 367
/* FIXME: Should this be pure?  */
368
static inline void tcg_gen_helper32(void *func, TCGv_i32 ret,
369
                                    TCGv_i32 a, TCGv_i32 b)
370
{
371
    TCGv_ptr fn;
372
    TCGArg args[2];
373
    fn = tcg_const_ptr((tcg_target_long)func);
374
    args[0] = GET_TCGV_I32(a);
375
    args[1] = GET_TCGV_I32(b);
376
    tcg_gen_callN(&tcg_ctx, fn, 0, 0, GET_TCGV_I32(ret), 2, args);
377
    tcg_temp_free_ptr(fn);
378
}
379

  
380
/* FIXME: Should this be pure?  */
368 381
static inline void tcg_gen_helper64(void *func, TCGv_i64 ret,
369 382
                                    TCGv_i64 a, TCGv_i64 b)
370 383
{
......
635 648
{
636 649
    tcg_gen_op3_i32(INDEX_op_remu_i32, ret, arg1, arg2);
637 650
}
638
#else
651
#elif defined(TCG_TARGET_HAS_div2_i32)
639 652
static inline void tcg_gen_div_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
640 653
{
641 654
    TCGv_i32 t0;
......
671 684
    tcg_gen_op5_i32(INDEX_op_divu2_i32, t0, ret, arg1, t0, arg2);
672 685
    tcg_temp_free_i32(t0);
673 686
}
687
#else
688
static inline void tcg_gen_div_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
689
{
690
    tcg_gen_helper32(tcg_helper_div_i32, ret, arg1, arg2);
691
}
692

  
693
static inline void tcg_gen_rem_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
694
{
695
    tcg_gen_helper32(tcg_helper_rem_i32, ret, arg1, arg2);
696
}
697

  
698
static inline void tcg_gen_divu_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
699
{
700
    tcg_gen_helper32(tcg_helper_divu_i32, ret, arg1, arg2);
701
}
702

  
703
static inline void tcg_gen_remu_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
704
{
705
    tcg_gen_helper32(tcg_helper_remu_i32, ret, arg1, arg2);
706
}
674 707
#endif
675 708

  
676 709
#if TCG_TARGET_REG_BITS == 32
......
1135 1168
{
1136 1169
    tcg_gen_op3_i64(INDEX_op_remu_i64, ret, arg1, arg2);
1137 1170
}
1138
#else
1171
#elif defined(TCG_TARGET_HAS_div2_i64)
1139 1172
static inline void tcg_gen_div_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
1140 1173
{
1141 1174
    TCGv_i64 t0;
......
1171 1204
    tcg_gen_op5_i64(INDEX_op_divu2_i64, t0, ret, arg1, t0, arg2);
1172 1205
    tcg_temp_free_i64(t0);
1173 1206
}
1207
#else
1208
static inline void tcg_gen_div_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
1209
{
1210
    tcg_gen_helper64(tcg_helper_div_i64, ret, arg1, arg2);
1211
}
1212

  
1213
static inline void tcg_gen_rem_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
1214
{
1215
    tcg_gen_helper64(tcg_helper_rem_i64, ret, arg1, arg2);
1216
}
1217

  
1218
static inline void tcg_gen_divu_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
1219
{
1220
    tcg_gen_helper64(tcg_helper_divu_i64, ret, arg1, arg2);
1221
}
1222

  
1223
static inline void tcg_gen_remu_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
1224
{
1225
    tcg_gen_helper64(tcg_helper_remu_i64, ret, arg1, arg2);
1226
}
1174 1227
#endif
1175 1228

  
1176 1229
#endif

Also available in: Unified diff