http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53141

--- Comment #1 from Andreas Krebbel <krebbel at gcc dot gnu.org> 2012-04-27 
14:32:23 UTC ---
That's because reload now will try with swapped operands before going to the
next alternative. So now the first alternative will be used instead of the
second.

This matches the behavior documented in the GCC internal manual:

http://gcc.gnu.org/onlinedocs/gccint/Multi_002dAlternative.html
"If two alternatives need the same amount of copying, the one that
comes first is chosen."

So if the second alternative is preferable then the back-end pattern needs to
be adjusted.

ira:
(insn 9 4 14 2 (parallel [
            (set (reg:DI 65 [ res ])
                (mult:DI (zero_extend:DI (reg/v:SI 64 [ b ]))
                    (zero_extend:DI (reg/v:SI 63 [ a ]))))
            (clobber (reg:CC 17 flags))
        ]) bmi2-mulx32-1.c:24 336 {*umulsidi3_1}
     (expr_list:REG_DEAD (reg/v:SI 64 [ b ])
        (expr_list:REG_DEAD (reg/v:SI 63 [ a ])
            (expr_list:REG_UNUSED (reg:CC 17 flags)
                (nil)))))

reload:
(insn 9 4 17 2 (parallel [
            (set (reg:DI 0 ax [orig:65 res ] [65])
                (mult:DI (zero_extend:DI (reg/v:SI 0 ax [orig:63 a ] [63]))
                    (zero_extend:DI (reg/v:SI 1 dx [orig:64 b ] [64]))))
            (clobber (reg:CC 17 flags))
        ]) bmi2-mulx32-1.c:24 336 {*umulsidi3_1}
     (nil))

back-end pattern:

(define_insn "*umul<mode><dwi>3_1"
  [(set (match_operand:<DWI> 0 "register_operand" "=A,r")
    (mult:<DWI>
      (zero_extend:<DWI>
        (match_operand:DWIH 1 "nonimmediate_operand" "%0,d"))
      (zero_extend:<DWI>
        (match_operand:DWIH 2 "nonimmediate_operand" "rm,rm"))))
   (clobber (reg:CC FLAGS_REG))]

Reply via email to