core/conv: do not mix up AVX and SSE code

According to GCC's wiki:

If you specify command-line switches such as -msse, the compiler
could use the extended instruction sets even if the built-ins are
not used explicitly in the program. For this reason, applications
that perform run-time CPU detection must compile separate files
for each supported architecture, using the appropriate flags. In
particular, the file containing the CPU detection code should be
compiled without these options.

So, this change introduces a separate Viterbi implementation,
which is almost the same as previous one, but is being compiled
with -mavx2. This implementation will be only used by CPUs with
both SSE and AVX support:

SSE3 and AVX2: viterbi_sse_avx.c
SSE3 only: viterbi_sse.c
Generic: viterbi_generic.c

Change-Id: I042cc76258df7e4c6c90a73af3d0a6e75999b2b0
diff --git a/src/Makefile.am b/src/Makefile.am
index e3a0f00..e98c623 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -25,11 +25,24 @@
 
 if HAVE_SSE3
 libosmocore_la_SOURCES += viterbi_sse.c
-# Per-object flags hack
-viterbi_sse.lo : CFLAGS += $(SIMD_FLAGS)
+if HAVE_SSE4_1
+viterbi_sse.lo : CFLAGS += -msse3 -msse4.1
+else
+viterbi_sse.lo : CFLAGS += -msse3
+endif
+
+if HAVE_AVX2
+libosmocore_la_SOURCES += viterbi_sse_avx.c
+if HAVE_SSE4_1
+viterbi_sse_avx.lo : CFLAGS += -msse3 -mavx2 -msse4.1
+else
+viterbi_sse_avx.lo : CFLAGS += -msse3 -mavx2
+endif
+endif
 endif
 
 BUILT_SOURCES = crc8gen.c crc16gen.c crc32gen.c crc64gen.c
+EXTRA_DIST = viterbi_sse_common.h
 
 if ENABLE_PLUGIN
 libosmocore_la_SOURCES += plugin.c