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][ARM] Fix a bug in cstoresi_nltu_thumb1 that causes CSE to produce incorrect code


Sorry, forgot that patch :)

2009-05-15  Doug Kwan  <dougkwan@google.com>

testsuite/ChangeLog

	* gcc.target/arm/40153.c: New test.

ChangeLog

	PR target/40153
	* config/arm/arm.md (cstoresi_nltu_thumb1): Fix typo that caused CSE
	to produce incorrect code.


2009/5/15 Doug Kwan (w) <dougkwan@google.com>:
> Hi
>
>    This patch fixes a typo in the RTL instruction
> cstoresi_nltu_thumb1 that causes bad THUMB code to be generated in the
> arm-eabi target.  The instruction is meant to compute the expression
> -(x < y) where x and y of unsigned SI type.  The current RTL looks
> like this in trunk, gcc-4.4 and gcc-4.3:
>
> (define_insn "cstoresi_nltu_thumb1"
>  [(set (match_operand:SI 0 "s_register_operand" "=l,l")
>        (neg:SI (gtu:SI (match_operand:SI 1 "s_register_operand" "l,*h")
>                        (match_operand:SI 2 "thumb1_cmp_operand" "lI*h,*r"))))]
>  "TARGET_THUMB1"
>  "cmp\\t%1, %2\;sbc\\t%0, %0, %0"
>  [(set_attr "length" "4")]
> )
>
> It is quite obvious that source operand of the NEG RTX should be an
> LTU RTX instead of a GTU RTX.  The incorrectly use of GTU sometims
> causes CSE to generate bad code if there is another GTU RTX with the
> same operands before the the cstoresi_nltu_thumb1 instruction.
> Details are in the gcc bugzilla page.
>
> I have tested fix in this patch using the test case also in the patch.
>  I will check this in after approval and regression testing.
>
> -Doug
>

Attachment: patch.txt
Description: Text document


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