The MASM Forum
General => The Campus => Topic started by: Rav on June 07, 2022, 07:45:57 AM
-
I'm writing assembly routines in 32-bit CPU mode, using directives .686 and .XMM so that I can utilize SSE instructions. I needed to start with register XMM1 as all-0, so I have been using PXOR xmm1,xmm1 to set it to 0. But when assembling with MASM, I noticed that in the Register window that while the general purpose registers all started with various values in them (as expected), the XMM registers (XMM0-XMM7) all started as all-0. They appear to be automatically initialized to 0. So it made me wonder if I actually need to use PXOR to set it to 0. Is this a known "feature" of the XMM registers, and if so, is it documented anywhere? I Googled but didn't find anything about it.
Thanks. / Rav
-
Rav,
You would have to determine that from the Intel manuals and then check if its a characteristic of the operating system. Safety says do it yourself, then you know its done.
-
On my machine, even ecx, esi, edi and the whole FPU are zero at the entry point. Will I rely on that? Never.
Hutch is right, if it's not explicitly documented, don't use it. There are some badly documented grey areas; for example, variables in the .DATA? section are initialised to zero, but you will have a problem finding a Micros*t doc which says so.
-
Thanks, hutch and jj2007. I'll go with safety and initialize it.