if BUILD_LZCNT_TESTS
check_PROGRAMS += lzcnt64
endif
+if BUILD_MOVBE_TESTS
+ check_PROGRAMS += movbe
+endif
if BUILD_SSE42_TESTS
check_PROGRAMS += \
pcmpstr64 pcmpxstrx64 sse4-64 crc32 aes \
if BUILD_LOOPNEL_TESTS
check_PROGRAMS += loopnel
endif
-if BUILD_MOVBE_TESTS
- check_PROGRAMS += movbe
-endif
if BUILD_AVX_TESTS
if BUILD_VPCLMULQDQ_TESTS
check_PROGRAMS += avx-1
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
-#include <malloc.h>
+#include "tests/malloc.h"
typedef unsigned char UChar;
typedef unsigned int UInt;
\
__attribute__ ((noinline)) static void test_##_name ( void ) \
{ \
- Block* b = memalign(32, sizeof(Block)); \
+ Block* b = memalign32(sizeof(Block)); \
randBlock(b); \
printf("%s\n", #_name); \
showBlock("before", b); \
if BUILD_LZCNT_TESTS
check_PROGRAMS += lzcnt32
endif
-if !VGCONF_OS_IS_DARWIN
if BUILD_MOVBE_TESTS
- check_PROGRAMS += movbe
+ check_PROGRAMS += movbe
endif
+if !VGCONF_OS_IS_DARWIN
if !SOLARIS_SUN_STUDIO_AS
# Sun Studio assembler fails to assemble the bound instruction
check_PROGRAMS += faultstatus
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
-#include <malloc.h>
+#include "tests/malloc.h"
typedef unsigned char UChar;
typedef unsigned int UInt;
\
__attribute__ ((noinline)) static void test_##_name ( void ) \
{ \
- Block* b = memalign(32, sizeof(Block)); \
+ Block* b = memalign32(sizeof(Block)); \
randBlock(b); \
printf("%s\n", #_name); \
showBlock("before", b); \
assert(x);
assert(0 == ((16-1) & (unsigned long)x));
return x;
-}
+}
+
+// Allocates a 32-aligned block. Asserts if the allocation fails.
+__attribute__((unused))
+static void* memalign32(size_t szB)
+{
+ void* x;
+#if defined(VGO_darwin)
+ // Darwin lacks memalign
+ posix_memalign((void **)&x, 32, szB);
+#else
+ x = memalign(32, szB);
+#endif
+ assert(x);
+ assert(0 == ((32-1) & (unsigned long)x));
+ return x;
+}