diff --git a/c-blosc/blosc/shuffle-avx2.c b/c-blosc/blosc/shuffle-avx2.c
index 404d2fd..86e750b 100644
--- a/c-blosc/blosc/shuffle-avx2.c
+++ b/c-blosc/blosc/shuffle-avx2.c
@@ -41,7 +41,7 @@ static void printymm(__m256i ymm0)
 
 /* GCC doesn't include the split load/store intrinsics
    needed for the tiled shuffle, so define them here. */
-#if defined(__GNUC__) && !defined(__clang__)
+#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC)
 static inline __m256i
 __attribute__((__always_inline__))
 _mm256_loadu2_m128i(const __m128i* const hiaddr, const __m128i* const loaddr)
diff --git a/setup.py b/setup.py
index b5c55ba..74a9806 100755
--- a/setup.py
+++ b/setup.py
@@ -850,13 +850,14 @@ if 'BLOSC' not in optional_libs:
                           if 'sse2' in f]
     # AVX2
     # Detection code for AVX2 only works for gcc/clang, not for MSVC yet
-    if ('avx2' in cpu_flags and
-            compiler_has_flags(compiler, ["-mavx2"])):
-                print('AVX2 detected')
-                CFLAGS.append('-DSHUFFLE_AVX2_ENABLED')
-                CFLAGS.append('-mavx2')
-                blosc_sources += [f for f in glob.glob('c-blosc/blosc/*.c')
-                                  if 'avx2' in f]
+    if 'avx2' in cpu_info['flags']:
+        print('AVX2 detected')
+        CFLAGS.append('-D__AVX2__')
+        CFLAGS.append('-DSHUFFLE_AVX2_ENABLED')
+        CFLAGS.append('-axCORE-AVX2')
+        blosc_sources += [f for f in glob.glob('c-blosc/blosc/*.c')
+                          if 'avx2' in f]
+    CFLAGS.append('-march=core-avx-i')
 else:
     ADDLIBS += ['blosc']
 
