Skip to content

Latest commit

 

History

History
98 lines (72 loc) · 3.8 KB

set-sse2-enable.md

File metadata and controls

98 lines (72 loc) · 3.8 KB
title ms.custom ms.date ms.reviewer ms.suite ms.technology ms.tgt_pltfrm ms.topic apiname apilocation apitype f1_keywords dev_langs helpviewer_keywords ms.assetid caps.latest.revision author ms.author manager
_set_SSE2_enable | Microsoft Docs
11/04/2016
cpp-standard-libraries
article
_set_SSE2_enable
msvcrt.dll
msvcr80.dll
msvcr90.dll
msvcr100.dll
msvcr100_clr0400.dll
msvcr110.dll
msvcr110_clr0400.dll
msvcr120.dll
msvcr120_clr0400.dll
ucrtbase.dll
api-ms-win-crt-math-l1-1-0.dll
DLLExport
_set_SSE2_enable
set_SSE2_enable
C++
_set_SSE2_enable function
Streaming SIMD Extensions 2 instructions
set_SSE2_enable function
55db895d-fc1e-475a-9110-b781a9bb51c5
19
corob-msft
corob
ghogen

_set_SSE2_enable

Enables or disables the use of Streaming SIMD Extensions 2 (SSE2) instructions in CRT math routines. (This function is not available on x64 architectures because SSE2 is enabled by default.)

Syntax

int _set_SSE2_enable(  
   int flag  
);  

Parameters

flag
1 to enable the SSE2 implementation; 0 to disable the SSE2 implementation. By default, SSE2 implementation is enabled on processors that support it.

Return Value

Nonzero if SSE2 implementation is enabled; zero if SSE2 implementation is disabled.

Remarks

The following functions have SSE2 implementations that can be enabled by using _set_SSE2_enable:

The SSE2 implementations of these functions might give slightly different answers than the default implementations, because SSE2 intermediate values are 64-bit floating-point quantities but the default implementation intermediate values are 80-bit floating-point quantities.

Note

If you use the /Oi (Generate Intrinsic Functions) compiler option to compile the project, it may appear that _set_SSE2_enable has no effect. The /Oi compiler option gives the compiler the authority to use intrinsics to replace CRT calls; this behavior overrides the effect of _set_SSE2_enable. If you want to guarantee that /Oi does not override _set_SSE2_enable, use /Oi- to compile your project. This might also be good practice when you use other compiler switches that imply /Oi.

The SSE2 implementation is only used if all exceptions are masked. Use _control87, _controlfp to mask exceptions.

Requirements

Routine Required header
_set_SSE2_enable <math.h>

For more compatibility information, see Compatibility in the Introduction.

Example

// crt_set_SSE2_enable.c  
// processor: x86  
#include <math.h>  
#include <stdio.h>  
  
int main()  
{  
   int i = _set_SSE2_enable(1);  
  
   if (i)  
      printf("SSE2 enabled.\n");  
   else  
      printf("SSE2 not enabled; processor does not support SSE2.\n");  
}  

Output

SSE2 enabled.

See Also

CRT Library Features