- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is a customer issue submitted to Intel Developer Services Support, along with the response provided by our Application Engineers:
Q. Is it possible to write assembly language that will work with multiple compilers? In particular, we would like to support msvc6, msvc7, Intel, and gcc on Linux.
A. It is possible to support multiple compilers, but if one of them is gcc, then it is not easy. Microsoft Visual C++ Compiler* (MSVC) 6.0 and 7.0 and the Intel compilers all use the same assembly language format (called the Intel format). Care must be taken, however, to ensure that the assembly language instructions used are supported by the various compilers. This is possible through processor packs for MSVC 6.0 and 7.0. Gcc, however, uses the AT&T format for their assembly language instructions. The easiest way to support gcc as well is to generate two sections of the assembly code, one in the AT&T format and one in the Intel format. You can then use IFDEFs to include the correct assembly section for the compiler being used. An alternate approach would be to have an include file which converts one format to the other (using #DEFINE statements) and place the include statement for that include file inside an IFDEF. Such an include file would probably be very large to cover the assembly language instructions used. There are a few other, more convoluted ways to do this, but they are not worth mentioning.
Message Edited by intel.software.network.support on 12-07-2005 04:44 PM
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I find this reply potentially confusing. The asm syntax of icc for linux-ia32 is compatible with gcc, but not with Windows compilers other than gcc, not only because of the AT&T vs Intel semantics. In fact, gcc has a little used switch to change the spellings over to Intel, but that still won't make it compatible with the commercial Windows compilers.
As I understand it, Microsoft is removing asm support entirely from "64-bit" compilers, and de-emphasizing it throughout. For low level coding,Microsoft are supportinga larger set of what originally were Intel SSE intrinsics. A subset of those work on all the compilers mentioned, for all IA targets. Some of us have urged that more of Microsoft's own extension to the Intel SSE intrinsics should come into the Intel compilers.
Hope I haven't confused the issue even further.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
im also intrested into this problem,
my main problem is the inline asm stuff wich in intel_syntax need's to be rewritten to at&t syntax for gcc.
The -masm=intel switch and the .intel_syntax noprefix is not working at all, many stuff cant be parsed or is not working. he first thing is the "...
" stuff and the asm {} to asm( :::); converting stuff.
Also the problem that gcc/gas cant access c++ variables without extended asm usage is a problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you refer to differences in C++ name-mangling ABI's, you should be able to overcome them with extern "C" declarations. If someone has buried some particulary name-mangling convention into asm code, I assume it was done with full intent to make it non-portable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can use MASM or "intel" sytled asm syntax with icc -use_msasmoption. The default for icc is to use the gcc format.
regards,
John O'Neill
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page