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