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

Small improvement for Ord implementation of integers #63992

Merged
merged 1 commit into from Aug 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/libcore/cmp.rs
Expand Up @@ -1015,8 +1015,8 @@ mod impls {
// The order here is important to generate more optimal assembly.
// See <https://github.com/rust-lang/rust/issues/63758> for more info.
if *self < *other { Less }
else if *self > *other { Greater }
else { Equal }
else if *self == *other { Equal }
else { Greater }
}
}
)*)
Expand Down
4 changes: 2 additions & 2 deletions src/test/codegen/integer-cmp.rs
Expand Up @@ -11,7 +11,7 @@ use std::cmp::Ordering;
#[no_mangle]
pub fn cmp_signed(a: i64, b: i64) -> Ordering {
// CHECK: icmp slt
// CHECK: icmp sgt
// CHECK: icmp ne
// CHECK: zext i1
// CHECK: select i1
a.cmp(&b)
Expand All @@ -21,7 +21,7 @@ pub fn cmp_signed(a: i64, b: i64) -> Ordering {
#[no_mangle]
pub fn cmp_unsigned(a: u32, b: u32) -> Ordering {
// CHECK: icmp ult
// CHECK: icmp ugt
// CHECK: icmp ne
// CHECK: zext i1
// CHECK: select i1
a.cmp(&b)
Expand Down