Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

Errors when compiling SSE4 instructions in .asm file with Intel compiler version 11.0.061

sreekanth_reddy
Beginner
713 Views
Hi,

I am trying to compile a .asm file that has a SSE4 instruction on Windows with the compiler version 11.0.061. The line "mpsadbw xmm0,xmm1,0" causes the compiler to throw an error that reads "Syntax error : xmm0". However, the SSE2 equivalent, "psadbw xmm0,xmm1" compiles fine. Am I doing anything wrong here? The compiler launch command I am trying to use from the Intel 32-bit compiler environment window is "icl foo.asm". Appreciate any insight you could provide. The inline assembly with __asm{} directive does compile fine, as does the compiler intrinsic. It is only when I try to compile the function as .asm file, I get the syntax error for the SSE4 instructions.

The code is attached below:

---------------------------------------------------------------------

.686
.XMM

.MODEL flat,stdcall
.STACK 4096
option casemap: none

.code

foo PROC x:XMMWORD,y:XMMWORD

mpsadbw xmm0,xmm1,0

foo ENDP

END
0 Kudos
7 Replies
Om_S_Intel
Employee
713 Views
Intel C++ compiler for Windows does not have it's own assembler. The Intel C++ compiler calls Microsoft assembler if you try to compile the assebly file.

Intel compiler can compile inline assembly on its own. If you can convert your code to use the inline assembly then you can compiler SSE4 instructions by using /arch:SSE4.1 or /arch:SSE4.2 compiler option.

0 Kudos
sreekanth_reddy
Beginner
713 Views
Intel C++ compiler for Windows does not have it's own assembler. The Intel C++ compiler calls Microsoft assembler if you try to compile the assebly file.

Intel compiler can compile inline assembly on its own. If you can convert your code to use the inline assembly then you can compiler SSE4 instructions by using /arch:SSE4.1 or /arch:SSE4.2 compiler option.


Thanks Om.. I am using VS 2005. If Intel C++ compiler calls MS assembler, it does then make sense because, I believe, VS 2005 does not include support for SSE4.

Yes, the inline form compiles fine. But, I need the code to be in a saperate assembly file; I guess I will have to move to VS 2008 to be able to compile SSE4 instructions using MASM that comes with VS 2008.

Also, I was under the impression that the /arch: flag allows the compiler to optimize and generate SSEx code, but is not required to compile the code. Isn't this true? Could you please shed some light on this.

0 Kudos
Om_S_Intel
Employee
713 Views

The code generation and optimization are compilation phases. The compiler options /arch:SSE4.1 and /arch:SSE4.2 tells the compiler to generate optimized code specialized for the processor equipped with SSE4.1 and SSE4.2 instructions respectively.
0 Kudos
TimP
Honored Contributor III
713 Views

The code generation and optimization are compilation phases. The compiler options /arch:SSE4.1 and /arch:SSE4.2 tells the compiler to generate optimized code specialized for the processor equipped with SSE4.1 and SSE4.2 instructions respectively.
I think the question may have been whether SSE4 in-line instructions are accepted without SSE4 architecture selection.
0 Kudos
sreekanth_reddy
Beginner
713 Views
Quoting - tim18
I think the question may have been whether SSE4 in-line instructions are accepted without SSE4 architecture selection.

Yes. Are they accepted without SSE4 architecture selection?
0 Kudos
Om_S_Intel
Employee
713 Views

No. If we do not specify the architecture then compiler 11.x defaults to Intel Pentium IV instruction set.
0 Kudos
Brandon_H_Intel
Employee
713 Views

No. If we do not specify the architecture then compiler 11.x defaults to Intel Pentium IV instruction set.

This is not correct. User-written inline asm includingIntel Streaming SIMD Extensions 1-4or usage of SSE 1-4intrinsics or vector classes or manual cpu dispatching can all be used and compiled without needing the /Qx, /Qax, or /arch options to be set.

Om is correct that in general, the compiler generates code that can be run on processors that support SSE2.
0 Kudos
Reply