Julian Brown
2018-12-06 22:40:41 UTC
On Tue, 4 Dec 2018 15:27:12 +0100
My *guess* is that it was an attempt to handle cases where the type
precision is less than the type size, and maybe it was feared that
type-punning to an int would then copy the wrong bits. Those changes
appear to not have been necessary though, at least with respect to
testsuite coverage. I also fixed the Fortran test to use "STOP n"
instead of "call abort".
I re-tested the attached with offloading to nvptx. OK?
Thanks,
Julian
gcc/
* omp-low.c (maybe_lookup_field_in_outer_ctx): New function.
(convert_to_firstprivate_int): New function.
(convert_from_firstprivate_int): New function.
(lower_omp_target): Enable GOMP_MAP_FIRSTPRIVATE_INT in
OpenACC.
libgomp/
* oacc-parallel.c (GOACC_parallel_keyed): Handle
GOMP_MAP_FIRSTPRIVATE_INT host addresses.
* plugin/plugin-nvptx.c (nvptx_exec): Handle
GOMP_MAP_FIRSTPRIVATE_INT host addresses.
* testsuite/libgomp.oacc-c++/firstprivate-int.C: New test.
New test.
* testsuite/libgomp.oacc-fortran/firstprivate-int.f90: New
test.
@@ -8039,7 +8182,7 @@ lower_omp_target (gimple_stmt_iterator
*gsi_p, omp_context *ctx) if (omp_is_reference (ovar))
type = TREE_TYPE (type);
if ((INTEGRAL_TYPE_P (type)
- && TYPE_PRECISION (type) <= POINTER_SIZE)
+ && tree_to_uhwi (TYPE_SIZE (type)) <=
POINTER_SIZE) || TREE_CODE (type) == POINTER_TYPE)
{
tkind = GOMP_MAP_FIRSTPRIVATE_INT;
@@ -8194,7 +8337,7 @@ lower_omp_target (gimple_stmt_iterator
*gsi_p, omp_context *ctx) if (omp_is_reference (var))
type = TREE_TYPE (type);
if ((INTEGRAL_TYPE_P (type)
- && TYPE_PRECISION (type) <= POINTER_SIZE)
+ && tree_to_uhwi (TYPE_SIZE (type)) <=
POINTER_SIZE) || TREE_CODE (type) == POINTER_TYPE)
{
x = build_receiver_ref (var, false, ctx);
Why this?* omp-low.c (maybe_lookup_field_in_outer_ctx): New function.
(convert_to_firstprivate_int): New function.
(convert_from_firstprivate_int): New function.
(lower_omp_target): Enable GOMP_MAP_FIRSTPRIVATE_INT in
OpenACC.
libgomp/
* oacc-parallel.c (GOACC_parallel_keyed): Handle
GOMP_MAP_FIRSTPRIVATE_INT host addresses.
* plugin/plugin-nvptx.c (nvptx_exec): Handle
GOMP_MAP_FIRSTPRIVATE_INT host addresses.
* testsuite/libgomp.oacc-c++/firstprivate-int.C: New test.
New test.
* testsuite/libgomp.oacc-fortran/firstprivate-int.f90: New
test.
@@ -8039,7 +8182,7 @@ lower_omp_target (gimple_stmt_iterator
*gsi_p, omp_context *ctx) if (omp_is_reference (ovar))
type = TREE_TYPE (type);
if ((INTEGRAL_TYPE_P (type)
- && TYPE_PRECISION (type) <= POINTER_SIZE)
+ && tree_to_uhwi (TYPE_SIZE (type)) <=
POINTER_SIZE) || TREE_CODE (type) == POINTER_TYPE)
{
tkind = GOMP_MAP_FIRSTPRIVATE_INT;
@@ -8194,7 +8337,7 @@ lower_omp_target (gimple_stmt_iterator
*gsi_p, omp_context *ctx) if (omp_is_reference (var))
type = TREE_TYPE (type);
if ((INTEGRAL_TYPE_P (type)
- && TYPE_PRECISION (type) <= POINTER_SIZE)
+ && tree_to_uhwi (TYPE_SIZE (type)) <=
POINTER_SIZE) || TREE_CODE (type) == POINTER_TYPE)
{
x = build_receiver_ref (var, false, ctx);
precision is less than the type size, and maybe it was feared that
type-punning to an int would then copy the wrong bits. Those changes
appear to not have been necessary though, at least with respect to
testsuite coverage. I also fixed the Fortran test to use "STOP n"
instead of "call abort".
I re-tested the attached with offloading to nvptx. OK?
Thanks,
Julian