~ubuntu-branches/ubuntu/saucy/nwchem/saucy

« back to all changes in this revision

Viewing changes to src/tools/ga-4-3/armci/src/atomics-i386.h

  • Committer: Package Import Robot
  • Author(s): Michael Banck, Michael Banck, Daniel Leidert
  • Date: 2012-02-09 20:02:41 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120209200241-jgk03qfsphal4ug2
Tags: 6.1-1
* New upstream release.

[ Michael Banck ]
* debian/patches/02_makefile_flags.patch: Updated.
* debian/patches/02_makefile_flags.patch: Use internal blas and lapack code.
* debian/patches/02_makefile_flags.patch: Define GCC4 for LINUX and LINUX64
  (Closes: #632611 and LP: #791308).
* debian/control (Build-Depends): Added openssh-client.
* debian/rules (USE_SCALAPACK, SCALAPACK): Removed variables (Closes:
  #654658).
* debian/rules (LIBDIR, USE_MPIF4, ARMCI_NETWORK): New variables.
* debian/TODO: New file.
* debian/control (Build-Depends): Removed libblas-dev, liblapack-dev and
  libscalapack-mpi-dev.
* debian/patches/04_show_testsuite_diff_output.patch: New patch, shows the
  diff output for failed tests.
* debian/patches/series: Adjusted.
* debian/testsuite: Optionally run all tests if "all" is passed as option.
* debian/rules: Run debian/testsuite with "all" if DEB_BUILD_OPTIONS
  contains "checkall".

[ Daniel Leidert ]
* debian/control: Used wrap-and-sort. Added Vcs-Svn and Vcs-Browser fields.
  (Priority): Moved to extra according to policy section 2.5.
  (Standards-Version): Bumped to 3.9.2.
  (Description): Fixed a typo.
* debian/watch: Added.
* debian/patches/03_hurd-i386_define_path_max.patch: Added.
  - Define MAX_PATH if not defines to fix FTBFS on hurd.
* debian/patches/series: Adjusted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/** Atomic instructions for i386. To be populated as need arises. 
 
2
 * @author Sriram Krishnamoorthy
 
3
 */
 
4
#ifndef __ATOMICS_I386__
 
5
#define __ATOMICS_I386__
 
6
 
 
7
#include <assert.h>
 
8
 
 
9
#define v4b (volatile unsigned int *)
 
10
 
 
11
static inline void atomic_exchange(void *val, void *ptr, int size) {
 
12
  assert(size == 4);
 
13
  __asm__ __volatile__ ("lock xchgl %0, %1"
 
14
                        : "=r"(*v4b(val)), "+m"(*v4b(ptr))
 
15
                        : "0"(*v4b(val))
 
16
                        : "memory");
 
17
}
 
18
 
 
19
/*SK: fixme. only available in 486+. This breaks i386 compatibility.
 
20
  atomic: *(type*)ploc = *(type*)prem; *(type*)prem += extra*/ 
 
21
static inline void atomic_fetch_and_add(void *prem, void *ploc, int extra, int size) {
 
22
  int _a_temp;
 
23
  assert(size == 4);
 
24
#if 0
 
25
  *(int*)ploc = __sync_fetch_and_add((int*)prem, extra);
 
26
#elif 0
 
27
  __asm__ __volatile__ ("movq %2, %%rax; \
 
28
                         lock xaddl %0, (%%rax);"
 
29
                        : "=r"(_a_temp)
 
30
                        : "0"(extra), "m"((int*)prem)
 
31
                        : "memory", "rax");
 
32
  *(int *)ploc = _a_temp;
 
33
#else
 
34
  __asm__ __volatile__ ("lock xaddl %0, (%2)"
 
35
                        : "=r"(_a_temp)
 
36
                        : "0"(extra), "r"((int*)prem)
 
37
                        : "memory");
 
38
  *(int *)ploc = _a_temp;
 
39
#endif
 
40
}
 
41
 
 
42
#undef v4b
 
43
 
 
44
#endif /*__ATOMICS_I386__*/
 
45