diff options
| author | bors <bors@rust-lang.org> | 2019-08-22 18:06:31 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-08-22 18:06:31 +0000 |
| commit | 760226733e940cb375f791e894fbb554555eeb01 (patch) | |
| tree | 4a06a284e9cdeb6656744b45fa5f183507221105 /src/test/codegen/integer-cmp.rs | |
| parent | 201e52e5fe73ccf3dd22946b1216ad8d64f8c2ba (diff) | |
| parent | 3068064430322888279b60ccec258d7f4bcd4a32 (diff) | |
| download | rust-760226733e940cb375f791e894fbb554555eeb01.tar.gz rust-760226733e940cb375f791e894fbb554555eeb01.zip | |
Auto merge of #63807 - Centril:rollup-b8lo8ct, r=Centril
Rollup of 7 pull requests Successful merges: - #63624 (When declaring a declarative macro in an item it's only accessible inside it) - #63737 (Fix naming misspelling) - #63767 (Use more optimal Ord implementation for integers) - #63782 (Fix confusion in theme picker functions) - #63788 (Add amanjeev to rustc-guide toolstate) - #63796 (Tweak E0308 on opaque types) - #63805 (Apply few Clippy suggestions) Failed merges: r? @ghost
Diffstat (limited to 'src/test/codegen/integer-cmp.rs')
| -rw-r--r-- | src/test/codegen/integer-cmp.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/codegen/integer-cmp.rs b/src/test/codegen/integer-cmp.rs new file mode 100644 index 00000000000..1373b12e372 --- /dev/null +++ b/src/test/codegen/integer-cmp.rs @@ -0,0 +1,28 @@ +// This is test for more optimal Ord implementation for integers. +// See <https://github.com/rust-lang/rust/issues/63758> for more info. + +// compile-flags: -C opt-level=3 + +#![crate_type = "lib"] + +use std::cmp::Ordering; + +// CHECK-LABEL: @cmp_signed +#[no_mangle] +pub fn cmp_signed(a: i64, b: i64) -> Ordering { +// CHECK: icmp slt +// CHECK: icmp sgt +// CHECK: zext i1 +// CHECK: select i1 + a.cmp(&b) +} + +// CHECK-LABEL: @cmp_unsigned +#[no_mangle] +pub fn cmp_unsigned(a: u32, b: u32) -> Ordering { +// CHECK: icmp ult +// CHECK: icmp ugt +// CHECK: zext i1 +// CHECK: select i1 + a.cmp(&b) +} |
