[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 42/57] target-i386: Make helper_cc_compute_all const
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH 42/57] target-i386: Make helper_cc_compute_all const |
Date: |
Wed, 23 Jan 2013 20:03:26 -0800 |
Pass the data in explicitly, rather than indirectly via env.
Signed-off-by: Richard Henderson <address@hidden>
---
target-i386/cc_helper.c | 16 +++++-----------
target-i386/helper.h | 2 +-
target-i386/translate.c | 32 ++++++++++++++++++++++++++++++--
3 files changed, 36 insertions(+), 14 deletions(-)
diff --git a/target-i386/cc_helper.c b/target-i386/cc_helper.c
index 4dd73cc..b209b57 100644
--- a/target-i386/cc_helper.c
+++ b/target-i386/cc_helper.c
@@ -75,21 +75,15 @@ const uint8_t parity_table[256] = {
#endif
-static int compute_all_eflags(int dst, int src1, int src2)
+target_ulong helper_cc_compute_all(target_ulong dst, target_ulong src1,
+ target_ulong src2, int op)
{
- return src1;
-}
-
-uint32_t helper_cc_compute_all(CPUX86State *env, int op)
-{
- target_ulong dst = CC_DST, src1 = CC_SRC, src2 = CC_SRC2;
-
switch (op) {
default: /* should never happen */
return 0;
case CC_OP_EFLAGS:
- return compute_all_eflags(dst, src1, src2);
+ return src1;
case CC_OP_MULB:
return compute_all_mulb(dst, src1, src2);
@@ -188,7 +182,7 @@ uint32_t helper_cc_compute_all(CPUX86State *env, int op)
uint32_t cpu_cc_compute_all(CPUX86State *env, int op)
{
- return helper_cc_compute_all(env, op);
+ return helper_cc_compute_all(CC_DST, CC_SRC, CC_SRC2, op);
}
void helper_write_eflags(CPUX86State *env, target_ulong t0,
@@ -201,7 +195,7 @@ target_ulong helper_read_eflags(CPUX86State *env)
{
uint32_t eflags;
- eflags = helper_cc_compute_all(env, CC_OP);
+ eflags = cpu_cc_compute_all(env, CC_OP);
eflags |= (DF & DF_MASK);
eflags |= env->eflags & ~(VM_MASK | RF_MASK);
return eflags;
diff --git a/target-i386/helper.h b/target-i386/helper.h
index 89076d3..aa313bd 100644
--- a/target-i386/helper.h
+++ b/target-i386/helper.h
@@ -1,6 +1,6 @@
#include "exec/def-helper.h"
-DEF_HELPER_FLAGS_2(cc_compute_all, TCG_CALL_NO_SE, i32, env, int)
+DEF_HELPER_FLAGS_4(cc_compute_all, TCG_CALL_NO_RWG_SE, tl, tl, tl, tl, int)
DEF_HELPER_0(lock, void)
DEF_HELPER_0(unlock, void)
diff --git a/target-i386/translate.c b/target-i386/translate.c
index 77d86b0..2616a5c 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -898,13 +898,41 @@ static void gen_op_update_neg_cc(void)
/* compute all eflags to cc_src */
static void gen_compute_eflags(DisasContext *s)
{
+ TCGv zero, dst, src1, src2;
+ int live, dead;
+
if (s->cc_op == CC_OP_EFLAGS) {
return;
}
+
+ TCGV_UNUSED(zero);
+ dst = cpu_cc_dst;
+ src1 = cpu_cc_src;
+ src2 = cpu_cc_src2;
+
+ /* Take care to not read values that are not live. */
+ live = cc_op_live[s->cc_op] & ~cc_op_opt[s->cc_op];
+ dead = live ^ (USES_CC_DST | USES_CC_SRC | USES_CC_SRC2);
+ if (dead) {
+ zero = tcg_const_tl(0);
+ if (dead & USES_CC_DST) {
+ dst = zero;
+ }
+ if (dead & USES_CC_SRC) {
+ src1 = zero;
+ }
+ if (dead & USES_CC_SRC2) {
+ src2 = zero;
+ }
+ }
+
gen_update_cc_op(s);
- gen_helper_cc_compute_all(cpu_tmp2_i32, cpu_env, cpu_cc_op);
+ gen_helper_cc_compute_all(cpu_cc_src, dst, src1, src2, cpu_cc_op);
set_cc_op(s, CC_OP_EFLAGS);
- tcg_gen_extu_i32_tl(cpu_cc_src, cpu_tmp2_i32);
+
+ if (dead) {
+ tcg_temp_free(zero);
+ }
}
typedef struct CCPrepare {
--
1.7.11.7
- [Qemu-devel] [PATCH 11/57] target-i386: use gen_jcc1 to compile loopz, (continued)
- [Qemu-devel] [PATCH 11/57] target-i386: use gen_jcc1 to compile loopz, Richard Henderson, 2013/01/23
- [Qemu-devel] [PATCH 13/57] target-i386: Name the cc_op enumeration, Richard Henderson, 2013/01/23
- [Qemu-devel] [PATCH 18/57] target-i386: do not compute eflags multiple times consecutively, Richard Henderson, 2013/01/23
- [Qemu-devel] [PATCH 17/57] target-i386: add helper functions to get other flags, Richard Henderson, 2013/01/23
- [Qemu-devel] [PATCH 16/57] target-i386: Use gen_update_cc_op everywhere, Richard Henderson, 2013/01/23
- [Qemu-devel] [PATCH 25/57] target-i386: optimize setbe, Richard Henderson, 2013/01/23
- [Qemu-devel] [PATCH 23/57] target-i386: convert gen_compute_eflags_c to TCG, Richard Henderson, 2013/01/23
- [Qemu-devel] [PATCH 28/57] target-i386: introduce CCPrepare, Richard Henderson, 2013/01/23
- [Qemu-devel] [PATCH 30/57] target-i386: use CCPrepare to generate conditional jumps, Richard Henderson, 2013/01/23
- [Qemu-devel] [PATCH 43/57] target-i386: Tidy prefix parsing, Richard Henderson, 2013/01/23
- [Qemu-devel] [PATCH 42/57] target-i386: Make helper_cc_compute_all const,
Richard Henderson <=
- [Qemu-devel] [PATCH 53/57] target-i386: Implement RORX, Richard Henderson, 2013/01/23
- [Qemu-devel] [PATCH 55/57] target-i386: Use clz/ctz for bsf/bsr helpers, Richard Henderson, 2013/01/23
- [Qemu-devel] [PATCH 54/57] target-i386: Implement ADX extension, Richard Henderson, 2013/01/23
- [Qemu-devel] [PATCH 56/57] target-i386: Simplify bsf/bsr flags computation, Richard Henderson, 2013/01/23
- [Qemu-devel] [PATCH 57/57] target-i386: Implement tzcnt and fix lzcnt, Richard Henderson, 2013/01/23
- [Qemu-devel] [PATCH 33/57] target-i386: introduce gen_cmovcc1, Richard Henderson, 2013/01/23
- [Qemu-devel] [PATCH 31/57] target-i386: inline gen_prepare_cc_slow, Richard Henderson, 2013/01/23
- [Qemu-devel] [PATCH 40/57] target-i386: Use CC_SRC2 for ADC and SBB, Richard Henderson, 2013/01/23
- [Qemu-devel] [PATCH 35/57] target-i386: kill cpu_T3, Richard Henderson, 2013/01/23
- [Qemu-devel] [PATCH 49/57] target-i386: Implement BZHI, Richard Henderson, 2013/01/23