Blue
Blue

Reputation: 663

SSE 2 and above - Why floating point data types store only 2 floating point numbers

I am attempting to optimise my code using SSE intrinsic functions. After going through the documentation, I see that there is __m128 datatype in SSE for floating point variables, capable of storing 4 float numbers. There is a __m128d in SSE2 capable of only storing 2 floating point numbers? What is the difference between these variables? Isn't SSE2 supposed to be faster than SSE?

Upvotes: 1

Views: 1474

Answers (1)

Picaud Vincent
Picaud Vincent

Reputation: 10982

SSE instructions use 128 bit registers.

A float uses 4 bytes = 32 bits -> hence you can store 4 floats (4*32=128), these are the __m128.

A double uses 8 bytes = 64 bits -> hence you can store 2 doubles (2*64=128), these are the __m128d.

-> Further information https://felix.abecassis.me/2011/09/cpp-getting-started-with-sse/

Upvotes: 7

Related Questions