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


The patch was tested against rev 147593 on arm-unknown-linux-gnueabi
using QEMU Linux user-mode emulator.  Only Thumb mode was tested. The
patch did not caused any new regression.  In fact, it apparently fixes
these previous regressions also:

Tests that now work, but didn't before:

qemu-sim/thumb: gcc.c-torture/execute/builtins/strncat-chk.c execution,  -O1
qemu-sim/thumb: gcc.c-torture/execute/builtins/strncat-chk.c execution,  -O2
qemu-sim/thumb: gcc.c-torture/execute/builtins/strncat-chk.c
execution,  -O3 -fomit-frame-pointer
qemu-sim/thumb: gcc.c-torture/execute/builtins/strncat-chk.c
execution,  -O3 -fomit-frame-pointer -funroll-all-loops
-finline-functions
qemu-sim/thumb: gcc.c-torture/execute/builtins/strncat-chk.c
execution,  -O3 -fomit-frame-pointer -funroll-loops
qemu-sim/thumb: gcc.c-torture/execute/builtins/strncat-chk.c execution,  -O3 -g
qemu-sim/thumb: gcc.c-torture/execute/builtins/strncat-chk.c execution,  -Os
qemu-sim/thumb: gcc.c-torture/execute/loop-2g.c execution,  -O1

Tests that now work, but didn't before:

qemu-sim/thumb: g++.dg/torture/pr37922.C  -O1  execution test
qemu-sim/thumb: g++.dg/torture/pr37922.C  -O2  execution test
qemu-sim/thumb: g++.dg/torture/pr37922.C  -O3 -fomit-frame-pointer
execution test
qemu-sim/thumb: g++.dg/torture/pr37922.C  -O3 -fomit-frame-pointer
-funroll-all-loops -finline-functions  execution test
qemu-sim/thumb: g++.dg/torture/pr37922.C  -O3 -fomit-frame-pointer
-funroll-loops  execution test
qemu-sim/thumb: g++.dg/torture/pr37922.C  -O3 -g  execution test
qemu-sim/thumb: g++.dg/torture/pr37922.C  -Os  execution test

-Doug

2009/5/15 Doug Kwan (w) <dougkwan@google.com>:
> 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
>>
>


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