Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd nowrap_{add|sub|mul|neg} intrinsics #52205
Conversation
rust-highfive
assigned
varkor
Jul 10, 2018
This comment has been minimized.
This comment has been minimized.
|
r? @varkor (rust_highfive has picked a reviewer for you, use r? to override) |
rust-highfive
added
the
S-waiting-on-review
label
Jul 10, 2018
scottmcm
reviewed
Jul 10, 2018
| #[no_mangle] | ||
| pub unsafe fn nowrap_neg_unsigned(a: u32) -> u32 { | ||
| // CHECK: ret i32 0 | ||
| nowrap_neg(a) |
This comment has been minimized.
This comment has been minimized.
scottmcm
Jul 10, 2018
Author
Member
Yes, this one is useless, since a non-overflowing negation of an unsigned type is always zero, but it was easier to support than to not support.
This comment has been minimized.
This comment has been minimized.
|
@bors r+ I see no reason not to do this, and if it ends up not helping we can always remove them |
This comment has been minimized.
This comment has been minimized.
|
|
bors
added
S-waiting-on-bors
and removed
S-waiting-on-review
labels
Jul 10, 2018
This comment has been minimized.
This comment has been minimized.
|
@bors r- There’s no necessity to land intrinsics before a PR with an actual use case can be made (such as e.g. Please implement actual changes against |
bors
added
S-waiting-on-author
and removed
S-waiting-on-bors
labels
Jul 10, 2018
This comment has been minimized.
This comment has been minimized.
|
Also,
is a very slippery slope, simply because it is way easier to forget and not remove something that ended up not being used (or not useful for some immediate use case). It is way easier to land everything together or not land stuff at all :) |
This comment has been minimized.
This comment has been minimized.
|
Closing while I do that. (Aside: cool to see that bors knows that an r- means the author probably needs to do something) |
scottmcm
closed this
Jul 10, 2018
This comment has been minimized.
This comment has been minimized.
|
Here is an use case for these intrinsics: rust-lang/rfcs#2508 Basically, there is no easy way to generate LLVM-IR with So I'd argue that these intrinsics are at least useful for hacking on rustc/LLVM, debugging performance issues, etc. Also, I'd like to be able to play with intrinsics that also add both, the
|
scottmcm commentedJul 10, 2018
•
edited
LLVM cannot deduce nsw/nuw for things like
Range::nexttoday, so add these so that my next PR can use them to improve whatRangetells LLVM.(This adds the ones that
rustc_codegen_llvm::builder::Builderandrustc_llvm::fficurrently support, which is why it hasnowrap_negbut notnowrap_shl.)tag guess: T-compiler