1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -mtriple=x86_64-linux-gnu -run-pass=legalizer %s -o - | FileCheck %s --check-prefixes=CHECK,X64
3 # RUN: llc -O0 -mtriple=i386-linux-gnu -run-pass=legalizer %s -o - | FileCheck %s --check-prefixes=CHECK,X86
7 define void @test_and_i1() { ret void}
8 define void @test_and_i8() { ret void }
9 define void @test_and_i16() { ret void }
10 define void @test_and_i27() { ret void }
11 define void @test_and_i32() { ret void }
12 define void @test_and_i42() { ret void }
13 define void @test_and_i64() { ret void }
20 regBankSelected: false
22 - { id: 0, class: _, preferred-register: '' }
23 - { id: 1, class: _, preferred-register: '' }
24 - { id: 2, class: _, preferred-register: '' }
27 ; CHECK-LABEL: name: test_and_i1
28 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edx
29 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s32)
30 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s32)
31 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s8) = G_AND [[TRUNC]], [[TRUNC1]]
32 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[AND]](s8)
33 ; CHECK-NEXT: $eax = COPY [[ANYEXT]](s32)
36 %1(s1) = G_TRUNC %0(s32)
38 %3:_(s32) = G_ANYEXT %2
46 regBankSelected: false
48 - { id: 0, class: _, preferred-register: '' }
49 - { id: 1, class: _, preferred-register: '' }
50 - { id: 2, class: _, preferred-register: '' }
53 ; CHECK-LABEL: name: test_and_i8
54 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edx
55 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s32)
56 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s8) = G_AND [[TRUNC]], [[TRUNC]]
57 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[AND]](s8)
58 ; CHECK-NEXT: $eax = COPY [[ANYEXT]](s32)
61 %1(s8) = G_TRUNC %0(s32)
63 %3:_(s32) = G_ANYEXT %2
71 regBankSelected: false
78 ; CHECK-LABEL: name: test_and_i16
79 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edx
80 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
81 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s16) = G_AND [[TRUNC]], [[TRUNC]]
82 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[AND]](s16)
83 ; CHECK-NEXT: $eax = COPY [[ANYEXT]](s32)
86 %1(s16) = G_TRUNC %0(s32)
87 %2(s16) = G_AND %1, %1
88 %3:_(s32) = G_ANYEXT %2
96 regBankSelected: false
100 - { id: 2, class: _ }
103 ; CHECK-LABEL: name: test_and_i27
104 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edx
105 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[COPY]]
106 ; CHECK-NEXT: $eax = COPY [[AND]](s32)
109 %1(s27) = G_TRUNC %0(s32)
110 %2(s27) = G_AND %1, %1
111 %3:_(s32) = G_ANYEXT %2
119 regBankSelected: false
121 - { id: 0, class: _ }
122 - { id: 1, class: _ }
123 - { id: 2, class: _ }
126 ; CHECK-LABEL: name: test_and_i32
127 ; CHECK: [[DEF:%[0-9]+]]:_(s32) = IMPLICIT_DEF
128 ; CHECK-NEXT: [[DEF1:%[0-9]+]]:_(s32) = IMPLICIT_DEF
129 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[DEF]], [[DEF1]]
130 ; CHECK-NEXT: $eax = COPY [[AND]](s32)
132 %0(s32) = IMPLICIT_DEF
133 %1(s32) = IMPLICIT_DEF
134 %2(s32) = G_AND %0, %1
142 regBankSelected: false
144 - { id: 0, class: _ }
145 - { id: 1, class: _ }
146 - { id: 2, class: _ }
149 ; X64-LABEL: name: test_and_i42
150 ; X64: [[COPY:%[0-9]+]]:_(s64) = COPY $rdx
151 ; X64-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[COPY]]
152 ; X64-NEXT: $rax = COPY [[AND]](s64)
154 ; X86-LABEL: name: test_and_i42
155 ; X86: [[COPY:%[0-9]+]]:_(s64) = COPY $rdx
156 ; X86-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](s64)
157 ; X86-NEXT: [[UV2:%[0-9]+]]:_(s32), [[UV3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](s64)
158 ; X86-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[UV]], [[UV2]]
159 ; X86-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[UV1]], [[UV3]]
160 ; X86-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[AND]](s32), [[AND1]](s32)
161 ; X86-NEXT: $rax = COPY [[MV]](s64)
164 %1(s42) = G_TRUNC %0(s64)
165 %2(s42) = G_AND %1, %1
166 %3:_(s64) = G_ANYEXT %2
174 regBankSelected: false
176 - { id: 0, class: _ }
177 - { id: 1, class: _ }
178 - { id: 2, class: _ }
181 ; X64-LABEL: name: test_and_i64
182 ; X64: [[DEF:%[0-9]+]]:_(s64) = IMPLICIT_DEF
183 ; X64-NEXT: [[DEF1:%[0-9]+]]:_(s64) = IMPLICIT_DEF
184 ; X64-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[DEF]], [[DEF1]]
185 ; X64-NEXT: $rax = COPY [[AND]](s64)
187 ; X86-LABEL: name: test_and_i64
188 ; X86: [[DEF:%[0-9]+]]:_(s64) = IMPLICIT_DEF
189 ; X86-NEXT: [[DEF1:%[0-9]+]]:_(s64) = IMPLICIT_DEF
190 ; X86-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[DEF]](s64)
191 ; X86-NEXT: [[UV2:%[0-9]+]]:_(s32), [[UV3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[DEF1]](s64)
192 ; X86-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[UV]], [[UV2]]
193 ; X86-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[UV1]], [[UV3]]
194 ; X86-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[AND]](s32), [[AND1]](s32)
195 ; X86-NEXT: $rax = COPY [[MV]](s64)
197 %0(s64) = IMPLICIT_DEF
198 %1(s64) = IMPLICIT_DEF
199 %2(s64) = G_AND %0, %1