1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -x86-experimental-vector-widening-legalization | FileCheck %s
4 declare <2 x i32> @llvm.ctlz.v2i32(<2 x i32>, i1 immarg)
6 define <2 x i32> @illegal_ctlz(<2 x i32> %v1) {
7 ; CHECK-LABEL: illegal_ctlz:
9 ; CHECK-NEXT: movdqa %xmm0, %xmm1
10 ; CHECK-NEXT: psrld $1, %xmm1
11 ; CHECK-NEXT: por %xmm0, %xmm1
12 ; CHECK-NEXT: movdqa %xmm1, %xmm0
13 ; CHECK-NEXT: psrld $2, %xmm0
14 ; CHECK-NEXT: por %xmm1, %xmm0
15 ; CHECK-NEXT: movdqa %xmm0, %xmm1
16 ; CHECK-NEXT: psrld $4, %xmm1
17 ; CHECK-NEXT: por %xmm0, %xmm1
18 ; CHECK-NEXT: movdqa %xmm1, %xmm0
19 ; CHECK-NEXT: psrld $8, %xmm0
20 ; CHECK-NEXT: por %xmm1, %xmm0
21 ; CHECK-NEXT: movdqa %xmm0, %xmm1
22 ; CHECK-NEXT: psrld $16, %xmm1
23 ; CHECK-NEXT: por %xmm0, %xmm1
24 ; CHECK-NEXT: pcmpeqd %xmm2, %xmm2
25 ; CHECK-NEXT: pxor %xmm1, %xmm2
26 ; CHECK-NEXT: movdqa %xmm2, %xmm0
27 ; CHECK-NEXT: psrlw $1, %xmm0
28 ; CHECK-NEXT: pand {{.*}}(%rip), %xmm0
29 ; CHECK-NEXT: psubb %xmm0, %xmm2
30 ; CHECK-NEXT: movdqa {{.*#+}} xmm0 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51]
31 ; CHECK-NEXT: movdqa %xmm2, %xmm1
32 ; CHECK-NEXT: pand %xmm0, %xmm1
33 ; CHECK-NEXT: psrlw $2, %xmm2
34 ; CHECK-NEXT: pand %xmm0, %xmm2
35 ; CHECK-NEXT: paddb %xmm1, %xmm2
36 ; CHECK-NEXT: movdqa %xmm2, %xmm0
37 ; CHECK-NEXT: psrlw $4, %xmm0
38 ; CHECK-NEXT: paddb %xmm2, %xmm0
39 ; CHECK-NEXT: pand {{.*}}(%rip), %xmm0
40 ; CHECK-NEXT: pxor %xmm1, %xmm1
41 ; CHECK-NEXT: movdqa %xmm0, %xmm2
42 ; CHECK-NEXT: punpckhdq {{.*#+}} xmm2 = xmm2[2],xmm1[2],xmm2[3],xmm1[3]
43 ; CHECK-NEXT: psadbw %xmm1, %xmm2
44 ; CHECK-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
45 ; CHECK-NEXT: psadbw %xmm1, %xmm0
46 ; CHECK-NEXT: packuswb %xmm2, %xmm0
48 %v2 = call <2 x i32> @llvm.ctlz.v2i32(<2 x i32> %v1, i1 true)
52 declare <2 x i32> @llvm.cttz.v2i32(<2 x i32>, i1 immarg)
54 define <2 x i32> @illegal_cttz(<2 x i32> %v1) {
55 ; CHECK-LABEL: illegal_cttz:
57 ; CHECK-NEXT: pcmpeqd %xmm1, %xmm1
58 ; CHECK-NEXT: paddd %xmm0, %xmm1
59 ; CHECK-NEXT: pandn %xmm1, %xmm0
60 ; CHECK-NEXT: movdqa %xmm0, %xmm1
61 ; CHECK-NEXT: psrlw $1, %xmm1
62 ; CHECK-NEXT: pand {{.*}}(%rip), %xmm1
63 ; CHECK-NEXT: psubb %xmm1, %xmm0
64 ; CHECK-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51]
65 ; CHECK-NEXT: movdqa %xmm0, %xmm2
66 ; CHECK-NEXT: pand %xmm1, %xmm2
67 ; CHECK-NEXT: psrlw $2, %xmm0
68 ; CHECK-NEXT: pand %xmm1, %xmm0
69 ; CHECK-NEXT: paddb %xmm2, %xmm0
70 ; CHECK-NEXT: movdqa %xmm0, %xmm1
71 ; CHECK-NEXT: psrlw $4, %xmm1
72 ; CHECK-NEXT: paddb %xmm0, %xmm1
73 ; CHECK-NEXT: pand {{.*}}(%rip), %xmm1
74 ; CHECK-NEXT: pxor %xmm0, %xmm0
75 ; CHECK-NEXT: movdqa %xmm1, %xmm2
76 ; CHECK-NEXT: punpckhdq {{.*#+}} xmm2 = xmm2[2],xmm0[2],xmm2[3],xmm0[3]
77 ; CHECK-NEXT: psadbw %xmm0, %xmm2
78 ; CHECK-NEXT: punpckldq {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
79 ; CHECK-NEXT: psadbw %xmm0, %xmm1
80 ; CHECK-NEXT: packuswb %xmm2, %xmm1
81 ; CHECK-NEXT: movdqa %xmm1, %xmm0
83 %v2 = call <2 x i32> @llvm.cttz.v2i32(<2 x i32> %v1, i1 true)