fix Issue 22535 - ImportC: gcc/clang math intrinsics are rejected #3702
Conversation
Thanks for your pull request, @WalterBright! Bugzilla references
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + druntime#3702" |
208c558
to
8083ef4
Compare
src/__builtins.d
Outdated
double __builtin_inf() { return double.infinity; } | ||
float __builtin_inff() { return float.infinity; } | ||
real __builtin_infl() { return real.infinity; } | ||
|
||
alias __builtin_huge_val = __builtin_inf; | ||
alias __builtin_huge_valf = __builtin_inff; | ||
alias __builtin_huge_vall = __builtin_infl; | ||
|
||
import core.stdc.math; | ||
|
||
alias __builtin_fabs = core.stdc.math.fabs; | ||
alias __builtin_fabsf = core.stdc.math.fabsf; | ||
alias __builtin_fabsl = core.stdc.math.fabsl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
version(DigitalMars). @kinke how redundant are these in ldc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAICT, LDC needs these too - LDC/LLVM doesn't support any magic __builtin_*
names, and I haven't found these in generated module ldc.gccbuiltins_x86
either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may well do, they don't occur in ldc.gccbuiltins_x86
because we filter out things that don't belong to specifically that arch. If LLVM/Clang have these builtins they will be generic. Don't know what "arch" prefix they have though.
8083ef4
to
bdf29f5
Compare
c722aca
to
e6a04f2
Compare
There doesn't seem to be a comprehensive list anywhere on just what all of these are. So we'll just add them piecemeal as required.