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

Tracking issue for `link_llvm_intrinsics` #29602

Open
aturon opened this Issue Nov 5, 2015 · 13 comments

Comments

Projects
None yet
10 participants
@aturon
Copy link
Member

aturon commented Nov 5, 2015

Tracks stabilization for the link_llvm_intrinsics feature, used via #[link_name="llvm.*"].

Edit: As this is obviously back-end specific, it will most likely never be stabilized.

@eefriedman

This comment has been minimized.

Copy link
Contributor

eefriedman commented Nov 5, 2015

We should just kill this off; there aren't any in-tree users, and it would be impossible to stabilize because LLVM doesn't make any stability promises about intrinsics.

@gnzlbg

This comment has been minimized.

Copy link
Contributor

gnzlbg commented Jan 31, 2017

I am using link_llvm_intrinsics to work around missing intrinsics in rustc.

Some of these intrinsics belong in rustc, but even those would either remain unstable for a long period of time, or never be stabilized. This feature allows using these intrinsics out of tree for the benefit of the users of a nightly compiler (performance-wise).

@cramertj

This comment has been minimized.

Copy link
Member

cramertj commented Jan 17, 2018

@gnzlbg @jonhoo Are you still using this feature? Can it be removed?

@jonhoo

This comment has been minimized.

Copy link
Contributor

jonhoo commented Jan 17, 2018

I've since switched to std::instrinsics::prefetch_read, but I believe @aweinstock314's prefetch crate still depends on it.

@cramertj

This comment has been minimized.

Copy link
Member

cramertj commented Jan 17, 2018

@aweinstock314 Are you still actively using this feature?

@gnzlbg

This comment has been minimized.

Copy link
Contributor

gnzlbg commented Jan 17, 2018

@cramertj the stdsimd crate uses this feature for basically every single intrinsic. So, yes, we are using this feature, and using it more every day. Pinging: @alexcrichton .

The idea is to move the stdsimd crate into std and core, as a way to provide the functionality this feature gives to stable users. The prefetch crate can then be ported to use stdsimd and will work on stable. Maybe one could ping its author to see if they could already port to the stdsimd crate.

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jan 17, 2018

@cramertj @gnzlbg afaik this feature cannot be removed because it's being used to implement the standard library (and also the stdsimd crate destined for libstd). I'd pesonally see this as a perma-unstable issue.

@gnzlbg

This comment has been minimized.

Copy link
Contributor

gnzlbg commented Jan 17, 2018

Is there a way to make features usable only in std ?

@SimonSapin

This comment has been minimized.

Copy link
Contributor

SimonSapin commented Jan 17, 2018

Some unstable features are named something_internals to indicate that they’re an implementation detail and not on the path to stabilization. But a determined Nightly user can still write #![feature(something_internals)] and use them.

@scottmcm

This comment has been minimized.

Copy link
Member

scottmcm commented Jan 18, 2018

FWIW, this was really convenient as a way to try out whether an LLVM intrinsic is even helpful before doing all the work to make and propose a rustc intrinsic for it.

@aweinstock314

This comment has been minimized.

Copy link

aweinstock314 commented Jan 28, 2018

I'm using this in https://crates.io/crates/prefetch, as mentioned; I'm also using it (through https://crates.io/crates/llvmint) in https://github.com/aweinstock314/libgarble-rust for AES-NI (inline assembly was generating suboptimal assembly relative to intrinsics). I don't think my usage depends on them being eventually stabilised, so the _internals feature flag would satisfy my usage.

@gnzlbg

This comment has been minimized.

Copy link
Contributor

gnzlbg commented Jan 28, 2018

The AES-NI intrinsics might become stabilized in the future via stdsimd (see rust-lang-nursery/stdsimd#295). The stdsimd crate provides some prefetching intrinsics already, but maybe the LLVM prefetch intrinsic should be exposed in core::intrinsic.

@jcsoo jcsoo referenced this issue Apr 27, 2018

Open

Stable assembly operations #63

0 of 1 task complete
@scottmcm

This comment has been minimized.

Copy link
Member

scottmcm commented Dec 3, 2018

As a concrete example of why I'd like this to stick around as forever-unstable, I could do the following to experiment with the new intrinsics mentioned in #55286 without a code change:

#![feature(link_llvm_intrinsics)]
extern {
    #[link_name="llvm.sadd.sat.i32"]
    fn add_sat_i32(x: i32, y: i32) -> i32;
    #[link_name="llvm.uadd.sat.i32"]
    fn add_sat_u32(x: u32, y: u32) -> u32;
}
pub unsafe fn test_sfold(x: i32) -> i32 {
    add_sat_i32(add_sat_i32(x, 10), 20)
}
pub unsafe fn test_ufold(x: u32) -> u32 {
    add_sat_u32(add_sat_u32(x, 10), 20)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.