aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/i386/fma-fmaddsubXX.c
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
committerBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
commit1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch)
treec607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/gcc.target/i386/fma-fmaddsubXX.c
parent283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff)
downloadtoolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.target/i386/fma-fmaddsubXX.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.target/i386/fma-fmaddsubXX.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/fma-fmaddsubXX.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/fma-fmaddsubXX.c
new file mode 100644
index 000000000..89c816392
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/fma-fmaddsubXX.c
@@ -0,0 +1,61 @@
+/* { dg-do run } */
+/* { dg-require-effective-target fma } */
+/* { dg-options "-O2 -mfma" } */
+
+#include "fma-check.h"
+
+#include <x86intrin.h>
+#include "m256-check.h"
+
+void
+check_mm_fmaddsub_ps (__m128 __A, __m128 __B, __m128 __C)
+{
+ union128 a, b, c, e;
+ a.x = __A;
+ b.x = __B;
+ c.x = __C;
+ float d[4];
+ int i;
+ e.x = _mm_fmaddsub_ps (__A, __B, __C);
+ for (i = 0; i < 4; i++)
+ {
+ d[i] = a.a[i] * b.a[i] + (i % 2 == 1 ? c.a[i] : -c.a[i]);
+ }
+ if (check_union128 (e, d))
+ abort ();
+}
+
+void
+check_mm_fmaddsub_pd (__m128d __A, __m128d __B, __m128d __C)
+{
+ union128d a, b, c, e;
+ a.x = __A;
+ b.x = __B;
+ c.x = __C;
+ double d[2];
+ int i;
+ e.x = _mm_fmaddsub_pd (__A, __B, __C);
+ for (i = 0; i < 2; i++)
+ {
+ d[i] = a.a[i] * b.a[i] + (i % 2 == 1 ? c.a[i] : -c.a[i]);
+ }
+ if (check_union128d (e, d))
+ abort ();
+}
+
+static void
+fma_test (void)
+{
+ union128 a[3];
+ union128d b[3];
+ int i, j;
+ for (i = 0; i < 3; i++)
+ {
+ for (j = 0; j < 4; j++)
+ a[i].a[j] = i * j + 3.5;
+ for (j = 0; j < 2; j++)
+ b[i].a[j] = i * j + 3.5;
+ }
+ check_mm_fmaddsub_pd (b[0].x, b[1].x, b[2].x);
+ check_mm_fmaddsub_ps (a[0].x, a[1].x, a[2].x);
+}