New bswap testcase.
authorAndrew Pinski <apinski@marvell.com>
Sun, 8 Dec 2019 21:59:25 +0000 (21:59 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Sun, 8 Dec 2019 21:59:25 +0000 (13:59 -0800)
2019-12-08  Andrew Pinski  <apinski@marvell.com>

        * gcc.c-torture/execute/bswap-3.c: New test.

From-SVN: r279100

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/bswap-3.c [new file with mode: 0644]

index 3516d8dac73a28a254f80d0a732ded13759ce4d9..d069d0ca2c307dce9df96e0b305a7e1ed9fbdb34 100644 (file)
@@ -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 (file)
index 0000000..633711e
--- /dev/null
@@ -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;
+}
+