diff peck_test.c @ 4:2d6c49fcafcb

neon2 and neon4 support
author Peter Meerwald <p.meerwald@bct-electronic.com>
date Fri, 16 Sep 2011 14:04:19 +0200
parents 723f588b82ac
children 707be088ccc3
line wrap: on
line diff
--- a/peck_test.c	Fri Sep 16 13:08:20 2011 +0200
+++ b/peck_test.c	Fri Sep 16 14:04:19 2011 +0200
@@ -25,7 +25,7 @@
     unsigned int i, j;
     peck_fftr_cfg p, pi;
 
-    enable_runfast();
+//    enable_runfast();
 
     const unsigned int N = 256;
 
@@ -34,7 +34,15 @@
     peck_fft_scalar res[N];
 
     for (i = 0; i < N; i++) {
+#if USE_SIMD == SIMD_SSE2
+        in[i] = _mm_set1_ps((i % 13) / 3);
+#elif USE_SIMD == SIMD_NEON4
+        in[i] = vdupq_n_f32((i % 13) / 3);
+#elif USE_SIMD == SIMD_NEON2
+        in[i] = vdup_n_f32((i % 13) / 3);
+#else
         in[i] = (i % 13) / 3; 
+#endif        
     }
 
     p = peck_fftr_alloc(N, 0, NULL, NULL);
@@ -43,7 +51,7 @@
     for (j = 0; j < 10000; j++) {
         if (j == 0) {
             for (i = 0; i < 8; i++)
-                printf("%d: %f\n", i, in[i]);
+                printf("%d: %f\n", i, *(float*)&in[i]);
             printf("----\n");
         }
 
@@ -51,7 +59,7 @@
 
         if (j == 0) {
             for (i = 0; i < 8; i++)
-                printf("%d: %f %f\n", i, out[i].r, out[i].i);
+                printf("%d: %f %f\n", i, *(float*)&out[i].r, *(float*)&out[i].i);
             printf("----\n");
         }
         
@@ -59,7 +67,7 @@
 
         if (j == 0) {
             for (i = 0; i < 8; i++)
-                printf("%d: %f\n", i, res[i] / N);
+                printf("%d: %f\n", i, *(float*)&res[i] / N);
         }
     }
     peck_fftr_free(p);    
@@ -67,7 +75,7 @@
     peck_fft_cleanup();
 
     for (i = 0; i < N; i++) {
-        if (fabs(in[i] - res[i]/N) > 0.00001) {
+        if (fabs(*(float*)&in[i] - *(float*)&res[i]/N) > 0.00001) {
             fprintf(stderr, "!!!! ERROR !!!! at %d\n", i);
             exit(EXIT_FAILURE);
         }

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.