News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

cvttsd2si

Started by mrburkett, July 14, 2005, 06:01:10 PM

Previous topic - Next topic

mrburkett

What is wrong with this code?

code:

.686
.xmm
.data

Record_Save Struct
     epoch_m   dq   0
Record_Save EndS

.code

cvttsd2si  eax,Record_Save.epoch_m

I am using ml V7.10.2179

Thanks,
Jim

mrburkett

#1
I put this in a test file by itself and I get the same results.  What I do not understand is, according to Intel's Manuels, cvttsd2si is defined as:

cvttsd2si r32, xmm/m64

The member of the structure is 64 bits going into a 32-bit register.
I get this error: invalid instruction operands

Where am I going wrong?

Jim


Code:

.686
.model flat, stdcall
Option Casemap:NONE
.xmm
.data
Record_Save STRUCT
epoch_m dq 0
Record_Save EndS

.code
Start:
cvttsd2si eax, Record_Save.epoch_m

End Start


Jim, I just added the code tags so it was easier to read.

hutch--

Jim,

The format of the value loaded in the structure QWORD may be incorrect. I would try it with a floating point format number loaded at the memory location.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

mrburkett

Yes, that led me to see that I was not initializing the Floating Point variables correctly.

Now, the cvttsd2si STILLl did not like the structure member.  It worked perfectly from a normal real8 variable.

This leads me to believe that I should stay away from structures as I will be doing extensive work with real8 variables.  The sturcture just makes it easier to be organized.

Thanks, Hutch,
Jim

mrburkett

Problem solved with structure members using cvttsd2si or possibly other xmm directives as well.

In my code:

cvttsd2si    eax,Record_Save.epoch_m

Correct this to read:

cvttsd2si   eax,cs:Record_Save.epoch_m


and it assembles without error.   :clap: :clap: :clap:  as with the math processor.

Jim