about summary refs log tree commit diff
path: root/src/test/codegen/integer-cmp.rs
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-08-29 13:18:01 +0200
committerGitHub <noreply@github.com>2019-08-29 13:18:01 +0200
commit3f05cf6776fe9682200b1327b7131219710120b2 (patch)
tree3c3cd79e15fce31f7d5ef8792249a7de33646bce /src/test/codegen/integer-cmp.rs
parentc94ead7ad7ec563746079760722ade3f887e22a6 (diff)
parentade191c70a51f6699b64423e0bc8e0f307de9ecd (diff)
downloadrust-3f05cf6776fe9682200b1327b7131219710120b2.tar.gz
rust-3f05cf6776fe9682200b1327b7131219710120b2.zip
Rollup merge of #63992 - lzutao:integer-ord, r=nagisa
Small improvement for Ord implementation of integers

Godbolt link: https://godbolt.org/z/tuTDOg

### Before

**asm**
```asm
example::cmp:
  mov eax, dword ptr [rdi]
  xor ecx, ecx
  cmp eax, dword ptr [rsi]
  seta cl
  mov eax, 255
  cmovae eax, ecx
  ret
```

**llvm-mca**
```
Iterations:        100
Instructions:      700
Total Cycles:      217
Total uOps:        1100

Dispatch Width:    6
uOps Per Cycle:    5.07
IPC:               3.23
Block RThroughput: 1.8
```

### After

**asm**
```asm
example::cmp:
  mov eax, dword ptr [rdi]
  xor ecx, ecx
  cmp eax, dword ptr [rsi]
  setne cl
  mov eax, 255
  cmovae eax, ecx
  ret
```

**llvm-mca**
```
Iterations:        100
Instructions:      700
Total Cycles:      209
Total uOps:        1000

Dispatch Width:    6
uOps Per Cycle:    4.78
IPC:               3.35
Block RThroughput: 1.7
```

r? @nagisa
Diffstat (limited to 'src/test/codegen/integer-cmp.rs')
-rw-r--r--src/test/codegen/integer-cmp.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/test/codegen/integer-cmp.rs b/src/test/codegen/integer-cmp.rs
index 1373b12e372..8ada3cf09d0 100644
--- a/src/test/codegen/integer-cmp.rs
+++ b/src/test/codegen/integer-cmp.rs
@@ -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)
@@ -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)