Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

fix Issue 22535 - ImportC: gcc/clang math intrinsics are rejected #3702

Merged
merged 1 commit into from Feb 2, 2022

Conversation

WalterBright
Copy link
Member

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.

@WalterBright WalterBright added the ImportC Pertaining to ImportC support label Jan 22, 2022
@dlang-bot
Copy link
Contributor

Thanks for your pull request, @WalterBright!

Bugzilla references

Auto-close Bugzilla Severity Description
22535 normal ImportC: gcc/clang math intrinsics are rejected.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + druntime#3702"

@dlang-bot dlang-bot added the Bug Fix Include reference to corresponding bugzilla issue label Jan 22, 2022
src/__builtins.d Outdated
Comment on lines 47 to 59
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;
Copy link
Member

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?

Copy link
Contributor

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.

Copy link
Contributor

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.

@dlang-bot dlang-bot added the Needs Rebase needs a `git rebase` performed label Jan 31, 2022
@dlang-bot dlang-bot removed the Needs Rebase needs a `git rebase` performed label Feb 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Fix Include reference to corresponding bugzilla issue ImportC Pertaining to ImportC support
Projects
None yet
6 participants