aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.8/gcc/testsuite/gcc.target/i386/sse-9.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.8/gcc/testsuite/gcc.target/i386/sse-9.c')
-rw-r--r--gcc-4.8/gcc/testsuite/gcc.target/i386/sse-9.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/gcc-4.8/gcc/testsuite/gcc.target/i386/sse-9.c b/gcc-4.8/gcc/testsuite/gcc.target/i386/sse-9.c
new file mode 100644
index 000000000..e1a0a2270
--- /dev/null
+++ b/gcc-4.8/gcc/testsuite/gcc.target/i386/sse-9.c
@@ -0,0 +1,38 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -msse" } */
+/* { dg-require-effective-target sse } */
+
+#include "sse-check.h"
+
+#include <xmmintrin.h>
+#include <stddef.h>
+#include <string.h>
+
+static void
+sse_test (void)
+{
+ int alignment, n;
+ void *ptr;
+ int errors = 0;
+ const char test [] = "This is a test.";
+
+ for (alignment = 1; alignment <= (1 << 20); alignment += alignment)
+ {
+ ptr = _mm_malloc (alignment, alignment);
+ if (((ptrdiff_t) ptr) & (alignment - 1))
+ abort ();
+ if (ptr)
+ {
+ n = alignment > sizeof test ? sizeof test : alignment;
+ memcpy (ptr, test, n);
+ if (memcmp (ptr, test, n) != 0)
+ errors++;
+ _mm_free (ptr);
+ }
+ else
+ errors++;
+ }
+
+ if (errors != 0)
+ abort ();
+}