1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse4.2 | FileCheck %s
4 define i1 @cmp_allbits_concat_i8(i8 %x, i8 %y) {
5 ; CHECK-LABEL: cmp_allbits_concat_i8:
7 ; CHECK-NEXT: andl %esi, %edi
8 ; CHECK-NEXT: cmpb $-1, %dil
11 %zx = zext i8 %x to i16
12 %zy = zext i8 %y to i16
15 %r = icmp eq i16 %or, -1
19 define i1 @cmp_anybits_concat_i32(i32 %x, i32 %y) {
20 ; CHECK-LABEL: cmp_anybits_concat_i32:
22 ; CHECK-NEXT: orl %esi, %edi
23 ; CHECK-NEXT: setne %al
25 %zx = zext i32 %x to i64
26 %zy = zext i32 %y to i64
29 %r = icmp ne i64 %or, 0
33 define i1 @cmp_anybits_concat_shl_shl_i16(i16 %x, i16 %y) {
34 ; CHECK-LABEL: cmp_anybits_concat_shl_shl_i16:
36 ; CHECK-NEXT: # kill: def $esi killed $esi def $rsi
37 ; CHECK-NEXT: # kill: def $edi killed $edi def $rdi
38 ; CHECK-NEXT: movzwl %di, %eax
39 ; CHECK-NEXT: movzwl %si, %ecx
40 ; CHECK-NEXT: shlq $8, %rcx
41 ; CHECK-NEXT: orq %rax, %rcx
42 ; CHECK-NEXT: sete %al
44 %zx = zext i16 %x to i64
45 %zy = zext i16 %y to i64
49 %r = icmp eq i64 %or, 0
53 define i1 @cmp_anybits_concat_shl_shl_i16_commute(i16 %x, i16 %y) {
54 ; CHECK-LABEL: cmp_anybits_concat_shl_shl_i16_commute:
56 ; CHECK-NEXT: # kill: def $esi killed $esi def $rsi
57 ; CHECK-NEXT: # kill: def $edi killed $edi def $rdi
58 ; CHECK-NEXT: movzwl %di, %eax
59 ; CHECK-NEXT: movzwl %si, %ecx
60 ; CHECK-NEXT: shlq $8, %rcx
61 ; CHECK-NEXT: orq %rax, %rcx
62 ; CHECK-NEXT: sete %al
64 %zx = zext i16 %x to i64
65 %zy = zext i16 %y to i64
69 %r = icmp eq i64 %or, 0
73 ; FIXME: Add vector support, but its only worth it if we can freely truncate the
76 define <16 x i8> @cmp_allbits_concat_v16i8(<16 x i8> %x, <16 x i8> %y) {
77 ; CHECK-LABEL: cmp_allbits_concat_v16i8:
79 ; CHECK-NEXT: movdqa %xmm1, %xmm2
80 ; CHECK-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3],xmm2[4],xmm0[4],xmm2[5],xmm0[5],xmm2[6],xmm0[6],xmm2[7],xmm0[7]
81 ; CHECK-NEXT: punpckhbw {{.*#+}} xmm1 = xmm1[8],xmm0[8],xmm1[9],xmm0[9],xmm1[10],xmm0[10],xmm1[11],xmm0[11],xmm1[12],xmm0[12],xmm1[13],xmm0[13],xmm1[14],xmm0[14],xmm1[15],xmm0[15]
82 ; CHECK-NEXT: pcmpeqd %xmm0, %xmm0
83 ; CHECK-NEXT: pcmpeqw %xmm0, %xmm1
84 ; CHECK-NEXT: pcmpeqw %xmm2, %xmm0
85 ; CHECK-NEXT: packsswb %xmm1, %xmm0
87 %zx = zext <16 x i8> %x to <16 x i16>
88 %zy = zext <16 x i8> %y to <16 x i16>
89 %sh = shl <16 x i16> %zx, <i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8, i16 8>
90 %or = or <16 x i16> %zy, %sh
91 %r = icmp eq <16 x i16> %or, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>
92 %s = sext <16 x i1> %r to <16 x i8>
96 define <2 x i64> @cmp_nobits_concat_v2i64(<2 x i64> %x, <2 x i64> %y) {
97 ; CHECK-LABEL: cmp_nobits_concat_v2i64:
99 ; CHECK-NEXT: movq %xmm0, %rax
100 ; CHECK-NEXT: pextrq $1, %xmm0, %rcx
101 ; CHECK-NEXT: movq %xmm1, %rdx
102 ; CHECK-NEXT: pextrq $1, %xmm1, %rsi
103 ; CHECK-NEXT: xorl %edi, %edi
104 ; CHECK-NEXT: orq %rcx, %rsi
105 ; CHECK-NEXT: sete %dil
106 ; CHECK-NEXT: negq %rdi
107 ; CHECK-NEXT: movq %rdi, %xmm1
108 ; CHECK-NEXT: xorl %ecx, %ecx
109 ; CHECK-NEXT: orq %rax, %rdx
110 ; CHECK-NEXT: sete %cl
111 ; CHECK-NEXT: negq %rcx
112 ; CHECK-NEXT: movq %rcx, %xmm0
113 ; CHECK-NEXT: punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm1[0]
115 %zx = zext <2 x i64> %x to <2 x i128>
116 %zy = zext <2 x i64> %y to <2 x i128>
117 %sh = shl <2 x i128> %zx, <i128 64, i128 64>
118 %or = or <2 x i128> %zy, %sh
119 %r = icmp eq <2 x i128> %or, zeroinitializer
120 %s = sext <2 x i1> %r to <2 x i64>