This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][ARM] Fix a bug in cstoresi_nltu_thumb1 that causes CSE to produce incorrect code
- From: =?big5?b?RG91ZyBLd2FuICjD9q62vHcp?= <dougkwan at google dot com>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 15 May 2009 17:10:24 -0700
- Subject: [PATCH][ARM] Fix a bug in cstoresi_nltu_thumb1 that causes CSE to produce incorrect code
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