From 3f0d6479205271cac38387aac65cc1a02a3f84a4 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Wed, 16 Aug 2006 13:31:41 +0000 Subject: [PATCH 1/1] Added osr_flag_ignore_x86_shift flag that ignores multiplications by 2, 4, 8 [r8127] --- ir/opt/opt_osr.c | 20 ++++++++++++++++++-- ir/opt/opt_osr.h | 1 + 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ir/opt/opt_osr.c b/ir/opt/opt_osr.c index 6a54ad2b2..3d2094317 100644 --- a/ir/opt/opt_osr.c +++ b/ir/opt/opt_osr.c @@ -290,7 +290,7 @@ static ir_node *do_apply(opcode code, dbg_info *db, ir_node *op1, ir_node *op2, * the opcode, debug-info and mode of a newly created one * @param op1 the first operand * @param op2 the second operand - * @param env the environment + * @param env the environment * * @return the newly created node */ @@ -443,8 +443,24 @@ static int check_replace(ir_node *irn, iv_env *env) { iv = right; rc = left; } - if (iv) + if (iv) { + if (env->flags & osr_flag_ignore_x86_shift) { + if (is_Const(rc)) { + tarval *tv = get_Const_tarval(rc); + + if (tarval_is_long(tv)) { + long value = get_tarval_long(tv); + + if (value == 2 || value == 4 || value == 8) { + /* do not reduce multiplications by 2, 4, 8 */ + break; + } + } + } + } + return replace(irn, iv, rc, env); + } break; default: break; diff --git a/ir/opt/opt_osr.h b/ir/opt/opt_osr.h index 24548587c..464caabba 100644 --- a/ir/opt/opt_osr.h +++ b/ir/opt/opt_osr.h @@ -20,6 +20,7 @@ typedef enum osr_flags { osr_flag_none = 0, /**< no additional flags */ osr_flag_lftr_with_ov_check = 1, /**< do linear function test replacement only if no overflow can occur. */ + osr_flag_ignore_x86_shift = 2 /**< ignore Multiplications by 2, 4, 8 */ } osr_flags; /* FirmJNI cannot handle identical enum values... */ -- 2.20.1