Brice,

I am glad you asked me to test widely, because I did find 2 compilers that
rejected my version with "=r" and one that generated bad code for that case.
However, the original "=S" works everywhere I could test (list of 26
compilers below), as did "=D" and "=SD".
Since the "=SD" constraint gives the compiler more choices than the other
two, it should be preferred:

#elif defined(HWLOC_X86_32_ARCH)
  __asm__(
  "xchg %%ebx,%1\n\t"
  "cpuid\n\t"
  "xchg %%ebx,%1\n\t"
  : "=a" (*eax), "=SD" (*ebx), "=c" (*ecx), "=d" (*edx)
  : "0" (*eax), "2" (*ecx));
#else

The tested platforms and compilers include the oldest and newest gcc, icc,
pgcc and suncc versions I could find with x86 support.
Unfortunately my Solaris/x86 platform is currently down.

-Paul

The list:

Red Hat Linux 8.0 (32-bit host)
  gcc 2.96
  gcc (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
  gcc (GCC) 6.0.0 20150706 [a development snapshot]

OpenSuSE 10.2 (32-bit host)
  gcc (GCC) 4.1.2 20061115 (prerelease) (SUSE Linux)

Scientific Linux 5.5 (-m32 on 64-bit host)
  pgi 9.0-4
  pgi 13.10-0
  pgi 14.10-0
  icc (ICC) 11.1 20100414
  icc (ICC) 14.0.2 20140120

Scientific Linux 6.6 (-m32 on 64-bit host)
  gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11)
  clang version 3.4.2 (tags/RELEASE_34/dot2-final)
  Open64 Compiler Suite: Version 4.5.2.1
  Sun C 5.12 Linux_i386 2011/11/16 [a.k.a. Solaris Studio 12.3]
  Sun C 5.13 Linux_i386 2014/10/20 [a.k.a. Solaris Studio 12.4]

Scientific Linux 6.6 (32-bit host)
  gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11)

Debian Jessie
  gcc (Debian 4.9.2-10) 4.9.2

Ubuntu 12.04.5 (-m32 on 64-bit host)
  icc (ICC) 15.0.3 20150407

Ubuntu 14.04.02 (-m32 on 64-bit host)
  Sun Ceres C 5.10 Linux_i386 2009/03/06 [a.k.a. Studio Express 03/09]
  Sun C 5.11 Linux_i386 2010/08/13 [a.k.a. Solaris Studio 12.2]

Mac OS X 10.5 (64-bit host, but 32-bit is default target)
  i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5465)

Mac OS X 10.6 (-m32 on 64-bit host)
  gcc 4.2.1 (Apple Inc. build 5646)

Mac OS X 10.8 (-m32 on 64-bit host)
  Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
  i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build
5658) (LLVM build 2336.11.00)

NetBSD 6.1.5 (32-bit host)
  gcc (NetBSD nb2 20110806) 4.5.3

OpenBSD 5.7 (32-bit host)
  gcc (GCC) 4.2.1 20070719

FreeBSD 10.1 (32-bit host)
  FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512




On Tue, Jul 21, 2015 at 11:22 AM, Paul Hargrove <phhargr...@lbl.gov> wrote:

