Revision 528692a8 target-sparc/translate.c
b/target-sparc/translate.c | ||
---|---|---|
642 | 642 |
|
643 | 643 |
static inline void gen_op_multiply(TCGv dst, TCGv src1, TCGv src2, int sign_ext) |
644 | 644 |
{ |
645 |
TCGv_i32 r_src1, r_src2; |
|
646 |
TCGv_i64 r_temp, r_temp2; |
|
647 |
|
|
648 |
r_src1 = tcg_temp_new_i32(); |
|
649 |
r_src2 = tcg_temp_new_i32(); |
|
650 |
|
|
651 |
tcg_gen_trunc_tl_i32(r_src1, src1); |
|
652 |
tcg_gen_trunc_tl_i32(r_src2, src2); |
|
653 |
|
|
654 |
r_temp = tcg_temp_new_i64(); |
|
655 |
r_temp2 = tcg_temp_new_i64(); |
|
656 |
|
|
645 |
#if TARGET_LONG_BITS == 32 |
|
657 | 646 |
if (sign_ext) { |
658 |
tcg_gen_ext_i32_i64(r_temp, r_src2); |
|
659 |
tcg_gen_ext_i32_i64(r_temp2, r_src1); |
|
647 |
tcg_gen_muls2_tl(dst, cpu_y, src1, src2); |
|
660 | 648 |
} else { |
661 |
tcg_gen_extu_i32_i64(r_temp, r_src2); |
|
662 |
tcg_gen_extu_i32_i64(r_temp2, r_src1); |
|
649 |
tcg_gen_mulu2_tl(dst, cpu_y, src1, src2); |
|
663 | 650 |
} |
651 |
#else |
|
652 |
TCGv t0 = tcg_temp_new_i64(); |
|
653 |
TCGv t1 = tcg_temp_new_i64(); |
|
664 | 654 |
|
665 |
tcg_gen_mul_i64(r_temp2, r_temp, r_temp2); |
|
666 |
|
|
667 |
tcg_gen_shri_i64(r_temp, r_temp2, 32); |
|
668 |
tcg_gen_trunc_i64_tl(cpu_y, r_temp); |
|
669 |
tcg_temp_free_i64(r_temp); |
|
670 |
tcg_gen_andi_tl(cpu_y, cpu_y, 0xffffffff); |
|
671 |
|
|
672 |
tcg_gen_trunc_i64_tl(dst, r_temp2); |
|
655 |
if (sign_ext) { |
|
656 |
tcg_gen_ext32s_i64(t0, src1); |
|
657 |
tcg_gen_ext32s_i64(t1, src2); |
|
658 |
} else { |
|
659 |
tcg_gen_ext32u_i64(t0, src1); |
|
660 |
tcg_gen_ext32u_i64(t1, src2); |
|
661 |
} |
|
673 | 662 |
|
674 |
tcg_temp_free_i64(r_temp2); |
|
663 |
tcg_gen_mul_i64(dst, t0, t1); |
|
664 |
tcg_temp_free(t0); |
|
665 |
tcg_temp_free(t1); |
|
675 | 666 |
|
676 |
tcg_temp_free_i32(r_src1);
|
|
677 |
tcg_temp_free_i32(r_src2);
|
|
667 |
tcg_gen_shri_i64(cpu_y, dst, 32);
|
|
668 |
#endif
|
|
678 | 669 |
} |
679 | 670 |
|
680 | 671 |
static inline void gen_op_umul(TCGv dst, TCGv src1, TCGv src2) |
Also available in: Unified diff