From 1927fff50e07a86001f6e61d8b3cda9fa6465831 Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 18 Nov 2015 13:49:17 +0000 Subject: gcc/ * config/nvptx/nvptx.c (global_lock_var): New. (nvptx_global_lock_addr): New. (nvptx_lockless_update): Recomment and adjust for clarity. (nvptx_lockfull_update): New. (nvptx_reduction_update): New. (nvptx_goacc_reduction_fini): Call it. libgcc/ * config/nvptx/reduction.c: New. * config/nvptx/t-nvptx (LIB2ADD): Add it. libgomp/ * testsuite/libgomp.oacc-c-c++-common/reduction-cplx-flt.c: Add worker & gang cases. * testsuite/libgomp.oacc-c-c++-common/reduction-cplx-dbl.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230545 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgcc/ChangeLog | 5 +++++ libgcc/config/nvptx/reduction.c | 31 +++++++++++++++++++++++++++++++ libgcc/config/nvptx/t-nvptx | 3 ++- 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 libgcc/config/nvptx/reduction.c (limited to 'libgcc') diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index a4a17e0b2f2..8ab02ab3f08 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,8 @@ +2015-11-18 Nathan Sidwell + + * config/nvptx/reduction.c: New. + * config/nvptx/t-nvptx (LIB2ADD): Add it. + 2015-11-15 David Edelsohn * config/rs6000/on_exit.c: New file. diff --git a/libgcc/config/nvptx/reduction.c b/libgcc/config/nvptx/reduction.c new file mode 100644 index 00000000000..11bad4c3306 --- /dev/null +++ b/libgcc/config/nvptx/reduction.c @@ -0,0 +1,31 @@ +/* Oversized reductions lock variable + Copyright (C) 2015 Free Software Foundation, Inc. + Contributed by Mentor Graphics. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + + +/* We use a global lock variable for reductions on objects larger than + 64 bits. Until and unless proven that lock contention for + different reduction is a problem, a single lock will suffice. */ + +unsigned volatile __reduction_lock = 0; diff --git a/libgcc/config/nvptx/t-nvptx b/libgcc/config/nvptx/t-nvptx index 34d68cca6cd..e66188f8722 100644 --- a/libgcc/config/nvptx/t-nvptx +++ b/libgcc/config/nvptx/t-nvptx @@ -1,6 +1,7 @@ LIB2ADD=$(srcdir)/config/nvptx/malloc.asm \ $(srcdir)/config/nvptx/free.asm \ - $(srcdir)/config/nvptx/realloc.c + $(srcdir)/config/nvptx/realloc.c \ + $(srcdir)/config/nvptx/reduction.c LIB2ADDEH= LIB2FUNCS_EXCLUDE=__main -- cgit v1.2.1