Here's the file I used:
#include <stdint.h>
int foo(void) {
int32_t oldval, delta;
int32_t *addr = 0;
do {
oldval = *addr;
} while (0 == opal_atomic_cmpset_32(addr, oldval, oldval + delta));
return (oldval + delta);
}
Here's the assembly it produced (note that this is pgi 7.0.7 -- later versions
work fine):
.file "george.c"
.version "01.01"
## PGC 7.0 -opt 1
## PGC 06/08/2010 05:10:04
## pgcc george.c -c -S
## /opt/pgi/7.0.7/linux86-64/7.0-7/bin/pgc
## george.c -opt 1 -terse 1 -inform warn -x 119 0xa10000 -x 122 0x40 -x 123 0x10
00
## -x 127 4 -x 127 16 -x 19 0x400000 -x 28 0x40000 -x 70 0x8000 -x 122 1 -quad
## -x 59 4 -x 59 4 -tp p7-64 -astype 0 -stdinc /opt/pgi/7.0.7/linux86-64/7.0-7/i
nclude:/usr/local/include:/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include:/usr/li
b/gcc/x86_64-redhat-linux/4.1.2/include:/usr/include
## -def unix -def __unix -def __unix__ -def linux -def __linux -def __linux__
## -def __NO_MATH_INLINES -def __x86_64__ -def __LONG_MAX__=9223372036854775807L
## -def __SIZE_TYPE__=unsigned long int -def __PTRDIFF_TYPE__=long int -def __TH
ROW=
## -def __extension__= -def __amd64__ -def __SSE__ -def __MMX__ -def __SSE2__
## -def __SSE3__ -predicate #machine(x86_64) #lint(off) #system(posix) #cpu(x86_
64)
## -cmdline +pgcc george.c -c -S -x 123 4 -x 123 0x80000000 -alwaysinline /opt/p
gi/7.0.7/linux86-64/7.0-7/lib/libintrinsics.il 4
## -asm george.s
## lineno: 3
.text
.align 16
.globl foo
foo:
..Dcfb0:
pushq %rbp
..Dcfi0:
movq %rsp, %rbp
..Dcfi1:
subq $16, %rsp
..EN1:
## lineno: 5
movq $0, -8(%rbp)
.p2align 4,,3
.LB157:
## lineno: 6
movq -8(%rbp), %rdi
movl (%rdi), %esi
movl %esi, -12(%rbp)
movl -16(%rbp), %edx
addl %esi, %edx
xorl %eax, %eax
call opal_atomic_cmpset_32
testl %eax, %eax
je .LB157
movl -16(%rbp), %eax
addl -12(%rbp), %eax
## lineno: 10
leave
ret
.type foo,@function
.size foo,.-foo
..Dcfe0:
__fooEND:
.section .pgi_trace
.align 8
.quad foo ## address of routine
.quad __fooEND - foo ## size of routine
.2byte 0 ## flags for future use
.2byte 3 ## length of following string
## name:foo:
.byte 0x66,0x6f,0x6f,0x00
.data
.globl opal_atomic_cmpset_32
.section .debug_frame
..Dcieb0:
.4byte ..Dciee0-..Dcieb0-4 ## CIE length
.4byte 0xffffffff ## CIE ID
.byte 0x1 ## CIE version
.byte 0x0 ## no augmentation
.byte 0x1 ## ULEB128 1, code alignment factor
.byte 0x78 ## SLEB128 -8, data alignment factor
.byte 0x10 ## return address column
.byte 0xc ## DW_CFA_def_cfa (col 7)
.byte 0x7 ## ULEB128 7
.byte 0x8 ## ULEB128 8
.byte 0x90 ## DW_CFA_offset (col 16)
.byte 0x1 ## ULEB128 1
.align 8
..Dciee0:
.4byte ..Dfdee0-..Dfdeb0 ## FDE length
..Dfdeb0:
.4byte ..Dcieb0 ## CIE pointer
.quad ..Dcfb0 ## initial location
.quad ..Dcfe0-..Dcfb0 ## address range
.byte 0x4 ## DW_CFA_advance_loc4
.4byte ..Dcfi0-..Dcfb0
.byte 0xe ## DW_CFA_def_cfa_offset
.byte 0x10 ## ULEB128 16
.byte 0x86 ## DW_CFA_offset (col 6)
.byte 0x2 ## ULEB128 2
.byte 0x4 ## DW_CFA_advance_loc4
.4byte ..Dcfi1-..Dcfi0
.byte 0xd ## DW_CFA_def_cfa_register (col 6)
.byte 0x6 ## ULEB128 6
.align 8
..Dfdee0:
.ident "PGC 7.0-7"
On Jun 7, 2010, at 9:54 PM, George Bosilca wrote:
>
> On Jun 7, 2010, at 19:47 , Jeff Squyres wrote:
>
> > I'm getting these warnings from PGI 7.0.7. Do they matter? Is "clobber"
> > important?
>
> clobber might be the most important piece of information there, it trigger a
> warning for the compiler that the condition code register have been altered.
>
> This code is protected by OMPI_GCC_INLINE_ASSEMBLY, so if we're compiling it
> it means that somehow we detected that PGI support the GCC inline assembly.
> Now, if they only half-support it, there is not much we can do.
>
> Can you send the assembly instructions generated by the PGI compiler for the
> following code:
>
> int32_t oldval;
>
> do {
> oldval = *addr;
> } while (0 == opal_atomic_cmpset_32(addr, oldval, oldval + delta));
> return (oldval + delta);
>
>
> Thanks,
> george.
>
> >
> > CXX mpicxx.lo
> > "../../../opal/include/opal/sys/amd64/atomic.h", line 91: warning: "cc"
> > clobber ignored
> > : "memory", "cc");
> > ^
> >
> > "../../../opal/include/opal/sys/amd64/atomic.h", line 83: warning: parameter
> > "oldval" was set but never used
> > int32_t oldval, int32_t newval)
> > ^
> >
> > "../../../opal/include/opal/sys/amd64/atomic.h", line 112: warning: "cc"
> > clobber ignored
> > : "memory", "cc"
> > ^
> >
> > "../../../opal/include/opal/sys/amd64/atomic.h", line 104: warning:
> > parameter
> > "oldval" was set but never used
> > int64_t oldval, int64_t newval)
> > ^
> >
> > --
> > Jeff Squyres
> > [email protected]
> > For corporate legal information go to:
> > http://www.cisco.com/web/about/doing_business/legal/cri/
> >
> >
> > _______________________________________________
> > devel mailing list
> > [email protected]
> > http://www.open-mpi.org/mailman/listinfo.cgi/devel
>
>
> _______________________________________________
> devel mailing list
> [email protected]
> http://www.open-mpi.org/mailman/listinfo.cgi/devel
>
--
Jeff Squyres
[email protected]
For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/