1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ;RUN: llc -mtriple=x86_64-apple-darwin -mcpu=skx < %s | FileCheck %s
4 define i32 @combineTESTM_AND_1(<8 x i64> %a, <8 x i64> %b) {
5 ; CHECK-LABEL: combineTESTM_AND_1:
7 ; CHECK-NEXT: vptestmq %zmm0, %zmm1, %k0
8 ; CHECK-NEXT: kmovb %k0, %eax
9 ; CHECK-NEXT: vzeroupper
11 %and.i = and <8 x i64> %b, %a
12 %test.i = tail call i8 @llvm.x86.avx512.ptestm.q.512(<8 x i64> %and.i, <8 x i64> %and.i, i8 -1)
13 %conv = zext i8 %test.i to i32
17 define i32 @combineTESTM_AND_2(<8 x i64> %a, <8 x i64> %b , i8 %mask) {
18 ; CHECK-LABEL: combineTESTM_AND_2:
20 ; CHECK-NEXT: vptestmq %zmm0, %zmm1, %k0
21 ; CHECK-NEXT: kmovd %k0, %eax
22 ; CHECK-NEXT: andb %dil, %al
23 ; CHECK-NEXT: movzbl %al, %eax
24 ; CHECK-NEXT: vzeroupper
26 %and.i = and <8 x i64> %b, %a
27 %test.i = tail call i8 @llvm.x86.avx512.ptestm.q.512(<8 x i64> %and.i, <8 x i64> %and.i, i8 %mask)
28 %conv = zext i8 %test.i to i32
32 define i32 @combineTESTM_AND_mask_3(<8 x i64> %a, <8 x i64>* %bptr , i8 %mask) {
33 ; CHECK-LABEL: combineTESTM_AND_mask_3:
35 ; CHECK-NEXT: vptestmq (%rdi), %zmm0, %k0
36 ; CHECK-NEXT: kmovd %k0, %eax
37 ; CHECK-NEXT: andb %sil, %al
38 ; CHECK-NEXT: movzbl %al, %eax
39 ; CHECK-NEXT: vzeroupper
41 %b = load <8 x i64>, <8 x i64>* %bptr
42 %and.i = and <8 x i64> %a, %b
43 %test.i = tail call i8 @llvm.x86.avx512.ptestm.q.512(<8 x i64> %and.i, <8 x i64> %and.i, i8 %mask)
44 %conv = zext i8 %test.i to i32
48 define i32 @combineTESTM_AND_mask_4(<8 x i64> %a, <8 x i64>* %bptr , i8 %mask) {
49 ; CHECK-LABEL: combineTESTM_AND_mask_4:
51 ; CHECK-NEXT: vptestmq (%rdi), %zmm0, %k0
52 ; CHECK-NEXT: kmovd %k0, %eax
53 ; CHECK-NEXT: andb %sil, %al
54 ; CHECK-NEXT: movzbl %al, %eax
55 ; CHECK-NEXT: vzeroupper
57 %b = load <8 x i64>, <8 x i64>* %bptr
58 %and.i = and <8 x i64> %b, %a
59 %test.i = tail call i8 @llvm.x86.avx512.ptestm.q.512(<8 x i64> %and.i, <8 x i64> %and.i, i8 %mask)
60 %conv = zext i8 %test.i to i32
64 declare i8 @llvm.x86.avx512.ptestm.q.512(<8 x i64>, <8 x i64>, i8)