This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/54829] bad optimization: sub followed by cmp w/ zero (ARM)


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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|bad optimization: sub       |bad optimization: sub
                   |followed by cmp w/ zero     |followed by cmp w/ zero
                   |(x86 & ARM)                 |(ARM)

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> 2012-10-06 13:31:00 UTC ---
i386.md has

(define_insn "*cmp<mode>_minus_1"
  [(set (reg FLAGS_REG)
        (compare
          (minus:SWI (match_operand:SWI 0 "nonimmediate_operand" "<r>m,<r>")
                     (match_operand:SWI 1 "<general_operand>" "<r><i>,<r>m"))
          (const_int 0)))]
  "ix86_match_ccmode (insn, CCGOCmode)"
  "cmp{<imodesuffix>}\t{%1, %0|%0, %1}"
  [(set_attr "type" "icmp")
   (set_attr "mode" "<MODE>")])

Since cmp will also set OF and CF flags, it can't be used for GT and LE
which checks OF.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]