1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown | FileCheck %s
6 define i32 @unsigned_tree_way_cmp_i32(i32 %a, i32 %b) {
7 ; CHECK-LABEL: unsigned_tree_way_cmp_i32:
9 ; CHECK-NEXT: xorl %ecx, %ecx
10 ; CHECK-NEXT: cmpl %esi, %edi
11 ; CHECK-NEXT: seta %cl
12 ; CHECK-NEXT: movl $-1, %eax
13 ; CHECK-NEXT: cmovael %ecx, %eax
15 %c = icmp ult i32 %a, %b
16 %d = icmp ugt i32 %a, %b
17 %z = zext i1 %d to i32
18 %res = select i1 %c, i32 -1, i32 %z
22 define i32 @unsigned_tree_way_cmp_i64(i64 %a, i64 %b) {
23 ; CHECK-LABEL: unsigned_tree_way_cmp_i64:
25 ; CHECK-NEXT: xorl %ecx, %ecx
26 ; CHECK-NEXT: cmpq %rsi, %rdi
27 ; CHECK-NEXT: seta %cl
28 ; CHECK-NEXT: movl $-1, %eax
29 ; CHECK-NEXT: cmovael %ecx, %eax
31 %c = icmp ult i64 %a, %b
32 %d = icmp ugt i64 %a, %b
33 %z = zext i1 %d to i32
34 %res = select i1 %c, i32 -1, i32 %z
38 define i32 @signed_tree_way_cmp(i32 %a, i32 %b) {
39 ; CHECK-LABEL: signed_tree_way_cmp:
41 ; CHECK-NEXT: xorl %ecx, %ecx
42 ; CHECK-NEXT: cmpl %esi, %edi
43 ; CHECK-NEXT: setg %cl
44 ; CHECK-NEXT: movl $-1, %eax
45 ; CHECK-NEXT: cmovgel %ecx, %eax
47 %c = icmp slt i32 %a, %b
48 %d = icmp sgt i32 %a, %b
49 %z = zext i1 %d to i32
50 %res = select i1 %c, i32 -1, i32 %z
54 define i32 @signed_tree_way_cmp_i64(i64 %a, i64 %b) {
55 ; CHECK-LABEL: signed_tree_way_cmp_i64:
57 ; CHECK-NEXT: xorl %ecx, %ecx
58 ; CHECK-NEXT: cmpq %rsi, %rdi
59 ; CHECK-NEXT: setg %cl
60 ; CHECK-NEXT: movl $-1, %eax
61 ; CHECK-NEXT: cmovgel %ecx, %eax
63 %c = icmp slt i64 %a, %b
64 %d = icmp sgt i64 %a, %b
65 %z = zext i1 %d to i32
66 %res = select i1 %c, i32 -1, i32 %z