Thread: icc vs. gcc-style asm blocks ... maybe the twain can meet?

icc vs. gcc-style asm blocks ... maybe the twain can meet?

From
Tom Lane
Date:
I came across some websites suggesting that icc will handle gcc-style
asm blocks as long as you give it the -fasm-blocks command line option.
It would be awfully nice to get rid of the __INTEL_COMPILER special
cases in s_lock.h and the atomics headers --- would someone who has
icc at hand check into this theory?
        regards, tom lane



Re: icc vs. gcc-style asm blocks ... maybe the twain can meet?

From
Tom Lane
Date:
I wrote:
> I came across some websites suggesting that icc will handle gcc-style
> asm blocks as long as you give it the -fasm-blocks command line option.
> It would be awfully nice to get rid of the __INTEL_COMPILER special
> cases in s_lock.h and the atomics headers --- would someone who has
> icc at hand check into this theory?

Hmm ... wait a second.  The main collection of asm blocks in s_lock.h
believes that Intel's compiler will take gcc-style asm without any help:

#if defined(__GNUC__) || defined(__INTEL_COMPILER)

It has believed that since 2003.  There are just two stanzas in s_lock.h
that think icc needs its own implementation; one was introduced in 2005
and the other in 2014, and I'm betting both of them are confused about it.
The other places where __INTEL_COMPILER is used to exclude an asm block
are also of relatively recent vintage.  I'm suspecting that they are
cargo-cult programming rather than actually necessary special cases.

It's possible that these extra implementations are worth the trouble to
carry because icc is smarter about those special intrinsics than it is
about asm blocks.  However, unless someone can point to some solid
evidence of that, I think we should get rid of 'em.  That code is quite
enough of an #ifdef snake's nest without carrying versions we don't
demonstrably need.
        regards, tom lane



Re: icc vs. gcc-style asm blocks ... maybe the twain can meet?

From
Robert Haas
Date:
On Sun, Aug 30, 2015 at 7:16 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I wrote:
>> I came across some websites suggesting that icc will handle gcc-style
>> asm blocks as long as you give it the -fasm-blocks command line option.
>> It would be awfully nice to get rid of the __INTEL_COMPILER special
>> cases in s_lock.h and the atomics headers --- would someone who has
>> icc at hand check into this theory?
>
> Hmm ... wait a second.  The main collection of asm blocks in s_lock.h
> believes that Intel's compiler will take gcc-style asm without any help:
>
> #if defined(__GNUC__) || defined(__INTEL_COMPILER)
>
> It has believed that since 2003.  There are just two stanzas in s_lock.h
> that think icc needs its own implementation; one was introduced in 2005
> and the other in 2014, and I'm betting both of them are confused about it.

The 2005 block seems to have been the result of this thread:

http://www.postgresql.org/message-id/flat/200503090429.j294TlG10498@candle.pha.pa.us

That thread seems pretty clear about asm() not working in that
poster's environment.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



Re: icc vs. gcc-style asm blocks ... maybe the twain can meet?

From
Tom Lane
Date:
Robert Haas <robertmhaas@gmail.com> writes:
> On Sun, Aug 30, 2015 at 7:16 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Hmm ... wait a second.  The main collection of asm blocks in s_lock.h
>> believes that Intel's compiler will take gcc-style asm without any help:

> The 2005 block seems to have been the result of this thread:
> http://www.postgresql.org/message-id/flat/200503090429.j294TlG10498@candle.pha.pa.us
> That thread seems pretty clear about asm() not working in that
> poster's environment.

See followups --- the true story is that icc can do asm blocks on
x86[_64], but not ia64.  I've now documented this accurately, and
fixed various places that were confused about it.
        regards, tom lane



Re: icc vs. gcc-style asm blocks ... maybe the twain can meet?

From
Robert Haas
Date:
On Tue, Sep 1, 2015 at 10:08 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> On Sun, Aug 30, 2015 at 7:16 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> Hmm ... wait a second.  The main collection of asm blocks in s_lock.h
>>> believes that Intel's compiler will take gcc-style asm without any help:
>
>> The 2005 block seems to have been the result of this thread:
>> http://www.postgresql.org/message-id/flat/200503090429.j294TlG10498@candle.pha.pa.us
>> That thread seems pretty clear about asm() not working in that
>> poster's environment.
>
> See followups --- the true story is that icc can do asm blocks on
> x86[_64], but not ia64.  I've now documented this accurately, and
> fixed various places that were confused about it.

Thanks.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company