From 3499f9c879d177f8215dbf610cd58aa7dd4cf727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ada=20Gottenstr=C3=A4ter?= Date: Wed, 20 Apr 2022 17:57:06 +0200 Subject: [PATCH] Optimize some more --- Makefile | 2 +- debug.c | 2 +- pasmsim.c | 4 ++++ spininterp.c | 19 ++++--------------- 4 files changed, 10 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 33e4573..0860477 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ OBJECTS = $(patsubst %,$(BUILD)/%, $(SOURCES:.c=.o)) # commented them out for the time being #LDFLAGS = -Wl,--relax -Wl,--gc-sections LDFLAGS = -lm -OPT := -O3 -flto -fno-fat-lto-objects +OPT := -O3 -flto -fno-fat-lto-objects -march=native CFLAGS = -c -g -Wall -Wno-format $(OPT) -D LINUX all: directory $(SOURCES) $(OBJECTS) Makefile diff --git a/debug.c b/debug.c index a208656..2c237a2 100755 --- a/debug.c +++ b/debug.c @@ -247,7 +247,7 @@ int32_t RunProp(int32_t maxloops) while (runflag && (maxloops < 0 || loopcount < maxloops)) { runflag = step_chip(); - CheckCommand(); + //CheckCommand(); if (baudrate) { CheckSerialOut(&serial_out); diff --git a/pasmsim.c b/pasmsim.c index 019a4a1..f401012 100755 --- a/pasmsim.c +++ b/pasmsim.c @@ -28,12 +28,16 @@ void PrintResults(int32_t zcri, int32_t zflag, int32_t cflag, int32_t result) static int32_t parity(int32_t val) { +#if 0 val ^= val >> 16; val ^= val >> 8; val ^= val >> 4; val ^= val >> 2; val ^= val >> 1; return val & 1; +#else + return __builtin_parity(val); +#endif } static int32_t abs(int32_t val) diff --git a/spininterp.c b/spininterp.c index 5c6e94f..e0a6071 100755 --- a/spininterp.c +++ b/spininterp.c @@ -37,21 +37,10 @@ int32_t MAP_ADDR(int32_t addr) { if ((addr & 0xfffffff0) == 0x12340000) { - addr = memsize + (addr & 15); - } - else if (memsize == 65536) - { - addr &= 0xffff; - } - else if (((uint32_t)addr) >= memsize) - { -#if 0 - fprintf(tracefile, "MAP_ADDR(%d): address out of bounds %8.8x\n", loopcount, addr); - addr = memsize + 12; -#else - addr &= memsize - 1; -#endif - } + addr = memsize + (addr & 15); + } else { + addr &= memsize - 1; + } //fprintf(tracefile, "MAP_ADDR: %8.8x %8.8x\n", addr, ((uint32_t *)hubram)[addr>>2]); return addr;