On Tue, Jul 19, 2016 at 03:40:47PM +0300, Yuri Rumyantsev wrote: > Hi All, > > I was informed that the test pr70729.cc from g++.dg/vect is failed on > non-x86 targets. > I did minor changes to delete target specific stuff like xmmintrin.h. > > Is it OK for trunk?
This is still wrong, aligned_alloc is a C11 API, not all C library stdlib.h headers will declare it and even if they do, it might not be visible in C++ programs (the fact that for glibc g++ predefines -D_GNU_SOURCE by default is a bug). I think we should go with the following instead, there is no point in including any headers, for the test you don't need it. inline void* my_alloc (__SIZE_TYPE__ bytes) {return __builtin_aligned_alloc (bytes, 128);} is a possibility too, of course. 2016-07-19 Jakub Jelinek <ja...@redhat.com> PR middle-end/71734 * g++.dg/vect/pr70729.cc: Don't include string.h or xmmintrin.h. (my_alloc): Rewritten to use __builtin_posix_memalign and __SIZE_TYPE__. (my_free): Use __builtin_free instead of _mm_free. (Vec::operator=): Use __builtin_memcpy. --- gcc/testsuite/g++.dg/vect/pr70729.cc.jj 2016-07-18 19:42:48.000000000 +0200 +++ gcc/testsuite/g++.dg/vect/pr70729.cc 2016-07-19 13:31:04.611981641 +0200 @@ -3,11 +3,8 @@ // { dg-additional-options "-msse2" { target x86_64-*-* i?86-*-* } } -#include <string.h> -#include <xmmintrin.h> - -inline void* my_alloc (size_t bytes) {return _mm_malloc (bytes, 128);} -inline void my_free (void* memory) {_mm_free (memory);} +inline void* my_alloc (__SIZE_TYPE__ bytes) {void *ptr; __builtin_posix_memalign (&ptr, bytes, 128);} +inline void my_free (void* memory) {__builtin_free (memory);} template <typename T> class Vec @@ -23,7 +20,7 @@ public: Vec& operator = (const Vec& other) { if (this != &other) - memcpy (data, other.data, isize*sizeof (T)); + __builtin_memcpy (data, other.data, isize*sizeof (T)); return *this; } Jakub