Test "Scalable Vector Extension (SVE) support." on arm64

Change-Id: I3abaca932985a06b06887b962e769f2eac96c738
This commit is contained in:
Shiratori, Takehiro
2019-02-20 20:57:26 +09:00
committed by Masamichi Takagi
parent 6810506c3d
commit 7da5fede8b
57 changed files with 6921 additions and 0 deletions

53
test/sve/src/018.c Normal file
View File

@@ -0,0 +1,53 @@
/* 018.c COPYRIGHT FUJITSU LIMITED 2017-2019 */
/* prctl(PR_SVE_SET_VL, PR_SVE_SET_VL_THREAD) on multi thread. */
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <signal.h>
#include <errno.h>
#include "common.h"
static int sync;
static void *child_function(void *arg)
{
while (!sync) {
cpu_pause();
}
return NULL;
}
TEST_FUNC(TEST_NUMBER, vl, unused1, unused2, unused3)
{
int ret = -1;
pthread_t thread;
print_test_overview(tp_num);
if (pthread_create(&thread, NULL, child_function, NULL)) {
printf("pthread_create: error.\n");
goto out;
}
ret = set_and_compare_vl(vl);
if (ret != EINVAL) {
printf("SVE_SET_VL is not EINVAL error.\n");
goto join_out;
}
/* success */
ret = 0;
join_out:
sync = 1;
if (pthread_join(thread, NULL)) {
printf("pthread_join: error.\n");
ret = -1;
}
out:
if (ret == 0) {
printf("RESULT: OK.\n");
} else {
printf("RESULT: NG.\n");
}
return ret;
}