From 630ef467a860ff6db6bba710fd46700f4f363496 Mon Sep 17 00:00:00 2001 From: Richard Earnshaw Date: Sat, 23 Jun 2007 18:07:04 +0000 Subject: 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 --- gcc/ChangeLog | 6 ++++ gcc/config/arm/arm.md | 5 +-- gcc/testsuite/ChangeLog | 4 +++ gcc/testsuite/gcc.c-torture/execute/20070623-1.c | 41 ++++++++++++++++++++++++ 4 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/20070623-1.c (limited to 'gcc') 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 + + PR target/31152 + * arm.md (negscc): Match the correct operand for optimized LT0 test. + Remove optimization for GT. + 2007-06-23 Kenneth Zadeck 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 + + * gcc.c-torture/execute/20070623-1.c: New. + 2007-06-22 Jan Hubicka * 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 + +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); +} -- cgit v1.1