src/main.cpp
/**
 * Intel doesn't have multiply instructions for 8bit SIMD vector.
 */
Intel doesn't have multiply instructions for 8bit SIMD vector.
Intel doesn ' t have multiply instructions for 8bit SIMD vector .
inline __m128i _mm_mullo_epi8(__m128i a, __m128i b) {
	__m128i dst_even = _mm_mullo_epi16(a, b);
	__m128i dst_odd
			= _mm_mullo_epi16(_mm_srli_epi16(a, 8), _mm_srli_epi16(b, 8));
	return _mm_or_si128(_mm_slli_epi16(dst_odd, 8),
			_mm_srli_epi16(_mm_slli_epi16(dst_even, 8), 8));
}
inline __m128i _mm_mullo_epi8 ( __m128i a , __m128i b ) { __m128i dst_even = _mm_mullo_epi16 ( a , b ) ; __m128i dst_odd = _mm_mullo_epi16 ( _mm_srli_epi16 ( a , 8 ) , _mm_srli_epi16 ( b , 8 ) ) ; return _mm_or_si128 ( _mm_slli_epi16 ( dst_odd , 8 ) , _mm_srli_epi16 ( _mm_slli_epi16 ( dst_even , 8 ) , 8 ) ) ; }
Intel doesn't have multiply instructions for 8bit SIMD vector.
Intel doesn ' t have multiply instructions for 8bit SIMD vector .
/* Unpack and multiply. */ /**
	 * Take a = [1, 2]
	 * Take b = [2, 2]
	 *
	 *     1    0
	 * |00000001|00000010| a as 16bit = 18
	 * |00000010|00000010| * b as 16bit = 34
	 * |00000110|00000100| dst_even = 612
	 *
	 */ /**
	 *     1    0
	 * |00000001|00000010| a as 16bit = 18
	 * |00000000|00000001| a >> 8 = 1
	 * *
	 * |00000000|00000010| b >> 8 = 2
	 * =
	 * |00000000|00000010| dst_odd = 2
	 */ /* Repack. */ /**
	 *     1    0
	 * |00000000|00000010| dst_odd = 2
	 * |00000010|00000000| dst_odd << 8
	 *
	 * |00000110|00000100| dst_even = 612
	 * |00000100|00000000| dst_even << 8 = 64
	 * |00000000|00000100| dst_even >> 8 = 4
	 *
	 * |00000010|00000000| dst_odd
	 * |00000000|00000100| + dst_even
	 * |00000010|00000100| = [2, 4]
	 */