From owner-sc22wg5@open-std.org  Fri Jun 17 18:08:26 2011
Return-Path: <owner-sc22wg5@open-std.org>
X-Original-To: sc22wg5-dom8
Delivered-To: sc22wg5-dom8@www2.open-std.org
Received: by www2.open-std.org (Postfix, from userid 521)
	id D5570C3BA00; Fri, 17 Jun 2011 18:08:26 +0200 (CET DST)
X-Original-To: sc22wg5@open-std.org
Delivered-To: sc22wg5@open-std.org
Received: from exprod6og114.obsmtp.com (exprod6og114.obsmtp.com [64.18.1.33])
	by www2.open-std.org (Postfix) with ESMTP id BCA93C178E6
	for <sc22wg5@open-std.org>; Fri, 17 Jun 2011 18:08:24 +0200 (CET DST)
Received: from cfexcas02.americas.cray.com ([136.162.34.11]) (using TLSv1) by exprod6ob114.postini.com ([64.18.5.12]) with SMTP
	ID DSNKTft791fazlqVEeljPaO7AKGNUJ3/hjxd@postini.com; Fri, 17 Jun 2011 09:08:25 PDT
Received: from fortran.us.cray.com (172.31.19.200) by
 cfexcas02.americas.cray.com (172.30.74.226) with Microsoft SMTP Server (TLS)
 id 8.3.137.0; Fri, 17 Jun 2011 11:07:05 -0500
Message-ID: <4DFB7BAC.6060900@cray.com>
Date: Fri, 17 Jun 2011 11:07:08 -0500
From: Bill Long <longb@cray.com>
Reply-To: <longb@cray.com>
Organization: Cray Inc.
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10
MIME-Version: 1.0
To: sc22wg5 <sc22wg5@open-std.org>
Subject: Added atomic
Content-Type: text/plain; charset="ISO-8859-1"; format=flowed
Content-Transfer-Encoding: 7bit
Sender: owner-sc22wg5@open-std.org
Precedence: bulk

The list of comments on the coarray TR from Rice suggested adding a SWAP 
atomic subroutine.    The list in 11-200 includes all of the "common" 
atomic operations except one: atomic andxor. I'm inclined to add that 
one, which would make SWAP unnecessary. Or we could add both.  For those 
who are not big amo users...

subroutine atomic_andxor (atom, andmask, xormask)

atom - variable atomically updated according to

    atom = ieor ( iand (atom, andmask), xormask))

subroutine atomic_fandxor (atom, andmask, xormask, old)

similar to atomic_fandxor except old is set to the old value of atom.

If andmask is all 0 bits, and xormask is the new value, then the effect 
is to set atom to the new value and old to the old one.  Can be used to 
do a swap.

The real virtue of this operation is that it allows you to atomically 
define a subset of the bits in the atom variable.

If this is added, is there a need for a separate atomic_swap?

Cheers,
Bill




-- 
Bill Long                                           longb@cray.com
Fortran Technical Support    &                 voice: 651-605-9024
Bioinformatics Software Development            fax:   651-605-9142
Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101


