Skip to content

Commit 0424a51

Browse files
authored
Merge pull request #639 from ThePortlandGroup/nv_stage
Pull 2018-12-17T09-39 Recent NVIDIA Changes
2 parents c821488 + df9c3c2 commit 0424a51

File tree

32 files changed

+391
-66
lines changed

32 files changed

+391
-66
lines changed

runtime/flang/ieee_arithmetic.s

Whitespace-only changes.

runtime/flang/ieee_exceptions.s

Whitespace-only changes.

runtime/flang/initpar.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
2+
* Copyright (c) 1995-2018, NVIDIA CORPORATION. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -404,7 +404,11 @@ __fort_getenv(const char *nm)
404404
int n;
405405

406406
n = strlen(nm);
407+
#if defined(TARGET_OSX)
407408
e = env;
409+
#else
410+
e = environ;
411+
#endif
408412
while (*e != NULL) {
409413
if ((strncmp(*e, nm, n) == 0) && ((*((*e) + n)) == '=')) {
410414
return ((*e) + n + 1);

runtime/flangrti/iostdinit.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
2+
* Copyright (c) 1998-2018, NVIDIA CORPORATION. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,7 +25,8 @@
2525

2626
/* get environ */
2727

28-
#if defined(WIN32) || defined(WIN64)
28+
#if defined(WIN64)
29+
char * * * __cdecl __p__environ(void);
2930
/*
3031
* enclose _fileno within parens to ensure calling the function rather than
3132
* the _fileno function macro (if/when it exists).
@@ -45,7 +46,9 @@ extern char **environ;
4546
char **
4647
__io_environ()
4748
{
48-
#if !defined(TARGET_OSX)
49+
#if defined(TARGET_WIN)
50+
return(*__p__environ());
51+
#elif !defined(TARGET_OSX)
4952
return (environ);
5053
#else
5154
return (*_NSGetEnviron());
@@ -287,10 +290,11 @@ __io_timezone(void *tm)
287290
}
288291

289292
#if (defined(WIN32) || defined(WIN64))
290-
/* OT 10 */
293+
/* wrappers for stderr, stdin, stdout : include
294+
pgc/port/pgi_iobuf.h after stdio.h
295+
*/
291296
void *
292297
_pgi_get_iob(int xx) {
293-
return & __iob_func()[xx];
298+
return __acrt_iob_func (xx);
294299
}
295-
296300
#endif

runtime/libpgmath/lib/common/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT ${LIBPGMATH_WITH_GENERIC})
3939
add_subdirectory("tanf")
4040

4141
# Specific definition, will probably need to remove when we create a single file for each def
42-
set_property(SOURCE dispatch.c APPEND_STRING PROPERTY COMPILE_FLAGS "-fno-builtin-c{sqrt,pow,log,exp,acos,asin,atan,cos,sin,tan,cosh,sinh,tanh}{,f}")
42+
set_property(SOURCE dispatch.c APPEND_STRING PROPERTY COMPILE_FLAGS "-fno-builtin-c{sqrt,pow,log,exp,acos,asin,atan,cos,sin,tan,cosh,sinh,tanh}{,f} -fno-builtin-{ceil,floor}{,f}")
4343
set_property(SOURCE dispatch.c APPEND PROPERTY COMPILE_DEFINITIONS FOR_LIBPGC PGFLANG)
4444
set_property(SOURCE mth_xintrinsics.c APPEND_STRING PROPERTY COMPILE_FLAGS "-march=core2 ")
4545
set_property(SOURCE mth_yintrinsics.c APPEND_STRING PROPERTY COMPILE_FLAGS "-march=sandybridge ")
@@ -79,7 +79,7 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT ${LIBPGMATH_WITH_GENERIC})
7979
add_subdirectory("tanf")
8080

