diff --git a/code/Makefile b/code/Makefile index 3f39c47b..1302c7bb 100644 --- a/code/Makefile +++ b/code/Makefile @@ -1,6 +1,7 @@ SRCS=$(wildcard *.cpp) HDRS=$(wildcard *.h) EXES=$(patsubst %.cpp,%,$(SRCS)) +CXX?=g++ all: $(EXES) @@ -11,4 +12,4 @@ clean: rm -rf $(EXES) %: %.cpp $(HDRS) - g++ $< -mlsx -mlasx -o $@ + $(CXX) $< -mlsx -mlasx -o $@ diff --git a/code/common.h b/code/common.h index 852d2a1f..aa6ab7f2 100644 --- a/code/common.h +++ b/code/common.h @@ -14,6 +14,10 @@ typedef uint32_t u32; typedef int64_t s64; typedef uint64_t u64; +#ifndef MACHINE_3C5000 +#define MACHINE_3C5000 0 +#endif + union v128 { __m128i m128i; __m128 m128; diff --git a/code/vshuf_b.h b/code/vshuf_b.h index 34699718..6324868f 100644 --- a/code/vshuf_b.h +++ b/code/vshuf_b.h @@ -1,6 +1,6 @@ for (int i = 0; i < 16; i++) { - if (c.byte[i] >= 64) { - // Caveat: observed in 3C5000, but not in QEMU + if (c.byte[i] >= 64 && MACHINE_3C5000) { + // Caveat: observed in 3C5000 dst.byte[i] = 0; } else if ((c.byte[i] % 32) < 16) { dst.byte[i] = b.byte[c.byte[i] % 16]; diff --git a/code/vshuf_d.h b/code/vshuf_d.h index a7f76c2f..9be70c57 100644 --- a/code/vshuf_d.h +++ b/code/vshuf_d.h @@ -1,6 +1,6 @@ for (int i = 0; i < 2; i++) { - if ((a.dword[i] % 256) >= 64) { - // Caveat: observed in 3C5000, but not in QEMU + if ((a.dword[i] % 256) >= 64 && MACHINE_3C5000) { + // Caveat: observed in 3C5000 dst.dword[i] = 0; } else if ((a.dword[i] % 4) < 2) { dst.dword[i] = c.dword[a.dword[i] % 2]; diff --git a/code/vshuf_h.h b/code/vshuf_h.h index afc24bef..9b6d7dc5 100644 --- a/code/vshuf_h.h +++ b/code/vshuf_h.h @@ -1,6 +1,6 @@ for (int i = 0; i < 8; i++) { - if ((a.half[i] % 256) >= 64) { - // Caveat: observed in 3C5000, but not in QEMU + if ((a.half[i] % 256) >= 64 && MACHINE_3C5000) { + // Caveat: observed in 3C5000 dst.half[i] = 0; } else if ((a.half[i] % 16) < 8) { dst.half[i] = c.half[a.half[i] % 8]; diff --git a/code/vshuf_w.h b/code/vshuf_w.h index d6cc59af..f2e2b943 100644 --- a/code/vshuf_w.h +++ b/code/vshuf_w.h @@ -1,6 +1,6 @@ for (int i = 0; i < 4; i++) { - if ((a.word[i] % 256) >= 64) { - // Caveat: observed in 3C5000, but not in QEMU + if ((a.word[i] % 256) >= 64 && MACHINE_3C5000) { + // Caveat: observed in 3C5000 dst.word[i] = 0; } else if ((a.word[i] % 8) < 4) { dst.word[i] = c.word[a.word[i] % 4];