Remix.run Logo
vlovich123 12 hours ago

> or, rather, directly delegate the implementation to LLVM which you otherwise cannot do from plain Rust

I thought the intrinsic specifically were available in plain safe rust and the alignment required intrinsics were allowed in unsafe rust. I’m not sure I understand this “direct to llvm dispatch” argument or how that isn’t accessible to stable Rust today.

dzaima 12 hours ago | parent [-]

You can indeed use intrinsics to make a SIMD library in plain safe stable rust today to some extent; that just isn't what core::simd does; rather, on the Rust-side it's all target-agnostic and LLVM (or whatever other backend) handles deciding how to lower any given op to the target architecture.

e.g. all core::simd addition ends up invoking the single function [1] which is then directly handled by rustc. But these architecture-agnostic intrinsics are unstable[2] (as they're only there as a building block for core::simd), and you can't manually use "#[rustc_intrinsic]" & co in stable rust either.

[1]: https://github.com/rust-lang/rust/blob/b01cc1cf01ed12adb2595...

[2]: https://github.com/rust-lang/rust/blob/b01cc1cf01ed12adb2595...

the__alchemist 11 hours ago | parent [-]

This is what I ended up doing as a stopgap.