Processors
Intel® Processors, Tools, and Utilities
14539 Discussions

SSE: addps seems to treat integer data

JRICH21
Beginner
2,155 Views

Hello everybody,

I asked my students to work on a programming project using SSE registers to

compute fibonacci numbers. I asked them to use integers but some of them used

instructions that are supposed to treat floating-point data.

Here is a simple example in NASM that loads integer data using floating point

instruction and then performs what is supposed to be a floating-point addition

but when I display the result I get integers : 1, 3, 5, 7

a: dd 0, 1, 2, 3

 

b: dd 1, 2, 3, 4

 

msg: db "%d %d %d %d", 10, 0

section .text

main:

 

push ebp

 

mov ebp,esp

 

 

movups xmm0, [a]

 

movups xmm1, [b]

 

addps xmm0, xmm1

My question is how is it possible or am I missing something ?

If anyone has an answer I would be very interesting to have an explanation

it seems strange to me.

resgards,

Jean-Michel

0 Kudos
3 Replies
Adolfo_S_Intel2
Employee
593 Views

In this particular case, I would suggest contacting a Field Application Engineer (FAE) so they can assist you with your inquire.

In order to contact a Field Application Engineer (FAE), please call any Authorized Intel® Distributor on your location and ask them to put you in contact with a FAE.

You can find a list of Authorized Intel® Distributors at:

http://www.intel.com/cd/channel/reseller/asmo-na/eng/227304.htm http://www.intel.com/cd/channel/reseller/asmo-na/eng/227304.htm

If you are outside the United States, please access the following link and select a location, to find the closest authorized distributor:

http://premierlocator.intel.com/Default.aspx http://premierlocator.intel.com/Default.aspx

JRICH21
Beginner
593 Views

Thank you for your answer, I will try to contact a FAE.

I have found part of the anwser in the following documentation

64-ia-32-architectures-software-developer-vol-1-2a-2b-3a-3b-manual.pdf (4060 pages)

where it said that there is a "numeric interpretations of fundamental types for use in packed integer

and packed floating-point operations".

However I don't know you the distinction is made between integers and floating-point values.

Although floating point values use the IEEE 754 representation, there are integers that correspond

to representations of FP values. For example :

the float value 1.5

is coded 0x3FC00000 in IEEE 754 (32 bits)

but also corresponds to the integer value 1069547520 (32 bits)

0 Kudos
JRICH21
Beginner
593 Views

I found some explanation in the documentation of

64-ia-32-architectures-software-developer-vol-1-2a-2b-3a-3b-manual.pdf (4060 pages)

where it is said that there is a "numeric interpretation of fundamental types for use in packed

integer and packed floating-point operations"

The main question is now : how is it possible to distinguish in 32 bits integer from floating

point (FP) data ?

For example :

1.5 has an IEEE 754 representation of 0x3FC00000 in 32 bits

but this also corresponds to the integer value 1069547520

so if the exponent part of the 32 bits in IEEE 754 representation is 0

then we could say this is an integer value, but in other cases it is not

possible to distinguish between integer or FP

0 Kudos
Reply