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

Version 12.0.2

elie27
Beginner
1,389 Views
Had a previous post , but got no-working reply on it. So I will try this thread again.
I am using Intel C++ compiler version 12.0.2 and I want to output assembly files that use Intel Syntax. It is currently displaying them in AT&T syntax. I am using ubuntu and I tried icpc -S -masm=intel Radar-Main.cpp it is giving me the following:"icpc: command line warning #10159: invalid argument for option '-m' " I also tried -use-masm=intel, -asm=intel --masm=intel...So I tried like most permutations of the m a s m letters.
Anyone knows how I can do that?
Thanks
0 Kudos
13 Replies
Judith_W_Intel
Employee
1,389 Views
The -use_msasm controls the type of inline assembly code that isvalid in your source file, not the type of assembly that is produced by the compiler when you specify -S. By default we produce the same assembly output as our reference compiler on ubuntu (Gnu) and there's no switch available to change that.
0 Kudos
elie27
Beginner
1,389 Views
Thanks for your quick reply
Well GNU have the flag, -msasm=intel to output assembly to intel syntax. There is absolutely no map for that into ICC?
Thanks again:)
0 Kudos
Om_S_Intel
Employee
1,389 Views
I get error when using -msasm=intel in gcc.

$ gcc -S -msasm=intel -c tstcase.cpp

cc1plus: error: unrecognized command line option "-msasm=intel"

0 Kudos
elie27
Beginner
1,389 Views
Sorry my bad this is it:
"g++ -S -masm=intel Desktop/parsec-2.1/pkgs/apps/swaptions/src/HJM_Securities.cpp"
and this is part of the file that I got:
HJM_Securities.s
"
.file "HJM_Securities.cpp"
.intel_syntax noprefix
.local _ZStL8__ioinit
.comm _ZStL8__ioinit,1,1
mov eax, DWORD PTR [ebp+8]
mov eax, DWORD PTR [eax]
mov DWORD PTR [ebp-28], eax
"
which is clearly intel Syntax. Now I got 2 conflicting answers from both threads which I opened. the first one claimed that ICC linux compiler syntax can be changed to intel syntax and by default in windows it is intel syntax. While here I was told only at&t syntax.
which one is correct?
0 Kudos
Om_S_Intel
Employee
1,389 Views
Could you provide the pointer for the other thread?
0 Kudos
elie27
Beginner
1,389 Views
this is the thread
I quote:"Some of the linux tools should recognize -masm=intel switch to over-ride the overwhelmingly preferred att default"
I am ready to do anything to get the switch to the intel syntax just tell me which platform would get me that syntax, because Intel should have it's own syntax also gcc has it! so there are a lot of good signs for me
Thank you for your reply:) we need to cooperate to solve my issue
0 Kudos
TimP
Honored Contributor III
1,389 Views
As gcc and other linux tools support the -masm=intel switch, it's reasonable to submit a feature request on your premier.intel.com account, asking whether icc could be made to support it.
You didn't say originally for which linux tools you wanted the switch. I agree that it's a little strange for some Intel linux tools to default to intel format and others to provide no option to use that format.
0 Kudos
Om_S_Intel
Employee
1,389 Views

Intel compilerfor Linux does not genrate Intel assembly. You may use gcc for this.

0 Kudos
elie27
Beginner
1,389 Views
does the windows version of the compiler generate assembly for Intel syntax?
0 Kudos
mecej4
Honored Contributor III
1,389 Views
Yes, but note that you have to deal with the fact that the register usage conventions (i.e., the ABI-s) are different in Windows and Linux.
0 Kudos
Mark_S_Intel1
Employee
1,389 Views
I have good news. We have implemented the feature you requested:

-masm=dialect
Output asm instructions using selected dialect.
Supported choices are `intel' or `att' (the default one).
This would match gcc's option behavior and syntax:
-masm=att ==> No changes to current behavior (default).
-masm=intel ==> produce disassembly in Intel ASM format

This feature will be available in a future product update. We will inform you via this forum thread when a compiler update containing this feature becomes available.

Thanks,
--mark
0 Kudos
elie27
Beginner
1,389 Views
Hello Mark,
Thank you, that really saved me some time! will be looking forward to using it.
Regards,
Elie
0 Kudos
Mark_S_Intel1
Employee
1,389 Views

The latest icc compiler version 12.1 supports that feature. The compiler options are -S masm=intel .

> icc -V

Intel C Intel 64 Compiler XE for applications running on Intel 64, Version 12.1.1.256 Build 20111011

// default is to use att syntax

> icc -S hello.c

> more hello.s

main:

..B1.1: # Preds ..B1.0

..___tag_value_main.1: #4.1

pushq %rbp #4.1

..___tag_value_main.3: #

movq %rsp, %rbp #4.1

..___tag_value_main.4: #

andq $-128, %rsp #4.1

subq $128, %rsp #4.1

movl $3, %edi #4.1

..___tag_value_main.6: #4.1

call __intel_new_proc_init #4.1

// use Intel syntax

> icc -S -masm=intel hello.c

> more hello.s

main:

..B1.1: # Preds ..B1.0

..___tag_value_main.1: #4.1

push rbp #4.1

..___tag_value_main.3: #

mov rbp, rsp #4.1

..___tag_value_main.4: #

and rsp, -128 #4.1

sub rsp, 128 #4.1

mov edi, 3 #4.1

..___tag_value_main.6: #4.1

0 Kudos
Reply