Changeset View
Changeset View
Standalone View
Standalone View
tools/test/xregs_sig/xregs_sig.c
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | struct xregs_bank { | ||||
const char *b_name; | const char *b_name; | ||||
const char *r_name; | const char *r_name; | ||||
uint32_t regs; | uint32_t regs; | ||||
uint32_t bytes; | uint32_t bytes; | ||||
void (*x2c)(uint8_t *); | void (*x2c)(uint8_t *); | ||||
void (*c2x)(uint8_t *); | void (*c2x)(uint8_t *); | ||||
}; | }; | ||||
int xregs_banks_max(void); | |||||
#if defined(__amd64__) | #if defined(__amd64__) | ||||
void cpu_to_xmm(uint8_t *); | void cpu_to_xmm(uint8_t *); | ||||
void xmm_to_cpu(uint8_t *); | void xmm_to_cpu(uint8_t *); | ||||
void cpu_to_avx(uint8_t *); | |||||
void avx_to_cpu(uint8_t *); | |||||
static const struct xregs_bank xregs_banks[] = { | static const struct xregs_bank xregs_banks[] = { | ||||
{ | { | ||||
.b_name = "SSE", | .b_name = "SSE", | ||||
.r_name = "xmm", | .r_name = "xmm", | ||||
.regs = 16, | .regs = 16, | ||||
.bytes = 16, | .bytes = 16, | ||||
.x2c = xmm_to_cpu, | .x2c = xmm_to_cpu, | ||||
.c2x = cpu_to_xmm, | .c2x = cpu_to_xmm, | ||||
}, | }, | ||||
{ | |||||
.b_name = "AVX", | |||||
.r_name = "ymm", | |||||
.regs = 16, | |||||
.bytes = 32, | |||||
.x2c = avx_to_cpu, | |||||
.c2x = cpu_to_avx, | |||||
}, | |||||
}; | }; | ||||
#elif defined(__aarch64__) | #elif defined(__aarch64__) | ||||
void cpu_to_vfp(uint8_t *); | void cpu_to_vfp(uint8_t *); | ||||
void vfp_to_cpu(uint8_t *); | void vfp_to_cpu(uint8_t *); | ||||
static const struct xregs_bank xregs_banks[] = { | static const struct xregs_bank xregs_banks[] = { | ||||
{ | { | ||||
.b_name = "VFP", | .b_name = "VFP", | ||||
▲ Show 20 Lines • Show All 116 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
int | int | ||||
main(void) | main(void) | ||||
{ | { | ||||
struct sigaction sa; | struct sigaction sa; | ||||
int error, i, ncpu, bank; | int error, i, ncpu, bank; | ||||
max_bank_idx = 0; | max_bank_idx = xregs_banks_max(); | ||||
bzero(&sa, sizeof(sa)); | bzero(&sa, sizeof(sa)); | ||||
sa.sa_handler = sigalrm_handler; | sa.sa_handler = sigalrm_handler; | ||||
if (sigaction(SIGALRM, &sa, NULL) == -1) { | if (sigaction(SIGALRM, &sa, NULL) == -1) { | ||||
fprintf(stderr, "sigaction SIGALRM %s\n", strerror(errno)); | fprintf(stderr, "sigaction SIGALRM %s\n", strerror(errno)); | ||||
exit(1); | exit(1); | ||||
} | } | ||||
Show All 40 Lines |