1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f | FileCheck %s --check-prefix=CHECK --check-prefix=X64 3; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+avx512f | FileCheck %s --check-prefix=CHECK --check-prefix=X86 4 5; Function Attrs: norecurse nounwind readnone 6define zeroext i8 @TEST_mm512_test_epi64_mask(<8 x i64> %__A, <8 x i64> %__B) local_unnamed_addr #0 { 7; CHECK-LABEL: TEST_mm512_test_epi64_mask: 8; CHECK: # %bb.0: # %entry 9; CHECK-NEXT: vptestmq %zmm0, %zmm1, %k0 10; CHECK-NEXT: kmovw %k0, %eax 11; CHECK-NEXT: # kill: def $al killed $al killed $eax 12; CHECK-NEXT: vzeroupper 13; CHECK-NEXT: ret{{[l|q]}} 14entry: 15 %and.i.i = and <8 x i64> %__B, %__A 16 %0 = icmp ne <8 x i64> %and.i.i, zeroinitializer 17 %1 = bitcast <8 x i1> %0 to i8 18 ret i8 %1 19} 20 21; Similar to the above, but the compare is reversed to have the zeros on the LHS 22define zeroext i8 @TEST_mm512_test_epi64_mask_2(<8 x i64> %__A, <8 x i64> %__B) local_unnamed_addr #0 { 23; CHECK-LABEL: TEST_mm512_test_epi64_mask_2: 24; CHECK: # %bb.0: # %entry 25; CHECK-NEXT: vptestmq %zmm0, %zmm1, %k0 26; CHECK-NEXT: kmovw %k0, %eax 27; CHECK-NEXT: # kill: def $al killed $al killed $eax 28; CHECK-NEXT: vzeroupper 29; CHECK-NEXT: ret{{[l|q]}} 30entry: 31 %and.i.i = and <8 x i64> %__B, %__A 32 %0 = icmp ne <8 x i64> zeroinitializer, %and.i.i 33 %1 = bitcast <8 x i1> %0 to i8 34 ret i8 %1 35} 36 37; Function Attrs: norecurse nounwind readnone 38define zeroext i16 @TEST_mm512_test_epi32_mask(<8 x i64> %__A, <8 x i64> %__B) local_unnamed_addr #0 { 39; CHECK-LABEL: TEST_mm512_test_epi32_mask: 40; CHECK: # %bb.0: # %entry 41; CHECK-NEXT: vptestmd %zmm0, %zmm1, %k0 42; CHECK-NEXT: kmovw %k0, %eax 43; CHECK-NEXT: # kill: def $ax killed $ax killed $eax 44; CHECK-NEXT: vzeroupper 45; CHECK-NEXT: ret{{[l|q]}} 46entry: 47 %and.i.i = and <8 x i64> %__B, %__A 48 %0 = bitcast <8 x i64> %and.i.i to <16 x i32> 49 %1 = icmp ne <16 x i32> %0, zeroinitializer 50 %2 = bitcast <16 x i1> %1 to i16 51 ret i16 %2 52} 53 54; Function Attrs: norecurse nounwind readnone 55define zeroext i8 @TEST_mm512_mask_test_epi64_mask(i8 %__U, <8 x i64> %__A, <8 x i64> %__B) local_unnamed_addr #0 { 56; X64-LABEL: TEST_mm512_mask_test_epi64_mask: 57; X64: # %bb.0: # %entry 58; X64-NEXT: vptestmq %zmm0, %zmm1, %k0 59; X64-NEXT: kmovw %k0, %eax 60; X64-NEXT: andb %dil, %al 61; X64-NEXT: # kill: def $al killed $al killed $eax 62; X64-NEXT: vzeroupper 63; X64-NEXT: retq 64; 65; X86-LABEL: TEST_mm512_mask_test_epi64_mask: 66; X86: # %bb.0: # %entry 67; X86-NEXT: vptestmq %zmm0, %zmm1, %k0 68; X86-NEXT: kmovw %k0, %eax 69; X86-NEXT: andb {{[0-9]+}}(%esp), %al 70; X86-NEXT: # kill: def $al killed $al killed $eax 71; X86-NEXT: vzeroupper 72; X86-NEXT: retl 73entry: 74 %and.i.i = and <8 x i64> %__B, %__A 75 %0 = icmp ne <8 x i64> %and.i.i, zeroinitializer 76 %1 = bitcast i8 %__U to <8 x i1> 77 %2 = and <8 x i1> %0, %1 78 %3 = bitcast <8 x i1> %2 to i8 79 ret i8 %3 80} 81 82; Function Attrs: norecurse nounwind readnone 83define zeroext i16 @TEST_mm512_mask_test_epi32_mask(i16 %__U, <8 x i64> %__A, <8 x i64> %__B) local_unnamed_addr #0 { 84; X64-LABEL: TEST_mm512_mask_test_epi32_mask: 85; X64: # %bb.0: # %entry 86; X64-NEXT: vptestmd %zmm0, %zmm1, %k0 87; X64-NEXT: kmovw %k0, %eax 88; X64-NEXT: andl %edi, %eax 89; X64-NEXT: # kill: def $ax killed $ax killed $eax 90; X64-NEXT: vzeroupper 91; X64-NEXT: retq 92; 93; X86-LABEL: TEST_mm512_mask_test_epi32_mask: 94; X86: # %bb.0: # %entry 95; X86-NEXT: vptestmd %zmm0, %zmm1, %k0 96; X86-NEXT: kmovw %k0, %eax 97; X86-NEXT: andw {{[0-9]+}}(%esp), %ax 98; X86-NEXT: # kill: def $ax killed $ax killed $eax 99; X86-NEXT: vzeroupper 100; X86-NEXT: retl 101entry: 102 %and.i.i = and <8 x i64> %__B, %__A 103 %0 = bitcast <8 x i64> %and.i.i to <16 x i32> 104 %1 = icmp ne <16 x i32> %0, zeroinitializer 105 %2 = bitcast i16 %__U to <16 x i1> 106 %3 = and <16 x i1> %1, %2 107 %4 = bitcast <16 x i1> %3 to i16 108 ret i16 %4 109} 110 111; Function Attrs: norecurse nounwind readnone 112define zeroext i8 @TEST_mm512_testn_epi64_mask(<8 x i64> %__A, <8 x i64> %__B) local_unnamed_addr #0 { 113; CHECK-LABEL: TEST_mm512_testn_epi64_mask: 114; CHECK: # %bb.0: # %entry 115; CHECK-NEXT: vptestnmq %zmm0, %zmm1, %k0 116; CHECK-NEXT: kmovw %k0, %eax 117; CHECK-NEXT: # kill: def $al killed $al killed $eax 118; CHECK-NEXT: vzeroupper 119; CHECK-NEXT: ret{{[l|q]}} 120entry: 121 %and.i.i = and <8 x i64> %__B, %__A 122 %0 = icmp eq <8 x i64> %and.i.i, zeroinitializer 123 %1 = bitcast <8 x i1> %0 to i8 124 ret i8 %1 125} 126 127; Similar to the above, but the compare is reversed to have the zeros on the LHS 128define zeroext i8 @TEST_mm512_testn_epi64_mask_2(<8 x i64> %__A, <8 x i64> %__B) local_unnamed_addr #0 { 129; CHECK-LABEL: TEST_mm512_testn_epi64_mask_2: 130; CHECK: # %bb.0: # %entry 131; CHECK-NEXT: vptestnmq %zmm0, %zmm1, %k0 132; CHECK-NEXT: kmovw %k0, %eax 133; CHECK-NEXT: # kill: def $al killed $al killed $eax 134; CHECK-NEXT: vzeroupper 135; CHECK-NEXT: ret{{[l|q]}} 136entry: 137 %and.i.i = and <8 x i64> %__B, %__A 138 %0 = icmp eq <8 x i64> zeroinitializer, %and.i.i 139 %1 = bitcast <8 x i1> %0 to i8 140 ret i8 %1 141} 142 143; Function Attrs: norecurse nounwind readnone 144define zeroext i16 @TEST_mm512_testn_epi32_mask(<8 x i64> %__A, <8 x i64> %__B) local_unnamed_addr #0 { 145; CHECK-LABEL: TEST_mm512_testn_epi32_mask: 146; CHECK: # %bb.0: # %entry 147; CHECK-NEXT: vptestnmd %zmm0, %zmm1, %k0 148; CHECK-NEXT: kmovw %k0, %eax 149; CHECK-NEXT: # kill: def $ax killed $ax killed $eax 150; CHECK-NEXT: vzeroupper 151; CHECK-NEXT: ret{{[l|q]}} 152entry: 153 %and.i.i = and <8 x i64> %__B, %__A 154 %0 = bitcast <8 x i64> %and.i.i to <16 x i32> 155 %1 = icmp eq <16 x i32> %0, zeroinitializer 156 %2 = bitcast <16 x i1> %1 to i16 157 ret i16 %2 158} 159 160; Function Attrs: norecurse nounwind readnone 161define zeroext i8 @TEST_mm512_mask_testn_epi64_mask(i8 %__U, <8 x i64> %__A, <8 x i64> %__B) local_unnamed_addr #0 { 162; X64-LABEL: TEST_mm512_mask_testn_epi64_mask: 163; X64: # %bb.0: # %entry 164; X64-NEXT: vptestnmq %zmm0, %zmm1, %k0 165; X64-NEXT: kmovw %k0, %eax 166; X64-NEXT: andb %dil, %al 167; X64-NEXT: # kill: def $al killed $al killed $eax 168; X64-NEXT: vzeroupper 169; X64-NEXT: retq 170; 171; X86-LABEL: TEST_mm512_mask_testn_epi64_mask: 172; X86: # %bb.0: # %entry 173; X86-NEXT: vptestnmq %zmm0, %zmm1, %k0 174; X86-NEXT: kmovw %k0, %eax 175; X86-NEXT: andb {{[0-9]+}}(%esp), %al 176; X86-NEXT: # kill: def $al killed $al killed $eax 177; X86-NEXT: vzeroupper 178; X86-NEXT: retl 179entry: 180 %and.i.i = and <8 x i64> %__B, %__A 181 %0 = icmp eq <8 x i64> %and.i.i, zeroinitializer 182 %1 = bitcast i8 %__U to <8 x i1> 183 %2 = and <8 x i1> %0, %1 184 %3 = bitcast <8 x i1> %2 to i8 185 ret i8 %3 186} 187 188; Function Attrs: norecurse nounwind readnone 189define zeroext i16 @TEST_mm512_mask_testn_epi32_mask(i16 %__U, <8 x i64> %__A, <8 x i64> %__B) local_unnamed_addr #0 { 190; X64-LABEL: TEST_mm512_mask_testn_epi32_mask: 191; X64: # %bb.0: # %entry 192; X64-NEXT: vptestnmd %zmm0, %zmm1, %k0 193; X64-NEXT: kmovw %k0, %eax 194; X64-NEXT: andl %edi, %eax 195; X64-NEXT: # kill: def $ax killed $ax killed $eax 196; X64-NEXT: vzeroupper 197; X64-NEXT: retq 198; 199; X86-LABEL: TEST_mm512_mask_testn_epi32_mask: 200; X86: # %bb.0: # %entry 201; X86-NEXT: vptestnmd %zmm0, %zmm1, %k0 202; X86-NEXT: kmovw %k0, %eax 203; X86-NEXT: andw {{[0-9]+}}(%esp), %ax 204; X86-NEXT: # kill: def $ax killed $ax killed $eax 205; X86-NEXT: vzeroupper 206; X86-NEXT: retl 207entry: 208 %and.i.i = and <8 x i64> %__B, %__A 209 %0 = bitcast <8 x i64> %and.i.i to <16 x i32> 210 %1 = icmp eq <16 x i32> %0, zeroinitializer 211 %2 = bitcast i16 %__U to <16 x i1> 212 %3 = and <16 x i1> %1, %2 213 %4 = bitcast <16 x i1> %3 to i16 214 ret i16 %4 215} 216 217define <2 x i64> @setcc_commute(<2 x i64> %a) { 218; CHECK-LABEL: setcc_commute: 219; CHECK: # %bb.0: 220; CHECK-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0 221; CHECK-NEXT: vpxor %xmm1, %xmm1, %xmm1 222; CHECK-NEXT: vpsubq %xmm0, %xmm1, %xmm1 223; CHECK-NEXT: vptestnmq %zmm0, %zmm0, %k1 224; CHECK-NEXT: vmovdqa64 %zmm0, %zmm1 {%k1} 225; CHECK-NEXT: vmovdqa %xmm1, %xmm0 226; CHECK-NEXT: vzeroupper 227; CHECK-NEXT: ret{{[l|q]}} 228 %1 = sub <2 x i64> zeroinitializer, %a 229 %2 = icmp eq <2 x i64> %a, zeroinitializer 230 %3 = select <2 x i1> %2, <2 x i64> %a, <2 x i64> %1 231 ret <2 x i64> %3 232} 233