Skip to content
Permalink
Browse files

Windows libpgmath changes

1) Add compilation flag "-m64"

2) Do not use -O2 and higher

3) Eliminate implicit constructor called at process initialization
   from logf and log10f for 3 constants used in the implementation of
   those routines for AVX2, KNL, and AVX512 ISA extensions.

4) Add header guard to runtime/libpgmath/lib/common/logf/common.h

5) Change system include header file <cmath> to <math.h>.
   Windows' <cmath> has an implicit dependency on runtime MSC_VER >= 1900.
  • Loading branch information...
gklimowicz committed Oct 9, 2019
1 parent 387cff3 commit 00ccd527a191f345d6cb3fe452bd080209dca8e6
@@ -92,13 +92,17 @@ if(${LIBPGMATH_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT ${LIBPGMATH_WITH_GENER
TARGET_WIN_X8664 TARGET_WIN _PGI_NOBUILTINS MAXCPUS=256
MAXCPUSL=8 MAXCPUSR=8 WINNT WIN64 LONG_IS_32
HOST_WIN TARGET_X8664 _NO_CRT_STDIO_INLINE)
#djp HOST_WIN _DLL TARGET_X8664 _NO_CRT_STDIO_INLINE)
#problems with -O2 and higher using vectorcall ABI
# set(FLAGS_L1 "-m64 -O2 ")
set(FLAGS_L2 "-m64 ")

set(DEFINITIONS_L2
TARGET_WIN_X8664 TARGET_WIN _PGI_NOBUILTINS MAXCPUS=256
MAXCPUSL=8 MAXCPUSR=8 WINNT WIN64 LONG_IS_32
HOST_WIN TARGET_X8664 _NO_CRT_STDIO_INLINE)
#djp HOST_WIN _DLL TARGET_X8664 _NO_CRT_STDIO_INLINE)
#problems with -O2 and higher using vectorcall ABI
# set(FLAGS_L2 "-m64 -O2 ")
set(FLAGS_L2 "-m64 ")

# common
# Definitions and compiler flags for level 1 directories
@@ -19,13 +19,16 @@
#ifndef COMMON_H
#define COMMON_H

static float int_as_float(int a) { return *(float*)&a; }
static int float_as_int(float a) { return *(int*)&a; }

float const TWO_TO_24_F = 16777216.0f;
float const PINF = int_as_float(0x7f800000);
float const NINF = int_as_float(0xff800000);
float const CANONICAL_NAN = int_as_float(0xffc00000);
#include <math.h>

static inline float int_as_float(int a) { return *(float*)&a; }
static inline int float_as_int(float a) { return *(int*)&a; }

static float const TWO_TO_24_F = 16777216.0f;
static float const PINF = +INFINITY;
static float const NINF = -INFINITY;
static float const CANONICAL_NAN = -NAN;

const float ONE_F[] __attribute__ ((aligned (64))) = {
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
@@ -16,14 +16,19 @@
*
*/

#ifndef COMMON_H
#define COMMON_H

static float int_as_float(int a) { return *(float*)&a; }
static int float_as_int(float a) { return *(int*)&a; }

float const TWO_TO_24_F = 16777216.0f;
float const PINF = int_as_float(0x7f800000);
float const NINF = int_as_float(0xff800000);
float const CANONICAL_NAN = int_as_float(0xffc00000);
#include <math.h>

static inline float int_as_float(int a) { return *(float*)&a; }
static inline int float_as_int(float a) { return *(int*)&a; }

static float const TWO_TO_24_F = 16777216.0f;
static float const PINF = +INFINITY;
static float const NINF = -INFINITY;
static float const CANONICAL_NAN = -NAN;

const float ONE_F[] __attribute__ ((aligned (64))) = {
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
@@ -117,3 +122,4 @@ const float c9[] __attribute__ ((aligned (64))) = {
-0.5f,-0.5f,-0.5f,-0.5f,-0.5f,-0.5f,-0.5f,-0.5f
};

#endif

0 comments on commit 00ccd52

Please sign in to comment.
You can’t perform that action at this time.