Commit Graph

24 Commits (2700e1b9ae066215b7ccb780078b32da88c9716c)

Author SHA1 Message Date
Brad Hubbard 2700e1b9ae Resolve cppcheck Signed integer overflow errors
The type of expression '1<<31' is signed int and this causes cppcheck to
issue the following warning.

src/gf_w32.c:681]: (error) Signed integer overflow for expression
'1<<31'.

Signed-off-by: Brad Hubbard <bhubbard@redhat.com>
2017-04-10 17:21:30 +10:00
Bassam Tabbara 4339569f14 Support for runtime SIMD detection
This commits adds support for runtime detection of SIMD instructions. The idea is that you would build once with all supported SIMD functions and the same binaries could run on different machines with varying support for SIMD. At runtime gf-complete will select the right functions based on the processor.

gf_cpu.c has the logic to detect SIMD instructions. On Intel processors this is done through cpuid. For ARM on linux we use getauxv.

The logic in gf_w*.c has been changed to check for runtime SIMD support and fallback to generic code.

Also a new test has been added. It compares the functions selected by gf_init when we enable/disable SIMD support through build flags, with runtime enabling/disabling. The test checks if the results are identical.
2016-09-13 12:24:25 -07:00
Bassam Tabbara 87f0d4395d Add support for printing functions selected in gf_init
There is currently no way to figure out which functions were selected
during gf_init and as a result of SIMD options. This is not even possible
in gdb since most functions are static.

This commit adds a new macro SET_FUNCTION that records the name of the
function selected during init inside the gf_internal structure. This macro
only works when DEBUG_FUNCTIONS is defined during compile. Otherwise the
code works exactly as it did before this change.

The names of selected functions will be used during testing of SIMD
runtime detection.

All calls such as:

gf->multiply.w32 = gf_w16_shift_multiply;

need to be replaced with the following:

SET_FUNCTION(gf,multiply,w32,gf_w16_shift_multiply)

Also added a new flag to tools/gf_methods that will print the names of
functions selected during gf_init.
2016-09-13 12:24:25 -07:00
Loic Dachary d1b6bbf706 add -Wsign-compare and address the warnings
* (1 << w) are changed into ((uint32_t)1 << w)
* int are changed into uint32_t

gf.c: gf_composite_get_default_poly:

   a larger unsigned were assigned to unsigned integers in which case
   the type of the assigned variable is changed to be the same as the
   value assigned to it.

gf_w16.c: GF_MULTBY_TWO

   setting the parameter to a variable instead of passing the expression
   resolves the warning for some reason.

Signed-off-by: Loic Dachary <loic@dachary.org>
2015-09-02 19:20:33 +02:00
Danny Al-Gaaf 7972291e1f src/gf_w128.c: remove dead code and unused variable
Fix for Coverity issue:

CID 1297812 (#1 of 1): Constant variable guards dead code (DEADCODE)
 dead_error_begin: Execution cannot reach this statement: fprintf(stderr,
  "Code conta....
 Local variable no_default_flag is assigned only once, to a constant
  value, making it effectively constant throughout its scope. If this
  is not the intent, examine the logic to see if there is a missing
  assignment that would make no_default_flag not remain constant.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2015-06-17 10:46:44 +02:00
Janne Grunau 568df90edc simd: rename the region flags from SSE to SIMD
SSE is not the only supported SIMD instruction set. Keep the old names
for backward compatibility.
2014-10-09 23:22:32 +02:00
Danny Al-Gaaf eb3bb91d84 gf_w128.c: remove some dead assignments
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
2014-05-14 16:00:05 +02:00
Loic Dachary a0ae760ed3 prefer uint8_t to char in pointer arithmetic
Signed-off-by: Loic Dachary <loic@dachary.org>
2014-04-10 17:21:38 +02:00
Kevin Greenan 4c84a3b650 Merged in dachary/gf-complete/wip-compilation-warnings (pull request #12)
fix void* arithmetic compilation warning
2014-03-31 08:53:14 -07:00
Loic Dachary d569220629 do not compile if used in SSE4 code path only
Acknowledge that gf_w128_split_4_128_multiply_region and
gf_w128_split_4_128_sse_multiply_region are only used when the
INTEL_SSE4 flag is present, even though they only need INTEL_SSSE3

It suppresses a compilation warning complaining about them not being
used if INTEL_SSE4 is absent and INTEL_SSSE3 is present.

Signed-off-by: Loic Dachary <loic@dachary.org>
2014-03-30 00:06:48 +01:00
Loic Dachary ce61fb053d fix void* arithmetic compilation warning
Signed-off-by: Loic Dachary <loic@dachary.org>
2014-03-29 23:51:34 +01:00
Loic Dachary 20a242d9dd remove unused static function gf_w128_group_r_sse_init
Signed-off-by: Loic Dachary <loic@dachary.org>
2014-03-28 16:06:29 +01:00
Loic Dachary 191b86b5d2 remove unused variables from #if SSE blocs
Signed-off-by: Loic Dachary <loic@dachary.org>
2014-03-06 17:48:38 +01:00
Loic Dachary 29899ad443 move #if to avoid unused warning
Signed-off-by: Loic Dachary <loic@dachary.org>
2014-03-06 17:32:30 +01:00
Loic Dachary 0020ff8092 initialize pointer early in the function
otherwise it may be used uninitialized

Signed-off-by: Loic Dachary <loic@dachary.org>
2014-03-06 17:29:58 +01:00
Loic Dachary d36bd6e540 cast void* to char* for pointer arithmetic
Signed-off-by: Loic Dachary <loic@dachary.org>
2014-03-06 17:29:36 +01:00
Loic Dachary f043479e3c remove unused variables
In some places move variables in the scope of the CPP define where they
are used.

Signed-off-by: Loic Dachary <loic@dachary.org>
2014-03-06 15:15:22 +01:00
Jim Plank f0c32c94bc Removed GROUP/128/SSE. It wasn't compiling, and it needed an overhaul.
I'll do it someday when I'm bored.
2014-01-01 11:00:40 -05:00
Jim Plank fb0bbdcf62 Fixed the problem with PCLMUL and gf_complete.h. Removed
ARCH_64 from everything but 128/GROUP/SSE.  Fortunately, no
one ever uses that.
2013-12-31 20:08:18 -05:00
Kevin Greenan 5687b9c2cc Third.1 time's a charm (autoconf non-sense for PCLMUL). 2013-12-30 22:50:04 -08:00
Kevin Greenan 137b7ccd75 Revert "Third time's a charm (autoconf non-sense for PCLMUL)."
The commit was not successfully pushed (not sure what happened).

This reverts commit 762926920a.
2013-12-30 22:40:18 -08:00
Kevin Greenan 762926920a Third time's a charm (autoconf non-sense for PCLMUL). 2013-12-30 21:26:47 -08:00
Kevin Greenan ef18bccc3a Group for w=128 was failing because SSE4 is enabled, but not ARCH_64 (on my Linux VM). Ensure that both are defined
when init'ing group for w=128.
2013-12-10 09:00:32 -08:00
Kevin Greenan 153dd20988 Setting up autoconf/automake for GF-Complete
Also re-organized the directory structure.

Signed-off-by: Kevin Greenan <kmgreen2@gmail.com>
2013-12-04 21:24:29 -08:00