Hi folks, > On 6 Nov 2021, at 08:05, Martin Liška <mli...@suse.cz> wrote:
> Sorry for issue related to portability. > > On 11/6/21 03:45, David Edelsohn wrote: >> I just noticed that Iain adjusted the tsvc.h for Darwin in the same >> way that I need to adjust it for AIX. Are we trying to keep the >> testcase directory pristine and in sync with its upstream source or >> can we fix it locally? > > We can fix it locally as the source files are split from the original > all-in-one tsvc.c file. I needed one small addition - posix_memalign is not available on the earliest Darwin versions that are regularly tested - but the malloc there is guaranteed to be sufficiently aligned for the largest vectors in use. tested on *-darwin*, x86_64-linux-gnu and powerpc-aix. pushed to master, thanks Iain [pushed] testsuite, Darwin: In tsvc.h, use malloc for Darwin <= 9. 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 <i...@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 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gcc/testsuite/gcc.dg/vect/tsvc/tsvc.h b/gcc/testsuite/gcc.dg/vect/tsvc/tsvc.h index 63ea1e2601f..665ca747f8e 100644 --- a/gcc/testsuite/gcc.dg/vect/tsvc/tsvc.h +++ b/gcc/testsuite/gcc.dg/vect/tsvc/tsvc.h @@ -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){ -- 2.24.3 (Apple Git-128)