Hello.
When he used SSE2 instructions by memory to register xmm, obtain a Bus error (core dumped).
I been reading and it may be of alignment, i tested .align 16, obtain same error, any idea?
pand ofsset, %xmm0 ; <------ (core dumped)
movdqu offset, %xmm1
pand %xmm1, %xmm0 ; <------- any error
My system is OpenBSD, GAS Assembler and x86_64 arch.
Thanks.
Per Intel the destination must be a MMX or XMM register, not a memory operand.
Testing a 64-bit app assembled with JWasm v2.12pre, Nov 27 2013, and running under Windows 7-64 :
;==============================================================================
option casemap:none
include \jwasm\inc\windows.inc
include \jwasm\inc\stdio.inc
include \jwasm\inc\stdlib.inc
includelib \jwasm\lib64\kernel32.lib
includelib \jwasm\lib64\msvcrt.lib
;==============================================================================
.data
align 16
x xmmword 0
db 0
y xmmword 0
.code
;==============================================================================
main proc
pand xmm0, xmm1 ; no error
pand xmm0, x ; no error
;pand xmm0, y ; Exception code: 0xc0000005
pand x, xmm0 ; Error A2049: Invalid instruction operands
invoke Sleep, 2000
invoke ExitProcess, 0
main endp
;==============================================================================
end main
A misaligned memory operand did trigger an access violation exception, but JWASM caught the error with the destination operand.
In my GAS test assembling this file:
.intel_syntax noprefix
.balign 16
.lcomm X,16
pand xmm0, X
pand X, xmm0
pand OWORD PTR X, xmm0
I get:
GNU assembler version 2.24 (x86_64-w64-mingw32) using BFD version (GNU Binutils)
2.24
test.asm: Assembler messages:
test.asm:5: Error: operand size mismatch for `pand'
test.asm:6: Error: operand size mismatch for `pand'
CPU2,
Its a good idea to get yourself the current Intel manuals as they have full documentation on how to use all of the latest instructions. Just note that they use Intel rather than AT&T so you must reverse the operands but its no big deal to do.
MichaelW
If solved with .align 16, thought he had to write in .code, in data work.
Good example.
And the error of line 5 and 6, It is because the instructions SSE2, only accept this parameter passing:
PAND xmm1, xmm2/m128 ; <--- from intel manual
pand xmm0, X
pand X, %xmm0
;Never
pand X, xmm0 ; <---- error
pand %xmm0, X ; <---- error
hutch--
Yes, If i have printed manuals intel but the 1 to 3, and of align is the GAS documentation. The manuals 2 is where are the instructions I did not read well the part of SEE2. Yes, the Intel syntax is inverse.
Thank you both for the quick responses and quality.
Regards.