intrinsics

Header for _blsr_u64 with Sun supplied GCC on Solaris 11?

梦想与她 提交于 2020-01-04 05:21:08
问题 We've got some code that runs on multiple platforms. The code uses BMI/BMI2 intrinsics when available, like a Core i7 5th gen. GCC supplied by Sun on Solaris 11.3 is defining __BMI__ and __BMI2__ , but its having trouble locating BMI/BMI2 intrinsics: $ cat test.cxx #include <x86intrin.h> int main(int argc, char* argv[]) { unsigned long long t = argc; #if defined(__BMI__) || defined(__BMI2__) t = _blsr_u64(t); #endif return int(t); } $ /bin/g++ -march=native test.cxx -o test.exe test.cxx: In

Are there Move (_mm_move_ss) and Set (_mm_set_ss) intrinsics that work for doubles (__m128d)?

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-04 05:17:11
问题 Over the years, a few times I have seen intrinsics functions with in float parameters that get transformed to __m128 with the following code: __m128 b = _mm_move_ss(m, _mm_set_ss(a)); . For instance: void MyFunction(float y) { __m128 a = _mm_move_ss(m, _mm_set_ss(y)); //m is __m128 //do whatever it is with 'a' } I wonder if there is a similar way of using _mm_move and _mm_set intrinsics to do the same for doubles ( __m128d )? 回答1: Almost every _ss and _ps intrinsic / instruction has a double

Are there Move (_mm_move_ss) and Set (_mm_set_ss) intrinsics that work for doubles (__m128d)?

百般思念 提交于 2020-01-04 05:17:06
问题 Over the years, a few times I have seen intrinsics functions with in float parameters that get transformed to __m128 with the following code: __m128 b = _mm_move_ss(m, _mm_set_ss(a)); . For instance: void MyFunction(float y) { __m128 a = _mm_move_ss(m, _mm_set_ss(y)); //m is __m128 //do whatever it is with 'a' } I wonder if there is a similar way of using _mm_move and _mm_set intrinsics to do the same for doubles ( __m128d )? 回答1: Almost every _ss and _ps intrinsic / instruction has a double

Using xmm parameter in AVX intrinsics

妖精的绣舞 提交于 2020-01-04 05:14:20
问题 Is it possible to use xmm register parameter with AVX intrinsics function ( _mm256_**_** )? My code require the usage of vecter integer operation (for load and storing data) along with vector floating point operation. The integer code is written with SSE2 intrinsics to be compatible with older CPU, while floating point is written with AVX to improve speed (there is also SSE code branch, so do not suggest this). Currently, except for using compiler flag to automatically convert all SSE

What is the difference between _mm512_load_epi32 and _mm512_load_si512?

泪湿孤枕 提交于 2020-01-03 18:18:19
问题 The Intel intrinsics guide states simply that _mm512_load_epi32 : Load[s] 512-bits (composed of 16 packed 32-bit integers) from memory into dst and that _mm512_load_si512 : Load[s] 512-bits of integer data from memory into dst What is the difference between these two? The documentation isn't clear. 回答1: There's no difference, it's just silly redundant naming. Use _mm512_load_si512 for clarity. Thanks, Intel. As usual, it's easier to understand the underlying asm for AVX512, and then you can

What is the difference between _mm512_load_epi32 and _mm512_load_si512?

浪子不回头ぞ 提交于 2020-01-03 18:18:06
问题 The Intel intrinsics guide states simply that _mm512_load_epi32 : Load[s] 512-bits (composed of 16 packed 32-bit integers) from memory into dst and that _mm512_load_si512 : Load[s] 512-bits of integer data from memory into dst What is the difference between these two? The documentation isn't clear. 回答1: There's no difference, it's just silly redundant naming. Use _mm512_load_si512 for clarity. Thanks, Intel. As usual, it's easier to understand the underlying asm for AVX512, and then you can

Unresolved external symbol __aullshr when optimization is turned off

霸气de小男生 提交于 2020-01-02 05:22:06
问题 I am compiling a piece of UEFI C code with Visual Studio 2015 C/C++ compiler. The compiler is targeting IA32 , not X64. When turning on the optimization with "/O1", the build is OK. When turning off the optimization with "/Od", the build gives below error: error LNK2001: unresolved external symbol __aullshr According to here, there's an explanation why this kind of functions can be called implicitly by the compiler: It turns out that this function is one of several compiler support functions

Extract set bytes position from SIMD vector

。_饼干妹妹 提交于 2020-01-02 04:49:06
问题 I run a bench of computations using SIMD intructions. These instructions return a vector of 16 bytes as result, named compare , with each byte being 0x00 or 0xff : 0 1 2 3 4 5 6 7 15 16 compare : 0x00 0x00 0x00 0x00 0xff 0x00 0x00 0x00 ... 0xff 0x00 Bytes set to 0xff mean I need to run the function do_operation(i) with i being the position of the byte . For instance, the above compare vector mean, I need to run this sequence of operations : do_operation(4); do_operation(15); Here is the

Bilinear filter with SSE4.1 intrinsics

孤街浪徒 提交于 2020-01-01 05:03:11
问题 I am trying to figure out a reasonably fast bilinear filtering function just for one filtered sample at a time now as an exercise in getting used to using intrinsics - up to SSE41 is fine. So far I have the following: inline __m128i DivideBy255_8xUint16(const __m128i value) { // Blinn 16bit divide by 255 trick but across 8 packed 16bit values const __m128i plus128 = _mm_add_epi16(value, _mm_set1_epi16(128)); const __m128i plus128ThenDivideBy256 = _mm_srli_epi16(plus128, 8); // TODO: Should

Bilinear filter with SSE4.1 intrinsics

大憨熊 提交于 2020-01-01 05:03:11
问题 I am trying to figure out a reasonably fast bilinear filtering function just for one filtered sample at a time now as an exercise in getting used to using intrinsics - up to SSE41 is fine. So far I have the following: inline __m128i DivideBy255_8xUint16(const __m128i value) { // Blinn 16bit divide by 255 trick but across 8 packed 16bit values const __m128i plus128 = _mm_add_epi16(value, _mm_set1_epi16(128)); const __m128i plus128ThenDivideBy256 = _mm_srli_epi16(plus128, 8); // TODO: Should