mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-03 18:13:01 +00:00
Increase test coverage on OS X, by re-enabling the memcheck/tests/amd64/xsave-avx regression tests with a handy memalign() shim.
n-i-bz (Unfortunately I don’t have right here the hw support, but build environment works) $ perl tests/vg_regtest memcheck/tests/amd64/xsave-avx xsave-avx: (skipping, prereq failed: test -x xsave-avx && ../../../tests/x86_amd64_features amd64-avx) == 0 tests, 0 stderr failures, 0 stdout failures, 0 stderrB failures, 0 stdoutB failures, 0 post failures == On OS X 10.10 Before: == 594 tests, 215 stderr failures, 9 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures == After: == 594 tests, 215 stderr failures, 9 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures == git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15551
This commit is contained in:
parent
be875fe3ac
commit
774dbf0a73
@ -46,10 +46,7 @@ check_PROGRAMS = \
|
||||
sse_memory \
|
||||
xor-undef-amd64
|
||||
if BUILD_AVX_TESTS
|
||||
check_PROGRAMS += sh-mem-vec256
|
||||
if !VGCONF_OS_IS_DARWIN
|
||||
check_PROGRAMS += xsave-avx
|
||||
endif
|
||||
check_PROGRAMS += sh-mem-vec256 xsave-avx
|
||||
endif
|
||||
if HAVE_ASM_CONSTRAINT_P
|
||||
check_PROGRAMS += insn-pcmpistri
|
||||
|
||||
@ -54,9 +54,9 @@ void* my_memcpy(void *dest, const void *src, size_t n)
|
||||
return dest;
|
||||
}
|
||||
|
||||
static void* memalign_zeroed(size_t alignment, size_t size)
|
||||
static void* memalign_zeroed64(size_t size)
|
||||
{
|
||||
char* p = memalign(alignment, size);
|
||||
char* p = memalign64(size);
|
||||
if (p && size > 0) {
|
||||
my_memset(p, 0, size);
|
||||
}
|
||||
@ -203,7 +203,7 @@ void test_xsave ( Bool hideBits64to79 )
|
||||
|
||||
UInt rfbm;
|
||||
for (rfbm = 0; rfbm <= 7; rfbm++) {
|
||||
UChar* saved_img = memalign_zeroed(64, XSAVE_AREA_SIZE);
|
||||
UChar* saved_img = memalign_zeroed64(XSAVE_AREA_SIZE);
|
||||
|
||||
my_memset(saved_img, 0xAA, XSAVE_AREA_SIZE);
|
||||
saved_img[512] = 0;
|
||||
@ -236,7 +236,7 @@ void test_xrstor ( Bool hideBits64to79 )
|
||||
neither zero nor the data to be loaded. We choose to use 0x55
|
||||
where possible. */
|
||||
|
||||
UChar* fives = memalign_zeroed(64, XSAVE_AREA_SIZE);
|
||||
UChar* fives = memalign_zeroed64(XSAVE_AREA_SIZE);
|
||||
my_memset(fives, 0x55, XSAVE_AREA_SIZE);
|
||||
/* Set MXCSR so that the insn doesn't fault */
|
||||
fives[24] = 0x80;
|
||||
@ -259,7 +259,7 @@ void test_xrstor ( Bool hideBits64to79 )
|
||||
fives[4/*FTW*/] = 0xFF;
|
||||
|
||||
/* (1) (see comment in loop below) */
|
||||
UChar* standard_test_data = memalign_zeroed(64, XSAVE_AREA_SIZE);
|
||||
UChar* standard_test_data = memalign_zeroed64(XSAVE_AREA_SIZE);
|
||||
do_setup_then_xsave(standard_test_data, 7);
|
||||
|
||||
UInt xstate_bv, rfbm;
|
||||
@ -283,12 +283,12 @@ void test_xrstor ( Bool hideBits64to79 )
|
||||
/* (3a). We can't use |standard_test_data| directly, since we
|
||||
need to put in the required |xstate_bv| value. So make a
|
||||
copy and modify that instead. */
|
||||
UChar* img_to_restore_from = memalign_zeroed(64, XSAVE_AREA_SIZE);
|
||||
UChar* img_to_restore_from = memalign_zeroed64(XSAVE_AREA_SIZE);
|
||||
my_memcpy(img_to_restore_from, standard_test_data, XSAVE_AREA_SIZE);
|
||||
img_to_restore_from[512] = xstate_bv;
|
||||
|
||||
/* (4a) */
|
||||
UChar* saved_img = memalign_zeroed(64, XSAVE_AREA_SIZE);
|
||||
UChar* saved_img = memalign_zeroed64(XSAVE_AREA_SIZE);
|
||||
my_memset(saved_img, 0xAA, XSAVE_AREA_SIZE);
|
||||
saved_img[512] = 0;
|
||||
|
||||
|
||||
@ -41,3 +41,19 @@ static void* memalign32(size_t szB)
|
||||
return x;
|
||||
}
|
||||
|
||||
// Allocates a 64-aligned block. Asserts if the allocation fails.
|
||||
__attribute__((unused))
|
||||
static void* memalign64(size_t szB)
|
||||
{
|
||||
void* x;
|
||||
#if defined(VGO_darwin)
|
||||
// Darwin lacks memalign
|
||||
posix_memalign((void **)&x, 64, szB);
|
||||
#else
|
||||
x = memalign(64, szB);
|
||||
#endif
|
||||
assert(x);
|
||||
assert(0 == ((64-1) & (unsigned long)x));
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user