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

64-bit registers not recognized by the compiler?

Eric_Kjellén
Beginner
472 Views

I have made a simple test program to try out inline assembly, as follows:

#include <stdio.h>

int main()
	{
		int a=0;

		__asm {
				mov eax, 1
				mov , eax
		}
		
		printf("%d", a);

		return 0;
	}

It builds and outputs 1 before exiting as it should. However, if I change "eax" to "rax" to access the full 64-bit register, building the program fails with the following error message from the compiler:

1>------ Build started: Project: test4, Configuration: Debug Win32 ------
1>Build started 2014-06-06 17:39:44.
1>InitializeBuildStatus:
1>  Creating "Debug\test4.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>MessageBuildingWithCompiler:
1>  Building with Intel(R) C++ Compiler XE 14.0
1>ClCompile:
1>  ***** ClCompile (Win32 - Intel C++)
1>  test4.cpp
1>test4.cpp(8): error : label "rax" was referenced but not defined
1>    				mov rax, 1
1>    				    ^
1>  
1>  compilation aborted for test4.cpp (code 2)
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.10
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I am using Intel Composer XE 2013 SP1 Update 3 integrated into Visual Studio 2010. All compiler settings for this test project are at default. Anyone have any ideas what might be going on here? Could it be the Win32 part that should somehow be changed before 64-bits registers will be available?

0 Kudos
1 Solution
jimdempseyatthecove
Honored Contributor III
472 Views

Use the configuration manager to add an x64 configuration. On (about) the 2nd line of the VS GUI is a pull-down window with "Win32" listed. Click on the pull-down arrow. If you do not see x64, click on Configuration Manger, then Add, and select x64.

Win32 is IA32 (32-bit), x64 is Intel64 (64-bit).

Jim Dempsey

View solution in original post

0 Kudos
3 Replies
jimdempseyatthecove
Honored Contributor III
473 Views

Use the configuration manager to add an x64 configuration. On (about) the 2nd line of the VS GUI is a pull-down window with "Win32" listed. Click on the pull-down arrow. If you do not see x64, click on Configuration Manger, then Add, and select x64.

Win32 is IA32 (32-bit), x64 is Intel64 (64-bit).

Jim Dempsey

0 Kudos
Eric_Kjellén
Beginner
472 Views

Thanks! That did the trick.

0 Kudos
Vladimir_P_1234567890
472 Views

take into account that using this configuration you are getting 64-bit binary that will work on 64 bit versions of windows.

--Vladimir

0 Kudos
Reply