testsuite, Darwin: In tsvc.h, use malloc for Darwin <= 9.
authorIain Sandoe <iain@sandoe.co.uk>
Sat, 13 Nov 2021 11:58:09 +0000 (11:58 +0000)
committerIain Sandoe <iain@sandoe.co.uk>
Mon, 15 Nov 2021 19:28:07 +0000 (19:28 +0000)
Earlier Darwin versions fdo not have posix_memalign() but the
malloc implementation is guaranteed to produce memory suitably
aligned for the largest vector type.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/testsuite/ChangeLog:

* gcc.dg/vect/tsvc/tsvc.h: Use malloc for Darwin 9 and
earlier.

gcc/testsuite/gcc.dg/vect/tsvc/tsvc.h

index 63ea1e2..665ca74 100644 (file)
@@ -193,8 +193,16 @@ void init(int** ip, real_t* s1, real_t* s2){
     xx = (real_t*) memalign(ARRAY_ALIGNMENT, LEN_1D*sizeof(real_t));
     *ip = (int *) memalign(ARRAY_ALIGNMENT, LEN_1D*sizeof(real_t));
 #else
+# if defined (__APPLE__) \
+    && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1060
+    /* We have no aligned allocator, but malloc is guaranteed to return
+       alignment suitable for the largest vector item.  */
+    xx = (real_t*) malloc (LEN_1D*sizeof(real_t));
+    *ip = (int *) malloc (LEN_1D*sizeof(real_t));
+# else
     posix_memalign ((void*)&xx, ARRAY_ALIGNMENT, LEN_1D*sizeof(real_t));
     posix_memalign ((void*)ip, ARRAY_ALIGNMENT, LEN_1D*sizeof(real_t));
+# endif
 #endif    
 
     for (int i = 0; i < LEN_1D; i = i+5){