From 1b43d13ba6c9c73be4cfabcf4b899fc02b368fea Mon Sep 17 00:00:00 2001 From: Agbar Date: Fri, 27 Oct 2017 18:46:04 +0200 Subject: [PATCH 001/154] Use [[fallthrough]] attribute in GCC 7 --- code_blocks/libEnigma/libEnigma.cbp | 1 + libEnigma/include/global.h | 6 ++++++ libEnigma/include/x86/cipherSsse3_inlines.h | 3 +++ libEnigma/src/x86/scoreAvx2.c | 4 ++++ tests/enigma-optima.tests.cbp | 1 + 5 files changed, 15 insertions(+) diff --git a/code_blocks/libEnigma/libEnigma.cbp b/code_blocks/libEnigma/libEnigma.cbp index 99d56d1..1389697 100644 --- a/code_blocks/libEnigma/libEnigma.cbp +++ b/code_blocks/libEnigma/libEnigma.cbp @@ -75,6 +75,7 @@ + diff --git a/libEnigma/include/global.h b/libEnigma/include/global.h index d6ed0be..8effdb6 100644 --- a/libEnigma/include/global.h +++ b/libEnigma/include/global.h @@ -45,6 +45,12 @@ enum { SW_ONSTART, SW_OTHER, SW_ALL, SW_NONE, SINGLE_KEY }; #define UNUSED __attribute__ ((unused)) #define NO_INLINE __attribute__ ((noinline)) +#if __GNUC__ >= 7 +# define FALLTHROUGH() __attribute__((fallthrough)) +#else +# define FALLTHROUGH() +#endif + #define UNREACHABLE() __builtin_unreachable() diff --git a/libEnigma/include/x86/cipherSsse3_inlines.h b/libEnigma/include/x86/cipherSsse3_inlines.h index 4781ee4..22c835d 100644 --- a/libEnigma/include/x86/cipherSsse3_inlines.h +++ b/libEnigma/include/x86/cipherSsse3_inlines.h @@ -78,10 +78,13 @@ void DecodeScoredMessagePartSsse3( const Key* const restrict key, int len, union switch( lookupsToNextBite ) { case 4: cBite = DecodeBiteMaskedPartSsse3( predecoded, lookupNumber - 4 ); + FALLTHROUGH(); case 3: cBite |= DecodeBiteMaskedPartSsse3( predecoded, lookupNumber - 3 ); + FALLTHROUGH(); case 2: cBite |= DecodeBiteMaskedPartSsse3( predecoded, lookupNumber - 2 ); + FALLTHROUGH(); case 1: cBite |= DecodeBiteMaskedPartSsse3( predecoded, lookupNumber - 1 ); break; diff --git a/libEnigma/src/x86/scoreAvx2.c b/libEnigma/src/x86/scoreAvx2.c index 216e52b..70892b4 100644 --- a/libEnigma/src/x86/scoreAvx2.c +++ b/libEnigma/src/x86/scoreAvx2.c @@ -54,12 +54,16 @@ static void DecodeScoredMessagePartAvx2( const Key* const restrict key, int len, switch( lookupsToNextBite ) { case 5: cBite = DecodeBiteMaskedPartAvx2( predecoded, lookupNumber - 5 ); + FALLTHROUGH(); case 4: cBite |= DecodeBiteMaskedPartAvx2( predecoded, lookupNumber - 4 ); + FALLTHROUGH(); case 3: cBite |= DecodeBiteMaskedPartAvx2( predecoded, lookupNumber - 3 ); + FALLTHROUGH(); case 2: cBite |= DecodeBiteMaskedPartAvx2( predecoded, lookupNumber - 2 ); + FALLTHROUGH(); case 1: cBite |= DecodeBiteMaskedPartAvx2( predecoded, lookupNumber - 1 ); break; diff --git a/tests/enigma-optima.tests.cbp b/tests/enigma-optima.tests.cbp index ab67f57..3e795ae 100644 --- a/tests/enigma-optima.tests.cbp +++ b/tests/enigma-optima.tests.cbp @@ -51,6 +51,7 @@ + From 75bb975df49cefa36a387642d76fea97f6e76ab1 Mon Sep 17 00:00:00 2001 From: Agbar Date: Sat, 28 Oct 2017 12:11:36 +0200 Subject: [PATCH 002/154] Create enigma-optima.benchmark.cbp with preliminary configuration --- .../benchmark/enigma-optima.benchmark.cbp | 70 +++++++++++++++++++ enigma-optima.workspace | 7 +- 2 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 code_blocks/benchmark/enigma-optima.benchmark.cbp diff --git a/code_blocks/benchmark/enigma-optima.benchmark.cbp b/code_blocks/benchmark/enigma-optima.benchmark.cbp new file mode 100644 index 0000000..baf0062 --- /dev/null +++ b/code_blocks/benchmark/enigma-optima.benchmark.cbp @@ -0,0 +1,70 @@ + + + + + + diff --git a/enigma-optima.workspace b/enigma-optima.workspace index 8991fc5..cbe4b69 100644 --- a/enigma-optima.workspace +++ b/enigma-optima.workspace @@ -1,12 +1,15 @@ - + + - + + + From 96a4a533528f91cd4032c7b6f80e6ca512bbc2c7 Mon Sep 17 00:00:00 2001 From: Agbar Date: Sat, 28 Oct 2017 16:44:46 +0200 Subject: [PATCH 003/154] Add compiler options to reference libEnigma and Google Benchmark --- code_blocks/benchmark/enigma-optima.benchmark.cbp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/code_blocks/benchmark/enigma-optima.benchmark.cbp b/code_blocks/benchmark/enigma-optima.benchmark.cbp index baf0062..0c04071 100644 --- a/code_blocks/benchmark/enigma-optima.benchmark.cbp +++ b/code_blocks/benchmark/enigma-optima.benchmark.cbp @@ -17,6 +17,8 @@ + + @@ -31,6 +33,8 @@ + + @@ -45,6 +49,8 @@ + + @@ -57,9 +63,13 @@ + + + + From 0083c7eacfaf125c0354aeaa4daef817a484fa2c Mon Sep 17 00:00:00 2001 From: Agbar Date: Sat, 28 Oct 2017 18:31:57 +0200 Subject: [PATCH 004/154] Ignore benchmark binary output files --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index d62c06b..c750fab 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,6 @@ enigma-optima.workspace.layout code_blocks/.cccc code_blocks/libEnigma/libEnigma\.depend + +/code_blocks/benchmark/obj/ +/code_blocks/benchmark/bin/ From 5307dd02d477e1c9233a0a4f0e6c1e59d3855933 Mon Sep 17 00:00:00 2001 From: Agbar Date: Sat, 28 Oct 2017 18:34:25 +0200 Subject: [PATCH 005/154] Include score.h in scoreBasic.h --- libEnigma/include/score.h | 5 +---- libEnigma/include/scoreBasic.h | 7 +++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/libEnigma/include/score.h b/libEnigma/include/score.h index 1d7696e..054a2ed 100644 --- a/libEnigma/include/score.h +++ b/libEnigma/include/score.h @@ -1,5 +1,4 @@ -#ifndef SCORE_H -#define SCORE_H +#pragma once #include #include @@ -80,8 +79,6 @@ void DecodeScoredMessagePartStandard(const Key* const restrict key, int len, uni bool GetDifferences( union ScoringDecodedMessage* restrict reference, union ScoringDecodedMessage* restrict tested, char* restrict output, int len ); -#endif - /* * This file is part of enigma-suite-0.76, which is distributed under the terms * of the General Public License (GPL), version 2. See doc/COPYING for details. diff --git a/libEnigma/include/scoreBasic.h b/libEnigma/include/scoreBasic.h index e33d0c7..952343c 100644 --- a/libEnigma/include/scoreBasic.h +++ b/libEnigma/include/scoreBasic.h @@ -1,9 +1,8 @@ -#ifndef ENIGMA_SCORE_OPTIMIZED_HEADER_INCLUDED -#define ENIGMA_SCORE_OPTIMIZED_HEADER_INCLUDED +#pragma once + +#include "score.h" /** \brief Uses optimized version of original code. Gives minor performance improvement. */ extern enigma_score_function_t enigmaScoreBasic; extern union ScoringDecodedMessage decodedMsgPartBasic; - -#endif From 37890a779ac13722b7c6b76e081fa25d3bd6cc84 Mon Sep 17 00:00:00 2001 From: Agbar Date: Sun, 29 Oct 2017 01:27:27 +0200 Subject: [PATCH 006/154] Adjust output executable name to enigma-optima-benchmark --- code_blocks/benchmark/enigma-optima.benchmark.cbp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code_blocks/benchmark/enigma-optima.benchmark.cbp b/code_blocks/benchmark/enigma-optima.benchmark.cbp index 0c04071..9d328fd 100644 --- a/code_blocks/benchmark/enigma-optima.benchmark.cbp +++ b/code_blocks/benchmark/enigma-optima.benchmark.cbp @@ -7,7 +7,7 @@