Author: Michael R. Crusoe <michael.crusoe@gmail.com>
Description: Enable buidling on non-AMD64
--- plink2.orig/include/plink2_base.h
+++ plink2/include/plink2_base.h
@@ -134,14 +134,8 @@
 #endif
 
 #ifdef __LP64__
-#  ifndef __SSE2__
-// possible todo: remove this requirement, the 32-bit VecW-using code does most
-// of what we need.  But little point in doing this before we have e.g. an
-// ARM-based machine to test with that scientists would plausibly want to run
-// plink2 on.
-#    error "64-bit builds currently require SSE2.  Try producing a 32-bit build instead."
-#  endif
-#  include <emmintrin.h>
+#  define SIMDE_ENABLE_NATIVE_ALIASES
+#  include <simde/x86/sse2.h>
 #  ifdef __SSE4_2__
 #    define USE_SSE42
 #    include <smmintrin.h>
--- plink2.orig/Makefile
+++ plink2/Makefile
@@ -6,7 +6,7 @@
 
 # Does not currently support -DCPU_CHECK_...
 
-BASEFLAGS=-g -mavx2 -mbmi -mbmi2 -mlzcnt -DZSTD_MULTITHREAD
+BASEFLAGS=-g -DZSTD_MULTITHREAD
 # BASEFLAGS=-g -msse4.2 -DZSTD_MULTITHREAD
 # BASEFLAGS=-g -DZSTD_MULTITHREAD
 
--- plink2.orig/include/SFMT.h
+++ plink2/include/SFMT.h
@@ -129,7 +129,8 @@
   128-bit SIMD like data type for standard C
   ------------------------------------------*/
 #ifdef __LP64__
-  #include <emmintrin.h>
+  #define SIMDE_ENABLE_NATIVE_ALIASES
+  #include <simde/x86/sse2.h>
 
 /** 128-bit data structure */
 union W128_T {
--- plink2.orig/plink2.cc
+++ plink2/plink2.cc
@@ -3067,7 +3067,7 @@
 #ifdef __APPLE__
   fesetenv(FE_DFL_DISABLE_SSE_DENORMS_ENV);
 #else
-#  ifdef __LP64__
+#  if defined __LP64__ && defined __x86_64__
   _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
 #  endif
 #endif
--- plink2.orig/build_dynamic/Makefile
+++ plink2/build_dynamic/Makefile
@@ -141,17 +141,19 @@
   CXXFLAGS += -Wno-sign-compare
 endif
 
-all: plink2 pgen_compress
+SFX ?= ""
 
-plink2: $(CSRC2) $(ZCSRC2) $(CCSRC2) ../plink2_cpu.cc
+all: plink2$(SFX) pgen_compress$(SFX)
+
+plink2$(SFX): $(CSRC2) $(ZCSRC2) $(CCSRC2) ../plink2_cpu.cc
 	gcc $(CPPFLAGS) $(CFLAGS) $(CSRC2) -c
 	$(SKIP_STATIC_ZSTD) gcc $(ZCFLAGS) $(ZCSRC2) -c
 	g++ $(CPPFLAGS) $(CXXFLAGS) $(CCSRC2) -c
 	g++ $(CPUCHECK_FLAGS) $(CXXFLAGS) $(CPPFLAGS) ../plink2_cpu.cc -c
-	g++ $(OBJ2) plink2_cpu.o $(ARCH32) -o plink2 $(BLASFLAGS) $(LINKFLAGS) $(LDFLAGS)
+	g++ $(OBJ2) plink2_cpu.o $(ARCH32) -o plink2$(SFX) $(BLASFLAGS) $(LINKFLAGS) $(LDFLAGS)
 
-pgen_compress: $(PGCSRC2)
-	g++ $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(PGCSRC2) -o pgen_compress
+pgen_compress$(SFX): $(PGCSRC2)
+	g++ $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(PGCSRC2) -o pgen_compress$(SFX)
 
 .PHONY: clean
 clean:
