From 83ed3f519de9929b6551b98677047228a8ab4d0c Mon Sep 17 00:00:00 2001 From: Yunsup Lee Date: Mon, 14 Apr 2014 21:15:15 -0700 Subject: commit high-performance mm (scalar and vector versions) --- benchmarks/common/crt.S | 17 ++++++----------- benchmarks/common/syscalls.c | 7 +++++-- benchmarks/common/util.h | 8 +++----- 3 files changed, 14 insertions(+), 18 deletions(-) (limited to 'benchmarks/common') diff --git a/benchmarks/common/crt.S b/benchmarks/common/crt.S index b273900..82cad93 100644 --- a/benchmarks/common/crt.S +++ b/benchmarks/common/crt.S @@ -8,14 +8,6 @@ # define SREG sw #endif - .data - .globl _heapend - .globl environ -_heapend: - .word 0 -environ: - .word 0 - .text .globl _start @@ -62,10 +54,13 @@ _start: li a0, SR_EF | SR_EA csrs status, a0 - ## if that didn't stick, we don't have an FPU, so don't initialize it csrr t0, status - and t0, t0, SR_EF - beqz t0, 1f + and t1, t0, SR_EA + sw t1, have_vec, t2 + + ## if that didn't stick, we don't have an FPU, so don't initialize it + and t1, t0, SR_EF + beqz t1, 1f fssr x0 fmv.s.x f0, x0 diff --git a/benchmarks/common/syscalls.c b/benchmarks/common/syscalls.c index a168ebf..e9f04e2 100644 --- a/benchmarks/common/syscalls.c +++ b/benchmarks/common/syscalls.c @@ -8,6 +8,9 @@ #define SYS_stats 1234 +// initialized in crt.S +int have_vec; + static long handle_frontend_syscall(long which, long arg0, long arg1, long arg2) { volatile uint64_t magic_mem[8] __attribute__((aligned(64))); @@ -150,8 +153,8 @@ void _init(int cid, int nc) #undef putchar int putchar(int ch) { - static char buf[64] __attribute__((aligned(64))); - static int buflen = 0; + static __thread char buf[64] __attribute__((aligned(64))); + static __thread int buflen = 0; buf[buflen++] = ch; diff --git a/benchmarks/common/util.h b/benchmarks/common/util.h index 7c2a048..6c4f963 100644 --- a/benchmarks/common/util.h +++ b/benchmarks/common/util.h @@ -31,6 +31,8 @@ static void setStats(int enable) {} extern void setStats(int enable); #endif +extern int have_vec; + #define static_assert(cond) switch(0) { case 0: case !!(long)(cond): ; } static void printArray(const char name[], int n, const int arr[]) @@ -87,11 +89,7 @@ static int verifyDouble(int n, const volatile double* test, const double* verify return 0; } -#ifndef ncores -#define ncores 1 -#endif - -static void __attribute__((noinline)) barrier() +static void __attribute__((noinline)) barrier(int ncores) { static volatile int sense; static volatile int count; -- cgit v1.1