aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAndrew Pinski <apinski@marvell.com>2019-12-08 21:59:25 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2019-12-08 13:59:25 -0800
commita0d169d17a275c66e6e59d843097aa1a9a87d918 (patch)
tree78d59e8106ba8bdc48296bf1307d1e57d250de3e /gcc
parent58ccb8ec7ce8745e19af3ce966234bcb9e207c9e (diff)
downloadgcc-a0d169d17a275c66e6e59d843097aa1a9a87d918.zip
gcc-a0d169d17a275c66e6e59d843097aa1a9a87d918.tar.gz
gcc-a0d169d17a275c66e6e59d843097aa1a9a87d918.tar.bz2
New bswap testcase.
2019-12-08 Andrew Pinski <apinski@marvell.com> * gcc.c-torture/execute/bswap-3.c: New test. From-SVN: r279100
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/bswap-3.c25
2 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3516d8d..d069d0c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2019-12-08 Andrew Pinski <apinski@marvell.com>
+
+ * gcc.c-torture/execute/bswap-3.c: New test.
+
2019-12-08 Sandra Loosemore <sandra@codesourcery.com>
Revert:
diff --git a/gcc/testsuite/gcc.c-torture/execute/bswap-3.c b/gcc/testsuite/gcc.c-torture/execute/bswap-3.c
new file mode 100644
index 0000000..633711e
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/bswap-3.c
@@ -0,0 +1,25 @@
+/* { dg-require-effective-target int32plus } */
+
+int f(unsigned int a) __attribute__((noipa));
+int f(unsigned int a)
+{
+ return ((__builtin_bswap32(a))>>24) & 0x3;
+}
+
+
+int g(unsigned int a) __attribute__((noipa));
+int g(unsigned int a)
+{
+ return a&0x3;
+}
+
+int main(void)
+{
+ for (int b = 0; b <= 0xF; b++)
+ {
+ if (f(b) != g(b))
+ __builtin_abort ();
+ }
+ return 0;
+}
+