> Brice,
>
> I don't have anywhere near the testing coverage for Linux on x86 as I do
> on x86-64.
> However, I will see what I can do.
>
> -Paul
>
> On Tue, Jul 21, 2015 at 4:24 AM, Brice Goglin <brice.gog...@inria.fr>
> wrote:
>
>> Thanks.
>> Could you test this new asm on all your systems/compilers? I don't want
>> break that fragile code again.
>> Brice
>>
>> Le 21 juillet 2015 08:17:06 UTC+02:00, Paul Hargrove <phhargr...@lbl.gov>
>> a écrit :
>>
>>> Oops - send the wrong asm code.
>>> While "=S" is correct for the second constraint, I meant to send a
>>> version that had "=r" because it allows the compiler more choices.
>>>
>>> -Paul
>>>
>>> On Mon, Jul 20, 2015 at 11:12 PM, Paul Hargrove <phhargr...@lbl.gov>
>>> wrote:
>>>
>>>> PGI-14.10 for 32-bit targets fails in the same manner as 13.7, 13.9 and
>>>> 13.10.
>>>>
>>>> I believe the following inline x86 asm is correct and more robust than
>>>> the existing code that pgi appears to reject:
>>>>
>>>> #elif defined(HWLOC_X86_32_ARCH)
>>>>   __asm__(
>>>>   "xchg %%ebx,%1\n\t"
>>>>   "cpuid\n\t"
>>>>   "xchg %%ebx,%1\n\t"
>>>>   : "=a" (*eax), "=S" (*ebx), "=c" (*ecx), "=d" (*edx)
>>>>   : "0" (*eax), "2" (*ecx));
>>>> #else
>>>>
>>>> -Paul
>>>>
>>>> On Mon, Jul 20, 2015 at 9:50 PM, Paul Hargrove <phhargr...@lbl.gov>
>>>> wrote:
>>>>
>>>>> Pavan,
>>>>>
>>>>> I can confirm that I see the same with PGI-13.10.
>>>>>
>>>>> I have a couple systems with 14.x installed but neither with 32-bit
>>>>> support.
>>>>> I am downloading 32-bit support now (which I am assuming will work
>>>>> with the existing license) and will report back.
>>>>>
>>>>> -Paul
>>>>>
>>>>> On Mon, Jul 20, 2015 at 9:00 PM, Balaji, Pavan <bal...@anl.gov> wrote:
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> The hwloc-1.11 build seems to fail with the pgi compiler on 32-bit
>>>>>> platforms.  I see the following error:
>>>>>>
>>>>>> ----8<----
>>>>>>   CC       topology-x86.lo
>>>>>> PGC-F-0000-Internal compiler error. unable to allocate a register
>>>>>>    8 (topology-x86.c: 87)
>>>>>> PGC/x86 Linux 13.9-0: compilation aborted
>>>>>> ----8<----
>>>>>>
>>>>>> I only tried pgi-13.7 and 13.9 (I don't have access to later compiler
>>>>>> versions).  It looks like the compiler doesn't like the assembly code in
>>>>>> include/private/cpuid-x86.h for 32-bit platforms.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>>   -- Pavan
>>>>>>
>>>>>> _______________________________________________
>>>>>> hwloc-devel mailing list
>>>>>> hwloc-de...@open-mpi.org
>>>>>> Subscription:
>>>>>> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-devel
>>>>>> Link to this post:
>>>>>> http://www.open-mpi.org/community/lists/hwloc-devel/2015/07/4501.php
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Paul H. Hargrove                          phhargr...@lbl.gov
>>>>> Computer Languages & Systems Software (CLaSS) Group
>>>>> Computer Science Department               Tel: +1-510-495-2352
>>>>> Lawrence Berkeley National Laboratory     Fax: +1-510-486-6900
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Paul H. Hargrove                          phhargr...@lbl.gov
>>>> Computer Languages & Systems Software (CLaSS) Group
>>>> Computer Science Department               Tel: +1-510-495-2352
>>>> Lawrence Berkeley National Laboratory     Fax: +1-510-486-6900
>>>>
>>>
>>>
>>>
>>> --
>>> Paul H. Hargrove                          phhargr...@lbl.gov
>>> Computer Languages & Systems Software (CLaSS) Group
>>> Computer Science Department               Tel: +1-510-495-2352
>>> Lawrence Berkeley National Laboratory     Fax: +1-510-486-6900
>>>
>>> ------------------------------
>>>
>>> hwloc-devel mailing list
>>> hwloc-de...@open-mpi.org
>>> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-devel
>>> Link to this post: 
>>> http://www.open-mpi.org/community/lists/hwloc-devel/2015/07/4505.php
>>>
>>>
>
>
> --
> Paul H. Hargrove                          phhargr...@lbl.gov
> Computer Languages & Systems Software (CLaSS) Group
> Computer Science Department               Tel: +1-510-495-2352
> Lawrence Berkeley National Laboratory     Fax: +1-510-486-6900
>



-- 
Paul H. Hargrove                          phhargr...@lbl.gov
Computer Languages & Systems Software (CLaSS) Group
Computer Science Department               Tel: +1-510-495-2352
Lawrence Berkeley National Laboratory     Fax: +1-510-486-6900

Reply via email to