Rewrite i386 backend as hand-written assembly
Replaces the C fallback (borrowed from PowerPC) with dedicated i386 assembly for all nine kernels, matching the amd64/arm64 convention. Fixes two real bugs found and verified on physical Pentium 4 hardware: scalar FP silently running on x87 instead of SSE2, and fm_int_math calling __udivdi3 on every iteration of the highest-weighted test because the C compiler didn't know its 0xdeadbeef divisor fits in 32 bits. Real-hardware SINGLECORE/MULTICORE scores go from 425/448 to 539/581.
This commit is contained in:
+1344
File diff suppressed because it is too large
Load Diff
+2
-31
@@ -11,10 +11,6 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64)
|
||||
#include <emmintrin.h>
|
||||
#endif
|
||||
|
||||
#if defined(__linux__)
|
||||
#include <sys/auxv.h>
|
||||
#endif
|
||||
@@ -68,7 +64,7 @@ uint64_t fm_primes(uint64_t limit, uint8_t *sieve)
|
||||
return count;
|
||||
}
|
||||
|
||||
#if defined(__powerpc__) && !defined(__powerpc64__)
|
||||
#if !defined(__powerpc64__)
|
||||
static uint64_t fm_simd_scalar(uint64_t iters, void *memory)
|
||||
{
|
||||
uint32_t *v = (uint32_t *)memory;
|
||||
@@ -113,7 +109,7 @@ uint64_t fm_simd(uint64_t iters, void *memory)
|
||||
sum ^= v[j];
|
||||
return sum;
|
||||
}
|
||||
#elif defined(__powerpc__)
|
||||
#else
|
||||
/* These are kept in fossmark_ppc32_ext.S so this translation unit, and thus
|
||||
* the executable's default code path, only requires baseline PPC32. */
|
||||
extern void fm_simd_ps_kernel(uint64_t iters, void *memory);
|
||||
@@ -196,31 +192,6 @@ uint64_t fm_simd(uint64_t iters, void *memory)
|
||||
sum ^= v[j];
|
||||
return sum;
|
||||
}
|
||||
#else
|
||||
uint64_t fm_simd(uint64_t iters, void *memory)
|
||||
{
|
||||
__m128i a, b;
|
||||
uint32_t *v = (uint32_t *)memory;
|
||||
uint32_t sum = 0;
|
||||
uint64_t i;
|
||||
unsigned j;
|
||||
|
||||
if (!iters)
|
||||
return 0;
|
||||
a = _mm_loadu_si128((const __m128i *)v);
|
||||
b = _mm_loadu_si128((const __m128i *)(v + 4));
|
||||
for (i = 0; i < iters; i++) {
|
||||
a = _mm_add_epi32(a, b);
|
||||
b = _mm_xor_si128(b, a);
|
||||
a = _mm_add_epi32(a, b);
|
||||
b = _mm_xor_si128(b, a);
|
||||
}
|
||||
_mm_storeu_si128((__m128i *)v, a);
|
||||
_mm_storeu_si128((__m128i *)(v + 4), b);
|
||||
for (j = 0; j < 8; j++)
|
||||
sum ^= v[j];
|
||||
return sum;
|
||||
}
|
||||
#endif
|
||||
|
||||
static uint32_t load32_native(const uint8_t *p)
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@
|
||||
#ifndef FM_API_BASE_URL
|
||||
# define FM_API_BASE_URL "https://fossbench.net"
|
||||
#endif
|
||||
#define FM_VERSION "0.1.3-hotfix4"
|
||||
#define FM_VERSION "0.1.4"
|
||||
|
||||
/* ---------- platform identification (for the banner only) ---------- */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user