aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAndreas Krebbel <Andreas.Krebbel@de.ibm.com>2014-04-04 21:58:34 +0000
committerAndreas Krebbel <krebbel@gcc.gnu.org>2014-04-04 21:58:34 +0000
commit961e89f297ee15a1fa8ce510a98f34fc7062e52d (patch)
treed313906c609b3accba15f2d13e13ccce8359ad21 /gcc
parent090ec70209ce4d706bb618d5efbc1325ade0341f (diff)
downloadgcc-961e89f297ee15a1fa8ce510a98f34fc7062e52d.zip
gcc-961e89f297ee15a1fa8ce510a98f34fc7062e52d.tar.gz
gcc-961e89f297ee15a1fa8ce510a98f34fc7062e52d.tar.bz2
builtin-bswap-6.c: Adjust return value to disable GCC optimization.
2014-04-04 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> * gcc.dg/builtin-bswap-6.c: Adjust return value to disable GCC optimization. * gcc.dg/builtin-bswap-7.c: Likewise. From-SVN: r209132
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.dg/builtin-bswap-6.c12
-rw-r--r--gcc/testsuite/gcc.dg/builtin-bswap-7.c12
3 files changed, 22 insertions, 8 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0cd68ca..7d030fd 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2014-04-04 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
+
+ * gcc.dg/builtin-bswap-6.c: Adjust return value to disable GCC
+ optimization.
+ * gcc.dg/builtin-bswap-7.c: Likewise.
+
2014-04-04 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58207
diff --git a/gcc/testsuite/gcc.dg/builtin-bswap-6.c b/gcc/testsuite/gcc.dg/builtin-bswap-6.c
index 024ebf1..6f0c782 100644
--- a/gcc/testsuite/gcc.dg/builtin-bswap-6.c
+++ b/gcc/testsuite/gcc.dg/builtin-bswap-6.c
@@ -3,6 +3,10 @@
/* { dg-options "-O -fdump-rtl-combine" } */
/* { dg-options "-O -fdump-rtl-combine -march=z900" { target s390-*-* } } */
+/* The test intentionally returns 1/2 instead of the obvious 0/1 to
+ prevent GCC from calculating the return value with arithmetic
+ instead of a comparison. */
+
#include <stdint.h>
#define BS(X) __builtin_bswap32(X)
@@ -11,28 +15,28 @@ int foo1 (uint32_t a)
{
if (BS (a) == 0xA0000)
return 1;
- return 0;
+ return 2;
}
int foo2 (uint32_t a)
{
if (BS (a) != 0xA0000)
return 1;
- return 0;
+ return 2;
}
int foo3 (uint32_t a, uint32_t b)
{
if (BS (a) == BS (b))
return 1;
- return 0;
+ return 2;
}
int foo4 (uint32_t a, uint32_t b)
{
if (BS (a) != BS (b))
return 1;
- return 0;
+ return 2;
}
/* { dg-final { scan-rtl-dump-not "bswapsi" "combine" } } */
diff --git a/gcc/testsuite/gcc.dg/builtin-bswap-7.c b/gcc/testsuite/gcc.dg/builtin-bswap-7.c
index 399b825..0eecdd8 100644
--- a/gcc/testsuite/gcc.dg/builtin-bswap-7.c
+++ b/gcc/testsuite/gcc.dg/builtin-bswap-7.c
@@ -3,6 +3,10 @@
/* { dg-require-effective-target lp64 } */
/* { dg-options "-O -fdump-rtl-combine" } */
+/* The test intentionally returns 1/2 instead of the obvious 0/1 to
+ prevent GCC from calculating the return value with arithmetic
+ instead of a comparison. */
+
#include <stdint.h>
#define BS(X) __builtin_bswap64(X)
@@ -11,28 +15,28 @@ int foo1 (uint64_t a)
{
if (BS (a) == 0xA00000000)
return 1;
- return 0;
+ return 2;
}
int foo2 (uint64_t a)
{
if (BS (a) != 0xA00000000)
return 1;
- return 0;
+ return 2;
}
int foo3 (uint64_t a, uint64_t b)
{
if (BS (a) == BS (b))
return 1;
- return 0;
+ return 2;
}
int foo4 (uint64_t a, uint64_t b)
{
if (BS (a) != BS (b))
return 1;
- return 0;
+ return 2;
}
/* { dg-final { scan-rtl-dump-not "bswapdi" "combine" } } */