Skip to content

Commit

Permalink
i386/op_helper: try to reduce complexity of flags expressions
Browse files Browse the repository at this point in the history
Signed-off-by: Vitaly Chipounov <vitaly@cyberhaven.io>
  • Loading branch information
vitaly-cyberhaven committed May 24, 2019
1 parent 5e4ee0b commit 31da900
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/target-i386/op_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,11 @@ static inline void helper_fstt(floatx80 f, target_ulong ptr) {
#define FPUC_EM 0x3f

uint32_t compute_eflags(void) {
/* Bit 1 must always be set according to x86 architecture */
return env->mflags | helper_cc_compute_all(CC_OP) | (DF & DF_MASK) | 2;
// Bit 1 must always be set according to x86 architecture
// The cast to uint32_t is required to reduce the complexity of LLVM instructions,
// which would otherwise create deep expression trees during symbolic execution
// (chains of extract/zext).
return ((uint32_t) env->mflags) | helper_cc_compute_all(CC_OP) | (DF & DF_MASK) | 2;
}

#if defined(CONFIG_SYMBEX) && !defined(SYMBEX_LLVM_LIB) && !defined(STATIC_TRANSLATOR)
Expand Down

0 comments on commit 31da900

Please sign in to comment.