Hi Julian,

> On 21 Dec 2018, at 16:47, Julian Brown <jul...@codesourcery.com> wrote:
> 

> On Fri, 21 Dec 2018 14:31:19 +0100
> Jakub Jelinek <ja...@redhat.com> wrote:
> 
>> On Fri, Dec 21, 2018 at 01:23:03PM +0000, Julian Brown wrote:
>>> 2018-xx-yy  Nathan Sidwell  <nat...@acm.org>
> 

>>>     * testsuite/libgomp.oacc-c++/pr71959-a.C: New.
>>>     * testsuite/libgomp.oacc-c++/pr71959.C: New.  
>> 
>>> +void apply (int (*fn)(), Iter out) asm
>>> ("_ZN5Apply5applyEPFivE4Iter");  
>> 
>> Will this work even on targets that use _ or other symbol prefixes?
> 
> I'd guess so, else there would be no portable way of using "asm" to
> write pre-mangled C++ names. The only existing similar uses I could find
> in the testsuite are for the ifunc attribute, not asm, though (e.g.
> g++.dg/ext/attr-ifunc-*.C).

It won’t work on such targets (e.g. Darwin)
… but it’s not too hard to make it happen (see, for example, gcc.dg/memcmp-1.c)

One just has to remember that __USER_LABEL_PREFIX__ is a token, not a string.

so .. in the example above…

#define STR1(X) #X
#define STR2(X) STR1(X)

….

 asm(STR2(__USER_LABEL_PREFIX__) "_ZN5Apply5applyEPFivE4Iter”);

> Anyway, OpenACC is only useful for a handful of targets at present,
> neither of which use special symbol prefixes AFAIK.

I have hopes of one day getting offloading to work on Darwin (the only 
limitation is developer time,
not technical feasibility) .. 

cheers
Iain

Reply via email to