diff options
author | Richard Earnshaw <rearnsha@arm.com> | 2007-06-23 18:07:04 +0000 |
---|---|---|
committer | Richard Earnshaw <rearnsha@gcc.gnu.org> | 2007-06-23 18:07:04 +0000 |
commit | 630ef467a860ff6db6bba710fd46700f4f363496 (patch) | |
tree | b68a85a5e9d12adb9ebdd8e00c3cda46873ff7e3 /gcc | |
parent | 6cad985925701132aac4e9778ade570fac1ad2b0 (diff) | |
download | gcc-630ef467a860ff6db6bba710fd46700f4f363496.zip gcc-630ef467a860ff6db6bba710fd46700f4f363496.tar.gz gcc-630ef467a860ff6db6bba710fd46700f4f363496.tar.bz2 |
re PR target/31152 (-(x>y) generates wrong code)
PR target/31152
* arm.md (negscc): Match the correct operand for optimized LT0 test.
Remove optimization for GT.
*gcc.c-torture/execute/20070623-1.c: New.
From-SVN: r125973
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/config/arm/arm.md | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/20070623-1.c | 41 |
4 files changed, 52 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eff5188..9ea41e1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2007-06-23 Richard Earnshaw <rearnsha@arm.com> + + PR target/31152 + * arm.md (negscc): Match the correct operand for optimized LT0 test. + Remove optimization for GT. + 2007-06-23 Kenneth Zadeck <zadeck@naturalbridge.com> PR middle-end/32437 diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index 664f23d..5a8774e 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -9423,15 +9423,12 @@ (clobber (reg:CC CC_REGNUM))] "TARGET_ARM" "* - if (GET_CODE (operands[3]) == LT && operands[3] == const0_rtx) + if (GET_CODE (operands[3]) == LT && operands[2] == const0_rtx) return \"mov\\t%0, %1, asr #31\"; if (GET_CODE (operands[3]) == NE) return \"subs\\t%0, %1, %2\;mvnne\\t%0, #0\"; - if (GET_CODE (operands[3]) == GT) - return \"subs\\t%0, %1, %2\;mvnne\\t%0, %0, asr #31\"; - output_asm_insn (\"cmp\\t%1, %2\", operands); output_asm_insn (\"mov%D3\\t%0, #0\", operands); return \"mvn%d3\\t%0, #0\"; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 435de15..48c7ab6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2007-06-23 Richard Earnshaw <rearnsha@arm.com> + + * gcc.c-torture/execute/20070623-1.c: New. + 2007-06-22 Jan Hubicka <jh@suse.cz> * gcc.c-torture/compile/pr31541.c: New. diff --git a/gcc/testsuite/gcc.c-torture/execute/20070623-1.c b/gcc/testsuite/gcc.c-torture/execute/20070623-1.c new file mode 100644 index 0000000..e9c7d2a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20070623-1.c @@ -0,0 +1,41 @@ +#include <limits.h> + +int __attribute__((noinline)) nge(int a, int b) {return -(a >= b);} +int __attribute__((noinline)) ngt(int a, int b) {return -(a > b);} +int __attribute__((noinline)) nle(int a, int b) {return -(a <= b);} +int __attribute__((noinline)) nlt(int a, int b) {return -(a < b);} +int __attribute__((noinline)) neq(int a, int b) {return -(a == b);} +int __attribute__((noinline)) nne(int a, int b) {return -(a != b);} +int __attribute__((noinline)) ngeu(unsigned a, unsigned b) {return -(a >= b);} +int __attribute__((noinline)) ngtu(unsigned a, unsigned b) {return -(a > b);} +int __attribute__((noinline)) nleu(unsigned a, unsigned b) {return -(a <= b);} +int __attribute__((noinline)) nltu(unsigned a, unsigned b) {return -(a < b);} + + +int main() +{ + if (nge(INT_MIN, INT_MAX) != 0) abort(); + if (nge(INT_MAX, INT_MIN) != -1) abort(); + if (ngt(INT_MIN, INT_MAX) != 0) abort(); + if (ngt(INT_MAX, INT_MIN) != -1) abort(); + if (nle(INT_MIN, INT_MAX) != -1) abort(); + if (nle(INT_MAX, INT_MIN) != 0) abort(); + if (nlt(INT_MIN, INT_MAX) != -1) abort(); + if (nlt(INT_MAX, INT_MIN) != 0) abort(); + + if (neq(INT_MIN, INT_MAX) != 0) abort(); + if (neq(INT_MAX, INT_MIN) != 0) abort(); + if (nne(INT_MIN, INT_MAX) != -1) abort(); + if (nne(INT_MAX, INT_MIN) != -1) abort(); + + if (ngeu(0, ~0U) != 0) abort(); + if (ngeu(~0U, 0) != -1) abort(); + if (ngtu(0, ~0U) != 0) abort(); + if (ngtu(~0U, 0) != -1) abort(); + if (nleu(0, ~0U) != -1) abort(); + if (nleu(~0U, 0) != 0) abort(); + if (nltu(0, ~0U) != -1) abort(); + if (nltu(~0U, 0) != 0) abort(); + + exit(0); +} |