Thread: VS2013 FP code generation

  1. #1
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246

    VS2013 FP code generation

    Code:
    	int c =0;
    000000013FD223B5  mov         dword ptr [rsp+20h],0  
    	float f=0;
    000000013FD223BD  xorps       xmm0,xmm0  
    000000013FD223C0  movss       dword ptr [rsp+24h],xmm0  
    	int a = c + f;
    000000013FD223C6  cvtsi2ss    xmm0,dword ptr [rsp+20h]  
    000000013FD223CC  addss       xmm0,dword ptr [rsp+24h]  
    000000013FD223D2  cvttss2si   eax,xmm0  
    000000013FD223D6  mov         dword ptr [rsp+28h],eax
    As you see the compiler has generated code which is using SSE instead of FPU while the /arch:IA32 is set. Any idea why?
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Random guess from /arch (x86)
    /arch only affects code generation for native functions. When you use /clr to compile, /arch has no effect on code generation for managed functions.
    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  3. #3
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246
    Quote Originally Posted by stahta01 View Post
    Random guess from /arch (x86)


    Tim S.
    Thanks for sharing your opinion but when you see the assembly it is not CL. The answer is here.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  4. #4
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Quote Originally Posted by siavoshkc View Post
    Thanks for sharing your opinion but when you see the assembly it is not CL. The answer is here.
    For the people NOT to waste their time when using the 64 bit compiler the option to generate 32 bit without SSE does NOT work is the only real likely answer I saw.

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  5. #5
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246
    Quote Originally Posted by stahta01 View Post
    For the people NOT to waste their time when using the 64 bit compiler the option to generate 32 bit without SSE does NOT work is the only real likely answer I saw.

    Tim S.
    Incorrect. Compiler ignores /arch:ia32 when is creating x64 executive. That is because there is no x64 CPU with no SSE in real world.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  6. #6
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    This is 64-bit code. SSE is part of x64 architecture. There is nothing unusual here.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Random DAG Generation Code
    By Mycroft Holmes in forum C++ Programming
    Replies: 1
    Last Post: 05-02-2013, 09:36 PM
  2. What would be the compiler generation code?
    By ArunS in forum C Programming
    Replies: 4
    Last Post: 08-10-2011, 01:24 PM
  3. template code generation
    By underthesun in forum C++ Programming
    Replies: 8
    Last Post: 12-09-2009, 11:26 PM
  4. Three Address Code generation using Lex, Yacc
    By Raman in forum C Programming
    Replies: 1
    Last Post: 11-04-2008, 09:04 AM
  5. Code auto generation tools?
    By xuftugulus in forum C Programming
    Replies: 3
    Last Post: 02-18-2008, 04:00 PM