From a1e2f8344fb02660a329f20963a78a4fe1639423 Mon Sep 17 00:00:00 2001 From: Ryan Crosby Date: Wed, 1 Aug 2018 14:49:52 +1000 Subject: [PATCH 1/2] Added SSE version check for MSC --- spectre.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/spectre.c b/spectre.c index 2f1ce8d..f7985a7 100644 --- a/spectre.c +++ b/spectre.c @@ -19,13 +19,20 @@ #pragma optimize("gt",on) #else #include /* for rdtsc, rdtscp, clflush */ +#endif /* ifdef _MSC_VER */ /* Automatically detect if SSE2 is not available when SSE is advertized */ -#if defined(__SSE__) && !defined(__SSE2__) +#ifdef _MSC_VER +/* MSC */ +#if _M_IX86_FP==1 #define NOSSE2 #endif - +#else +/* Not MSC */ +#if defined(__SSE__) && !defined(__SSE2__) +#define NOSSE2 #endif +#endif /* ifdef _MSC_VER */ #ifdef NOSSE2 #define NORDTSCP From 0b5a9c3dfc48c515de3384b0e8aca5b3822b287c Mon Sep 17 00:00:00 2001 From: Ryan Crosby Date: Wed, 1 Aug 2018 15:03:50 +1000 Subject: [PATCH 2/2] Updated README.md --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 19ae1ac..dc0a48e 100644 --- a/README.md +++ b/README.md @@ -95,9 +95,12 @@ To build the project without all of the above instructions introduced with SSE2, `CFLAGS=-DNOSSE2 make` -This flag is automatically enabled if the `__SSE__` flag is present but `__SSE2__` is absent. +`NOSSE2` is automatically enabled if the `__SSE__` flag is present but `__SSE2__` is absent. This means `NOSSE2` shouldn't need to be manually specified when compiling on Clang or GCC on non-SSE2 processors. +On MSC, `NOSSE2` is automatically enabled if the `_M_IX86_FP` flag is set to `1` (indicating SSE support, but no SSE2 support). +MSC will set this by default for all x86 processors. + #### 'Target specific option mismatch' error Some 32-bit versions of gcc (e.g. the version used in Ubuntu 14.04) may show the following error while compiling the PoC: