Hello Liming,

I did some tests and this is what I found. All test are for 32-bit code 
generation only.
VS2012 and VS2013 both default to /arch:SSE2. Older Microsoft compilers default 
to /arch:IA32.
With /arch:IA32, floating point operations are done using the old x87 fpu 
registers.
Converting from double to unsigned int is done using the FIST (floating integer 
store) instruction.
With arch:SSE2, floating point operations are mostly handled by SSE2 
instructions. But there
is a difference between VS2012 /arch:SSE2 and VS2013 /arch:SSE2. With VS2012 
/arch:SSE2,
conversion from double to unsigned integer is still done using the x87 fpu FIST 
instruction.
But with VS2013, conversion from double to unsigned integer is done by calling 
__dtoui3.
Here is an example:

float.c: unsigned test (double d) {return (unsigned int) d;}
cl -c /arch:SSE2 -Ox /FAsc float.c

VS2013 float.cod:
--------------------------------------------------------------
  00000 f2 0f 10 44 24 04 movsd  xmm0, QWORD PTR _d$[esp-4]
  00006 e9 00 00 00 00    jmp    __dtoui3
--------------------------------------------------------------

VS2012 float.cod:
--------------------------------------------------------------
  00000 83 ec 08         sub     esp, 8
  00003 dd 44 24 0c      fld     QWORD PTR _d$[esp+4]
  00007 d9 7c 24 0c      fnstcw  WORD PTR tv66[esp+4]
  0000b 0f b7 44 24 0c   movzx   eax, WORD PTR tv66[esp+4]
  00010 0d 00 0c 00 00   or      eax, 3072              ; 00000c00H
  00015 89 04 24         mov     DWORD PTR tv69[esp+8], eax
  00018 d9 2c 24         fldcw   WORD PTR tv69[esp+8]
  0001b df 3c 24         fistp   QWORD PTR tv71[esp+8]
  0001e 8b 04 24         mov     eax, DWORD PTR tv71[esp+8]
  00021 d9 6c 24 0c      fldcw   WORD PTR tv66[esp+4]
  00025 83 c4 08         add     esp, 8
  00028 c3               ret     0
--------------------------------------------------------------

Thanks,
Scott

-----Original Message-----
From: Gao, Liming [mailto:[email protected]] 
Sent: Monday, September 15, 2014 09:29 AM
To: [email protected]
Subject: Re: [edk2] [patch 2/5] AppPkg: fix IA32 build failure when VS2013 tool 
chain is used

MSDN says the default is /arch:SSE2 if /arch is not specified for VS2013. Do 
you mean old Microsoft tool chain use /arch:SSE as the
default option? 

-----Original Message-----
From: Scott Duplichan [mailto:[email protected]] 
Sent: Monday, September 15, 2014 12:03 PM
To: [email protected]
Subject: [edk2] [patch 2/5] AppPkg: fix IA32 build failure when VS2013 tool 
chain is used

AppPkg: fix IA32 build failure when VS2013 tool chain is used.

The build fails due to link error 2001, unresolved external symbol __dtoui3.
Avoid this error by using /arch:SSE code generation flag for VS2013 IA32 
compiles.
This overrides the VS2013 default code generation option of /arch:SSE2, making 
it match older Microsoft tool chains. While SSE2 can
improve performance of floating point intensive applications, UEFI code uses 
little floating point, and no performance impact is
expected.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Scott Duplichan <[email protected]>
--


------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel


------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce.
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to