Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to check native support of @mulAdd at compile time? #24

Open
expikr opened this issue Mar 29, 2024 · 1 comment
Open

How to check native support of @mulAdd at compile time? #24

expikr opened this issue Mar 29, 2024 · 1 comment

Comments

@expikr
Copy link

expikr commented Mar 29, 2024

I'm implementing this algorithm over here and there are two variants: one for hardware with fused mulAdd instructions and another for those without.

What's the idiomatic way of choosing which code path to dispatch given a compile target?

@nektro
Copy link
Owner

nektro commented Mar 29, 2024

@mulAdd will always be available. if the target does not have it then a software implementation will be provided from compiler_rt

you can also manually do the cpu feature set detection like in what std.crypto does.
eg https://github.com/ziglang/zig/blob/master/lib/std/crypto/sha2.zig#L203
feature lists are in the arch files in https://github.com/ziglang/zig/tree/master/lib/std/Target/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants