This is the mail archive of the gcc-patches@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]

Re: [PATCH] PR 24418


On Wed, 2005-10-19 at 19:50, Evan Cheng wrote:

> 2005-10-19  Evan Cheng  <evan.cheng@apple.com>
> 
>      PR target/24418
>      * config/i386/i386.md (*subsi_4): New
>      * testsuite/gcc.target/i386/pr24418.c: Test case added

+ (define_insn "*subsi_4"
+   [(set (reg FLAGS_REG)
+       (compare:CC
+         (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
+                   (match_operand:SI 2 "general_operand" "ri,rm"))
+         (const_int 0)))
[...]
+   "sub{l}\t{%2, %0|%0, %2}"

This is wrong.  As I understand the x86 instruction set sub would set
the flags to the result of 

	(compare:CC (operand[1]) (operand[2]))

Which is not what your RTL describes it as doing.

Consider the case where operand[1] is 0x80000000 and operand[2] is 1 and
the effect on the overflow flag.

Next consider the effect on the overflow flag of comparing 0x7fffffff
with 0.

R.


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