8181
# Specific definition, will probably need to remove when we create a single file for each def
82-
set_property(SOURCE dispatch.c APPEND_STRING PROPERTY COMPILE_FLAGS "-fno-builtin-c{sqrt,pow,log,exp,acos,asin,atan,cos,sin,tan,cosh,sinh,tanh}{,f}")
82+
set_property(SOURCE dispatch.c APPEND_STRING PROPERTY COMPILE_FLAGS "-fno-builtin-c{sqrt,pow,log,exp,acos,asin,atan,cos,sin,tan,cosh,sinh,tanh}{,f} -fno-builtin-{ceil,floor}{,f}")
8383
set_property(SOURCE dispatch.c APPEND PROPERTY COMPILE_DEFINITIONS FOR_LIBPGC PGFLANG)
8484
set_property(SOURCE mth_xintrinsics.c APPEND_STRING PROPERTY COMPILE_FLAGS "-msse2 ")
8585
set_property(SOURCE mth_yintrinsics.c APPEND_STRING PROPERTY COMPILE_FLAGS "-mavx ")
@@ -218,6 +218,7 @@ set(SRCS
218218
bessel_y0.c
219219
bessel_y1.c
220220
bessel_yn.c
221+
ceil.c
221222
${MTH_CMPLX_SRCS}
222223
cosd.c
223224
cvt.c
@@ -231,7 +232,9 @@ set(SRCS
231232
dbessel_y0.c
232233
dbessel_y1.c
233234
dbessel_yn.c
235+
dceil.c
234236
dcosd.c
237+
dfloor.c
235238
dmod.c
236239
dpowi.c
237240
dpowk.c
@@ -244,6 +247,7 @@ set(SRCS
244247
erfc_scaledf.c
245248
erfcf.c
246249
erff.c
250+
floor.c
247251
fpcvt.c
248252
gamma.c
249253
gammaf.c
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
#include "mthdecls.h"
19+
#if defined(__SSE4_1__) || defined(__AVX__)
20+
#include <immintrin.h>
21+
#endif
22+
23+
float
24+
__mth_i_ceil(float x)
25+
{
26+
return ceilf(x);
27+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
#include "mthdecls.h"
19+
#if defined(__SSE4_1__) || defined(__AVX__)
20+
#include <immintrin.h>
21+
#endif
22+
23+
#if defined(__AVX__)
24+
double
25+
__mth_i_dceil_avx(double x)
26+
{
27+
return _mm_cvtsd_f64(_mm_ceil_sd(_mm_set1_pd(x), _mm_set1_pd(x)));
28+
}
29+
#elif defined(__SSE4_1__)
30+
double
31+
__mth_i_dceil_sse(double x)
32+
{
33+
return _mm_cvtsd_f64(_mm_ceil_sd(_mm_set1_pd(x), _mm_set1_pd(x)));
34+
}
35+
#else
36+
double
37+
__mth_i_dceil(double x)
38+
{
39+
return ceil(x);
40+
}
41+
#endif
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
#include "mthdecls.h"
19+
#if defined(__SSE4_1__) || defined(__AVX__)
20+
#include <immintrin.h>
21+
#endif
22+
23+
#if defined(__AVX__)
24+
double
25+
__mth_i_dfloor_avx(double x)
26+
{
27+
return _mm_cvtsd_f64(_mm_floor_sd(_mm_set1_pd(x), _mm_set1_pd(x)));
28+
}
29+
#elif defined(__SSE4_1__)
30+
double
31+
__mth_i_dfloor_sse(double x)
32+
{
33+
return _mm_cvtsd_f64(_mm_floor_sd(_mm_set1_pd(x), _mm_set1_pd(x)));
34+
}
35+
#else
36+
double
37+
__mth_i_dfloor(double x)
38+
{
39+
return floor(x);
40+
}
41+
#endif
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
#include "mthdecls.h"
19+
#if defined(__SSE4_1__) || defined(__AVX__)
20+
#include <immintrin.h>
21+
#endif
22+
23+
#if defined(__AVX__)
24+
float
25+
__mth_i_floor_avx(float x)
26+
{
27+
return _mm_cvtss_f32(_mm_floor_ss(_mm_set1_ps(x), _mm_set1_ps(x)));
28+
}
29+
#elif defined(__SSE4_1__)
30+
float
31+
__mth_i_floor_sse(float x)
32+
{
33+
return _mm_cvtss_f32(_mm_floor_ss(_mm_set1_ps(x), _mm_set1_ps(x)));
34+
}
35+
#else
36+
float
37+
__mth_i_floor(float x)
38+
{
39+
return floorf(x);
40+
}
41+
#endif

runtime/libpgmath/lib/common/mthdecls.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,8 @@ float __mth_i_bessel_y0(float arg);
522522
float __mth_i_bessel_y1(float arg);
523523
float __mth_i_bessel_yn(int n, float arg);
524524
float __f90_bessel_yn(int n1, int n2, float f);
525+
float __mth_i_ceil(float);
526+
float __mth_i_floor(float);
525527

526528
int __mth_i_idnint(double d);
527529
int __mth_i_mod(int i, int j);
@@ -575,6 +577,8 @@ double __mth_i_dbessel_y0(double arg);
575577
double __mth_i_dbessel_y1(double arg);
576578
double __mth_i_dbessel_yn(int n, double arg);
577579
double __f90_dbessel_yn(int n1, int n, double d);
580+
double __mth_i_dceil(double);
581+
double __mth_i_dfloor(double);
578582

579583
#if ! defined (TARGET_X8664) && ! defined(LINUX8664)
580584
/*

0 commit comments

Comments
 (0)