]> Git Repo - qemu.git/blobdiff - target-sparc/translate.c
Convert umul and smul to TCG
[qemu.git] / target-sparc / translate.c
index c24c48b67309f2f1b7eec7c5c7d66267a6d471be..cee85c4d81fa2a13ab4e3b87639ce7c6c7913b75 100644 (file)
@@ -759,6 +759,54 @@ static inline void gen_op_mulscc_T1_T0(void)
     gen_cc_C_add(cpu_T[0], cpu_cc_src);
 }
 
+static inline void gen_op_umul_T1_T0(void)
+{
+    TCGv r_temp, r_temp2;
+
+    r_temp = tcg_temp_new(TCG_TYPE_I64);
+    r_temp2 = tcg_temp_new(TCG_TYPE_I64);
+
+    tcg_gen_extu_i32_i64(r_temp, cpu_T[1]);
+    tcg_gen_extu_i32_i64(r_temp2, cpu_T[0]);
+    tcg_gen_mul_i64(r_temp2, r_temp, r_temp2);
+
+    tcg_gen_shri_i64(r_temp, r_temp2, 32);
+    tcg_gen_trunc_i64_i32(r_temp, r_temp);
+    tcg_gen_st_i32(r_temp, cpu_env, offsetof(CPUSPARCState, y));
+#ifdef TARGET_SPARC64
+    tcg_gen_mov_i64(cpu_T[0], r_temp2);
+#else
+    tcg_gen_trunc_i64_i32(cpu_T[0], r_temp2);
+#endif
+
+    tcg_gen_discard_i64(r_temp);
+    tcg_gen_discard_i64(r_temp2);
+}
+
+static inline void gen_op_smul_T1_T0(void)
+{
+    TCGv r_temp, r_temp2;
+
+    r_temp = tcg_temp_new(TCG_TYPE_I64);
+    r_temp2 = tcg_temp_new(TCG_TYPE_I64);
+
+    tcg_gen_ext32s_i64(r_temp, cpu_T[1]);
+    tcg_gen_ext32s_i64(r_temp2, cpu_T[0]);
+    tcg_gen_mul_i64(r_temp2, r_temp, r_temp2);
+
+    tcg_gen_shri_i64(r_temp, r_temp2, 32);
+    tcg_gen_trunc_i64_i32(r_temp, r_temp);
+    tcg_gen_st_i32(r_temp, cpu_env, offsetof(CPUSPARCState, y));
+#ifdef TARGET_SPARC64
+    tcg_gen_mov_i64(cpu_T[0], r_temp2);
+#else
+    tcg_gen_trunc_i64_i32(cpu_T[0], r_temp2);
+#endif
+
+    tcg_gen_discard_i64(r_temp);
+    tcg_gen_discard_i64(r_temp2);
+}
+
 #ifdef TARGET_SPARC64
 static inline void gen_trap_ifdivzero_i64(TCGv divisor)
 {
This page took 0.02414 seconds and 4 git commands to generate.