You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rust stabilized its isqrt method today, so I was looking at its codegen.
The output for
let root = u16::isqrt(num);
currently has a manual
assume(root <= 255)
I was thinking that it'd be nice to give LLVM a bit more specific information, like
assume(root * root <= num)
since that's (a partial) definition of what isqrtdoes, and strictly more specific.
Sadly, that assume today doesn't seem to be worth bothering adding, since opt seems like it doesn't take advantage of it even in a "simple" situation that doesn't need to know anything about num: https://llvm.godbolt.org/z/zoq4T5fKr
Rust stabilized its
isqrt
method today, so I was looking at its codegen.The output for
currently has a manual
I was thinking that it'd be nice to give LLVM a bit more specific information, like
since that's (a partial) definition of what
isqrt
does, and strictly more specific.Sadly, that assume today doesn't seem to be worth bothering adding, since
opt
seems like it doesn't take advantage of it even in a "simple" situation that doesn't need to know anything aboutnum
: https://llvm.godbolt.org/z/zoq4T5fKrBut Alive2 confirms that it would be allowed to https://alive2.llvm.org/ce/z/ko8HYR
Original Rust code I used to get the LLVM IR: https://rust.godbolt.org/z/vM8qj4xjf
cc rust-lang/rust#116226
The text was updated successfully, but these errors were encountered: