aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/X86/GlobalISel/cmp.ll
blob: 085f5e32675468f7610b8b995ed6b55d771682e1 (plain) (blame)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=x86_64-linux-gnu    -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=ALL

define i32 @test_icmp_eq_i8(i8 %a, i8 %b) {
; ALL-LABEL: test_icmp_eq_i8:
; ALL:       # %bb.0:
; ALL-NEXT:    cmpb %sil, %dil
; ALL-NEXT:    sete %al
; ALL-NEXT:    andl $1, %eax
; ALL-NEXT:    retq
  %r = icmp eq i8 %a, %b
  %res =  zext i1 %r to i32
  ret i32 %res
}

define i32 @test_icmp_eq_i16(i16 %a, i16 %b) {
; ALL-LABEL: test_icmp_eq_i16:
; ALL:       # %bb.0:
; ALL-NEXT:    cmpw %si, %di
; ALL-NEXT:    sete %al
; ALL-NEXT:    andl $1, %eax
; ALL-NEXT:    retq
  %r = icmp eq i16 %a, %b
  %res =  zext i1 %r to i32
  ret i32 %res
}

define i32 @test_icmp_eq_i64(i64 %a, i64 %b) {
; ALL-LABEL: test_icmp_eq_i64:
; ALL:       # %bb.0:
; ALL-NEXT:    cmpq %rsi, %rdi
; ALL-NEXT:    sete %al
; ALL-NEXT:    andl $1, %eax
; ALL-NEXT:    retq
  %r = icmp eq i64 %a, %b
  %res =  zext i1 %r to i32
  ret i32 %res
}

define i32 @test_icmp_eq_i32(i32 %a, i32 %b) {
; ALL-LABEL: test_icmp_eq_i32:
; ALL:       # %bb.0:
; ALL-NEXT:    cmpl %esi, %edi
; ALL-NEXT:    sete %al
; ALL-NEXT:    andl $1, %eax
; ALL-NEXT:    retq
  %r = icmp eq i32 %a, %b
  %res =  zext i1 %r to i32
  ret i32 %res
}

define i32 @test_icmp_ne_i32(i32 %a, i32 %b) {
; ALL-LABEL: test_icmp_ne_i32:
; ALL:       # %bb.0:
; ALL-NEXT:    cmpl %esi, %edi
; ALL-NEXT:    setne %al
; ALL-NEXT:    andl $1, %eax
; ALL-NEXT:    retq
  %r = icmp ne i32 %a, %b
  %res =  zext i1 %r to i32
  ret i32 %res
}

define i32 @test_icmp_ugt_i32(i32 %a, i32 %b) {
; ALL-LABEL: test_icmp_ugt_i32:
; ALL:       # %bb.0:
; ALL-NEXT:    cmpl %esi, %edi
; ALL-NEXT:    seta %al
; ALL-NEXT:    andl $1, %eax
; ALL-NEXT:    retq
  %r = icmp ugt i32 %a, %b
  %res =  zext i1 %r to i32
  ret i32 %res
}

define i32 @test_icmp_uge_i32(i32 %a, i32 %b) {
; ALL-LABEL: test_icmp_uge_i32:
; ALL:       # %bb.0:
; ALL-NEXT:    cmpl %esi, %edi
; ALL-NEXT:    setae %al
; ALL-NEXT:    andl $1, %eax
; ALL-NEXT:    retq
  %r = icmp uge i32 %a, %b
  %res =  zext i1 %r to i32
  ret i32 %res
}

define i32 @test_icmp_ult_i32(i32 %a, i32 %b) {
; ALL-LABEL: test_icmp_ult_i32:
; ALL:       # %bb.0:
; ALL-NEXT:    cmpl %esi, %edi
; ALL-NEXT:    setb %al
; ALL-NEXT:    andl $1, %eax
; ALL-NEXT:    retq
  %r = icmp ult i32 %a, %b
  %res =  zext i1 %r to i32
  ret i32 %res
}

define i32 @test_icmp_ule_i32(i32 %a, i32 %b) {
; ALL-LABEL: test_icmp_ule_i32:
; ALL:       # %bb.0:
; ALL-NEXT:    cmpl %esi, %edi
; ALL-NEXT:    setbe %al
; ALL-NEXT:    andl $1, %eax
; ALL-NEXT:    retq
  %r = icmp ule i32 %a, %b
  %res =  zext i1 %r to i32
  ret i32 %res
}

define i32 @test_icmp_sgt_i32(i32 %a, i32 %b) {
; ALL-LABEL: test_icmp_sgt_i32:
; ALL:       # %bb.0:
; ALL-NEXT:    cmpl %esi, %edi
; ALL-NEXT:    setg %al
; ALL-NEXT:    andl $1, %eax
; ALL-NEXT:    retq
  %r = icmp sgt i32 %a, %b
  %res =  zext i1 %r to i32
  ret i32 %res
}

define i32 @test_icmp_sge_i32(i32 %a, i32 %b) {
; ALL-LABEL: test_icmp_sge_i32:
; ALL:       # %bb.0:
; ALL-NEXT:    cmpl %esi, %edi
; ALL-NEXT:    setge %al
; ALL-NEXT:    andl $1, %eax
; ALL-NEXT:    retq
  %r = icmp sge i32 %a, %b
  %res =  zext i1 %r to i32
  ret i32 %res
}

define i32 @test_icmp_slt_i32(i32 %a, i32 %b) {
; ALL-LABEL: test_icmp_slt_i32:
; ALL:       # %bb.0:
; ALL-NEXT:    cmpl %esi, %edi
; ALL-NEXT:    setl %al
; ALL-NEXT:    andl $1, %eax
; ALL-NEXT:    retq
  %r = icmp slt i32 %a, %b
  %res =  zext i1 %r to i32
  ret i32 %res
}

define i32 @test_icmp_sle_i32(i32 %a, i32 %b) {
; ALL-LABEL: test_icmp_sle_i32:
; ALL:       # %bb.0:
; ALL-NEXT:    cmpl %esi, %edi
; ALL-NEXT:    setle %al
; ALL-NEXT:    andl $1, %eax
; ALL-NEXT:    retq
  %r = icmp sle i32 %a, %b
  %res =  zext i1 %r to i32
  ret i32 %res
}