0

Long story short, i've been trying to learn a new programming paradigm and get out of my comfort zone of just being someone who writes code to an individual that actually understands what's going on behind the scenes.

I've read several assembly programming book, tutorials and countless google articles. Somehow SIMD interest me more than other topic for now. I'm concentrating on AVX and SSE at the moment, working on my VPS, checking out people code and trying to implement a simple computation just to learn and get the feel of how SIMD is working.

Now to the question, i know AVX support __m256,__m256d and __m256i. I didn't have problem with the first two but for some reason i am having problem with __m256i (8-bit integer);

ie:

-say i have 8 integers and I set them into the register for example: __m256i a = _mm256_setr_epi32(1,2,3,4,5,6,7,8) -and i want to do shift 1 bit using operation _mm256_slli_si256 and then store the result in another variable __m256i b b = _mm256_slli_si256(a,1);

if i compile this, the compiler throws an error of : "error: incompatible types when assigning to type ‘__m256i’ from type ‘int’"

i tried to cast the variable to __m256i but then i get another error: "error: can’t convert between vector values of different size"

i'm using GCC with -mavx flag if anything.

Ray Renaldi
  • 57
  • 1
  • 11
  • 1
    Suggest re-phrasing question: nearly eliminate first 2 paragraphs, show example code, pose a _question_. – chux - Reinstate Monica Aug 25 '14 at 02:34
  • `AVX` does support integer operations on 256-bit vectors, they were added only in `AVX2` – Marat Dukhan Aug 25 '14 at 03:14
  • 1
    @MaratDukhan I think you mean AVX does **not** support integer operations – phuclv Aug 25 '14 at 03:23
  • yea I was rambling a lot on that post, my brain was toasted and i had to vent lol.. – Ray Renaldi Aug 25 '14 at 21:23
  • i figure out some of it over the past few days. Luu Vinh Phuc was right, AVX does not support integer operations. I'm sure there's a workaround it, i'm thinking convert the low and hi to __m128i and then do the shift, shuffle them and then concatenate them back together or something along that line. – Ray Renaldi Aug 25 '14 at 21:58
  • @LưuVĩnhPhúc Yes, you're right, that was a typo. – Marat Dukhan Aug 25 '14 at 22:57
  • Modern Intel CPUs can do 2 loads and 1 store per clock. Usually that's not the bottleneck, so don't waste cycles packing/unpacking things into 256bit registers if you can only operate on them with 128bit ops. – Peter Cordes Jun 09 '15 at 02:50

0 Answers0