1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -mtriple=x86_64-linux-gnu -run-pass=legalizer %s -o - | FileCheck %s
3
4--- |
5  define i32 @test_cmp_i8(i8 %a, i8 %b) {
6    %r = icmp ult i8 %a, %b
7    %res = zext i1 %r to i32
8    ret i32 %res
9  }
10
11  define i32 @test_cmp_i16(i16 %a, i16 %b) {
12    %r = icmp ult i16 %a, %b
13    %res = zext i1 %r to i32
14    ret i32 %res
15  }
16
17  define i32 @test_cmp_i32(i32 %a, i32 %b) {
18    %r = icmp ult i32 %a, %b
19    %res = zext i1 %r to i32
20    ret i32 %res
21  }
22
23  define i32 @test_cmp_i64(i64 %a, i64 %b) {
24    %r = icmp ult i64 %a, %b
25    %res = zext i1 %r to i32
26    ret i32 %res
27  }
28
29  define i32 @test_cmp_p0(i32* %a, i32* %b) {
30    %r = icmp ult i32* %a, %b
31    %res = zext i1 %r to i32
32    ret i32 %res
33  }
34
35...
36---
37name:            test_cmp_i8
38alignment:       4
39legalized:       false
40regBankSelected: false
41registers:
42  - { id: 0, class: _ }
43  - { id: 1, class: _ }
44  - { id: 2, class: _ }
45  - { id: 3, class: _ }
46body:             |
47  bb.1 (%ir-block.0):
48    liveins: $edi, $esi
49
50    ; CHECK-LABEL: name: test_cmp_i8
51    ; CHECK: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
52    ; CHECK: [[COPY1:%[0-9]+]]:_(s8) = COPY $sil
53    ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ult), [[COPY]](s8), [[COPY1]]
54    ; CHECK: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[ICMP]](s1)
55    ; CHECK: $eax = COPY [[ZEXT]](s32)
56    ; CHECK: RET 0, implicit $eax
57    %0(s8) = COPY $dil
58    %1(s8) = COPY $sil
59    %2(s1) = G_ICMP intpred(ult), %0(s8), %1
60    %3(s32) = G_ZEXT %2(s1)
61    $eax = COPY %3(s32)
62    RET 0, implicit $eax
63
64...
65---
66name:            test_cmp_i16
67alignment:       4
68legalized:       false
69regBankSelected: false
70registers:
71  - { id: 0, class: _ }
72  - { id: 1, class: _ }
73  - { id: 2, class: _ }
74  - { id: 3, class: _ }
75body:             |
76  bb.1 (%ir-block.0):
77    liveins: $edi, $esi
78
79    ; CHECK-LABEL: name: test_cmp_i16
80    ; CHECK: [[COPY:%[0-9]+]]:_(s16) = COPY $di
81    ; CHECK: [[COPY1:%[0-9]+]]:_(s16) = COPY $si
82    ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ult), [[COPY]](s16), [[COPY1]]
83    ; CHECK: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[ICMP]](s1)
84    ; CHECK: $eax = COPY [[ZEXT]](s32)
85    ; CHECK: RET 0, implicit $eax
86    %0(s16) = COPY $di
87    %1(s16) = COPY $si
88    %2(s1) = G_ICMP intpred(ult), %0(s16), %1
89    %3(s32) = G_ZEXT %2(s1)
90    $eax = COPY %3(s32)
91    RET 0, implicit $eax
92
93...
94---
95name:            test_cmp_i32
96alignment:       4
97legalized:       false
98regBankSelected: false
99registers:
100  - { id: 0, class: _ }
101  - { id: 1, class: _ }
102  - { id: 2, class: _ }
103  - { id: 3, class: _ }
104body:             |
105  bb.1 (%ir-block.0):
106    liveins: $edi, $esi
107
108    ; CHECK-LABEL: name: test_cmp_i32
109    ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
110    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $esi
111    ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ult), [[COPY]](s32), [[COPY1]]
112    ; CHECK: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[ICMP]](s1)
113    ; CHECK: $eax = COPY [[ZEXT]](s32)
114    ; CHECK: RET 0, implicit $eax
115    %0(s32) = COPY $edi
116    %1(s32) = COPY $esi
117    %2(s1) = G_ICMP intpred(ult), %0(s32), %1
118    %3(s32) = G_ZEXT %2(s1)
119    $eax = COPY %3(s32)
120    RET 0, implicit $eax
121
122...
123---
124name:            test_cmp_i64
125alignment:       4
126legalized:       false
127regBankSelected: false
128registers:
129  - { id: 0, class: _ }
130  - { id: 1, class: _ }
131  - { id: 2, class: _ }
132  - { id: 3, class: _ }
133body:             |
134  bb.1 (%ir-block.0):
135    liveins: $rdi, $rsi
136
137    ; CHECK-LABEL: name: test_cmp_i64
138    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $rdi
139    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $rsi
140    ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ult), [[COPY]](s64), [[COPY1]]
141    ; CHECK: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[ICMP]](s1)
142    ; CHECK: $eax = COPY [[ZEXT]](s32)
143    ; CHECK: RET 0, implicit $eax
144    %0(s64) = COPY $rdi
145    %1(s64) = COPY $rsi
146    %2(s1) = G_ICMP intpred(ult), %0(s64), %1
147    %3(s32) = G_ZEXT %2(s1)
148    $eax = COPY %3(s32)
149    RET 0, implicit $eax
150
151...
152---
153name:            test_cmp_p0
154alignment:       4
155legalized:       false
156regBankSelected: false
157registers:
158  - { id: 0, class: _ }
159  - { id: 1, class: _ }
160  - { id: 2, class: _ }
161  - { id: 3, class: _ }
162body:             |
163  bb.1 (%ir-block.0):
164    liveins: $rdi, $rsi
165
166    ; CHECK-LABEL: name: test_cmp_p0
167    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $rdi
168    ; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $rsi
169    ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(ult), [[COPY]](p0), [[COPY1]]
170    ; CHECK: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[ICMP]](s1)
171    ; CHECK: $eax = COPY [[ZEXT]](s32)
172    ; CHECK: RET 0, implicit $eax
173    %0(p0) = COPY $rdi
174    %1(p0) = COPY $rsi
175    %2(s1) = G_ICMP intpred(ult), %0(p0), %1
176    %3(s32) = G_ZEXT %2(s1)
177    $eax = COPY %3(s32)
178    RET 0, implicit $eax
179
180...
181