X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fia32%2Fia32_transform.c;h=9d014768873eb865ec24ceb41d38514510c58607;hb=eb593ca265a302849042866b57a3cf7a6e9495ab;hp=d73e8488a9aa85ca123ea552bada77750f007607;hpb=3611de8cc078469e175c45d2157bb99ecb2f5324;p=libfirm diff --git a/ir/be/ia32/ia32_transform.c b/ir/be/ia32/ia32_transform.c index d73e8488a..9d0147688 100644 --- a/ir/be/ia32/ia32_transform.c +++ b/ir/be/ia32/ia32_transform.c @@ -737,20 +737,19 @@ static void match_arguments(ia32_address_mode_t *am, ir_node *block, } am->op_type = ia32_AddrModeS; } else { + am->op_type = ia32_Normal; + if (flags & match_try_am) { am->new_op1 = NULL; am->new_op2 = NULL; - am->op_type = ia32_Normal; return; } new_op1 = (op1 == NULL ? NULL : be_transform_node(op1)); if (new_op2 == NULL) new_op2 = be_transform_node(op2); - am->op_type = ia32_Normal; - am->ls_mode = get_irn_mode(op2); - if (flags & match_mode_neutral) - am->ls_mode = mode_Iu; + am->ls_mode = + (flags & match_mode_neutral ? mode_Iu : get_irn_mode(op2)); } if (addr->base == NULL) addr->base = noreg_gp; @@ -2700,6 +2699,9 @@ static bool upper_bits_clean(ir_node *transformed_node, ir_mode *mode) if (get_mode_size_bits(mode) >= 32) return true; + if (is_Proj(transformed_node)) + return upper_bits_clean(get_Proj_pred(transformed_node), mode); + if (is_ia32_Conv_I2I(transformed_node) || is_ia32_Conv_I2I8Bit(transformed_node)) { ir_mode *smaller_mode = get_ia32_ls_mode(transformed_node); @@ -2721,6 +2723,7 @@ static bool upper_bits_clean(ir_node *transformed_node, ir_mode *mode) return true; } } + return upper_bits_clean(get_irn_n(transformed_node, n_ia32_Shr_val), mode); } if (is_ia32_And(transformed_node) && !mode_is_signed(mode)) { @@ -2734,8 +2737,11 @@ static bool upper_bits_clean(ir_node *transformed_node, ir_mode *mode) return true; } } + /* TODO recurse? */ } + /* TODO recurse on Or, Xor, ... if appropriate? */ + if (is_ia32_Immediate(transformed_node) || is_ia32_Const(transformed_node)) { const ia32_immediate_attr_t *attr @@ -2805,8 +2811,8 @@ static ir_node *gen_Cmp(ir_node *node) match_8bit | match_16bit); /* use 32bit compare mode if possible since the opcode is smaller */ - if (upper_bits_clean(am.new_op1, cmp_mode) - && upper_bits_clean(am.new_op2, cmp_mode)) { + if (upper_bits_clean(am.new_op1, cmp_mode) && + upper_bits_clean(am.new_op2, cmp_mode)) { cmp_mode = mode_is_signed(cmp_mode) ? mode_Is : mode_Iu; } @@ -2828,8 +2834,8 @@ static ir_node *gen_Cmp(ir_node *node) match_16bit_am | match_am_and_immediates | match_immediate | match_8bit | match_16bit); /* use 32bit compare mode if possible since the opcode is smaller */ - if (upper_bits_clean(am.new_op1, cmp_mode) - && upper_bits_clean(am.new_op2, cmp_mode)) { + if (upper_bits_clean(am.new_op1, cmp_mode) && + upper_bits_clean(am.new_op2, cmp_mode)) { cmp_mode = mode_is_signed(cmp_mode) ? mode_Is : mode_Iu; }