This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR 24418
- From: Richard Earnshaw <rearnsha at gcc dot gnu dot org>
- To: Evan Cheng <evan dot cheng at apple dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 20 Oct 2005 10:17:45 +0100
- Subject: Re: [PATCH] PR 24418
- References: <F4543357-27EA-4919-BC34-94F6E82E7DAA@apple.com>
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.