Thread overview
[Issue 24124] ImportC: gcc simd intrinsics not supported by dmd
[Issue 24124] ImportC: building stb_image.h has errors in gcc
Sep 12, 2023
Walter Bright
Nov 06, 2023
Walter Bright
Nov 06, 2023
Walter Bright
Nov 06, 2023
Dlang Bot
Nov 06, 2023
Walter Bright
Nov 06, 2023
mhh
Nov 07, 2023
Walter Bright
Nov 07, 2023
Walter Bright
September 12, 2023
https://issues.dlang.org/show_bug.cgi?id=24124

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #1 from Walter Bright <bugzilla@digitalmars.com> ---
Is there a path through the headers that does not rely on the gcc SIMD intrinsics?

--
September 12, 2023
https://issues.dlang.org/show_bug.cgi?id=24124

--- Comment #2 from Steven Schveighoffer <schveiguy@gmail.com> ---
Yes, I can define STBI_NO_SIMD and it will not use the SIMD calls. But this might not be a general solution for projects which don't have that configuration option.

Note that I believe LDC has fixed this: https://github.com/ldc-developers/ldc/commit/798f73bd37308abc7aaef21e411f1615c4422022

But DMD may not have that luxury.

--
November 06, 2023
https://issues.dlang.org/show_bug.cgi?id=24124

--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> ---
Supporting gcc's instrinsic builtins would be a major project to add to dmd. If your project needs them, pragmatically you'll need to use gdc/ldc.

--
November 06, 2023
https://issues.dlang.org/show_bug.cgi?id=24124

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ImportC: building           |ImportC: gcc simd
                   |stb_image.h has errors in   |intrinsics not supported by
                   |gcc                         |dmd

--
November 06, 2023
https://issues.dlang.org/show_bug.cgi?id=24124

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
@WalterBright created dlang/dmd pull request #15779 "Issue 24124 - ImportC: gcc simd intrinsics not supported by dmd" mentioning this issue:

- Issue 24124 - ImportC: gcc simd intrinsics not supported by dmd

https://github.com/dlang/dmd/pull/15779

--
November 06, 2023
https://issues.dlang.org/show_bug.cgi?id=24124

--- Comment #5 from Walter Bright <bugzilla@digitalmars.com> ---
BTW, dmd supports all the x86 SIMD instructions in the inline assembler.

--
November 06, 2023
https://issues.dlang.org/show_bug.cgi?id=24124

mhh <maxhaton@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxhaton@gmail.com

--- Comment #6 from mhh <maxhaton@gmail.com> ---
Guillaume has implemented most of the library of intel intrinsics in his library if they are genuinely required (I have been saying this should be pinched for druntime for a while alas he isn't keen)

--
November 07, 2023
https://issues.dlang.org/show_bug.cgi?id=24124

--- Comment #7 from Walter Bright <bugzilla@digitalmars.com> ---
(In reply to mhh from comment #6)
> Guillaume has implemented most of the library of intel intrinsics in his library if they are genuinely required (I have been saying this should be pinched for druntime for a while alas he isn't keen)

Can you link to it here, please?

--
November 07, 2023
https://issues.dlang.org/show_bug.cgi?id=24124

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #8 from Walter Bright <bugzilla@digitalmars.com> ---
1. dmd does not support gcc simd intrinsics, and is not likely to

2. the library in question has a #define for disabling use of those intrinsics, and it's a 3rd party library

Hence, I'm going to resolve this as WONTFIX.

--
November 07, 2023
https://issues.dlang.org/show_bug.cgi?id=24124

--- Comment #9 from Steven Schveighoffer <schveiguy@gmail.com> ---
In general, I agree with this result.

The unfortunate reality is, many C libraries are going to use the definitions from the local c preprocessor (which is not related to DMD) to make decisions, which means that code simply won't compile with DMD.

The only real solution would be for DMD to require a specific set of C headers and C preprocessor that goes with it, and code to that.

ImportC with system headers might be a LDC/GDC-only thing.

--