mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-07 06:53:33 +00:00
Make some code build faster
This commit is contained in:
parent
5dd7ddb9ea
commit
4a1ae86124
2 changed files with 18 additions and 27 deletions
|
@ -44,7 +44,7 @@ o/$(MODE)/test/libcxx/%.dbg: \
|
||||||
|
|
||||||
$(TEST_LIBCXX_OBJS): private OVERRIDE_CXXFLAGS += -fexceptions -frtti
|
$(TEST_LIBCXX_OBJS): private OVERRIDE_CXXFLAGS += -fexceptions -frtti
|
||||||
|
|
||||||
o/$(MODE)/test/libcxx/openmp_test.o: private CXXFLAGS += -fopenmp
|
o/$(MODE)/test/libcxx/openmp_test.o: private CXXFLAGS += -fopenmp -O3
|
||||||
o/$(MODE)/test/libcxx/openmp_test.runs: private QUOTA += -C100
|
o/$(MODE)/test/libcxx/openmp_test.runs: private QUOTA += -C100
|
||||||
|
|
||||||
.PHONY: o/$(MODE)/test/libcxx
|
.PHONY: o/$(MODE)/test/libcxx
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include "libc/stdio/rand.h"
|
#include "libc/stdio/rand.h"
|
||||||
|
|
||||||
#define PRECISION 2e-6
|
#define PRECISION 2e-5
|
||||||
#define LV1DCACHE 49152
|
#define LV1DCACHE 49152
|
||||||
#define THRESHOLD 3000000
|
#define THRESHOLD 3000000
|
||||||
|
|
||||||
|
@ -37,17 +37,6 @@
|
||||||
#define OPTIMIZED __attribute__((__optimize__("-O3,-ffast-math")))
|
#define OPTIMIZED __attribute__((__optimize__("-O3,-ffast-math")))
|
||||||
#define PORTABLE \
|
#define PORTABLE \
|
||||||
__target_clones("arch=znver4," \
|
__target_clones("arch=znver4," \
|
||||||
"arch=znver3," \
|
|
||||||
"arch=sapphirerapids," \
|
|
||||||
"arch=alderlake," \
|
|
||||||
"arch=rocketlake," \
|
|
||||||
"arch=cooperlake," \
|
|
||||||
"arch=tigerlake," \
|
|
||||||
"arch=cascadelake," \
|
|
||||||
"arch=skylake-avx512," \
|
|
||||||
"arch=skylake," \
|
|
||||||
"arch=znver1," \
|
|
||||||
"arch=tremont," \
|
|
||||||
"fma," \
|
"fma," \
|
||||||
"avx")
|
"avx")
|
||||||
|
|
||||||
|
@ -360,15 +349,17 @@ long micros(void) {
|
||||||
|
|
||||||
#define bench(x) \
|
#define bench(x) \
|
||||||
do { \
|
do { \
|
||||||
long t1 = micros(); \
|
int N = 10; \
|
||||||
for (long i = 0; i < ITERATIONS; ++i) { \
|
long long t1 = micros(); \
|
||||||
|
for (long long i = 0; i < N; ++i) { \
|
||||||
asm volatile("" ::: "memory"); \
|
asm volatile("" ::: "memory"); \
|
||||||
x; \
|
x; \
|
||||||
asm volatile("" ::: "memory"); \
|
asm volatile("" ::: "memory"); \
|
||||||
} \
|
} \
|
||||||
long t2 = micros(); \
|
long long t2 = micros(); \
|
||||||
printf("%8" PRId64 " µs %s\n", (t2 - t1 + ITERATIONS - 1) / ITERATIONS, \
|
printf("%8lld µs %2dx n=%5d m=%5d k=%5d %s %g gigaflops\n", \
|
||||||
#x); \
|
(t2 - t1 + N - 1) / N, N, (int)n, (int)m, (int)k, #x, \
|
||||||
|
1e6 / ((t2 - t1 + N - 1) / N) * m * n * k * 1e-9); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
double real01(unsigned long x) { // (0,1)
|
double real01(unsigned long x) { // (0,1)
|
||||||
|
|
Loading…
Reference in a new issue