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 3 4 ; Function Attrs: norecurse nounwind readnone 5 define zeroext i8 @TEST_mm512_test_epi64_mask(<8 x i64> %__A, <8 x i64> %__B) local_unnamed_addr #0 { 6 ; CHECK-LABEL: TEST_mm512_test_epi64_mask: 7 ; CHECK: # %bb.0: # %entry 8 ; CHECK-NEXT: vptestmq %zmm0, %zmm1, %k0 9 ; CHECK-NEXT: kmovw %k0, %eax 10 ; CHECK-NEXT: # kill: def $al killed $al killed $eax 11 ; CHECK-NEXT: vzeroupper 12 ; CHECK-NEXT: retq 13 entry: 14 %and.i.i = and <8 x i64> %__B, %__A 15 %0 = icmp ne <8 x i64> %and.i.i, zeroinitializer 16 %1 = bitcast <8 x i1> %0 to i8 17 ret i8 %1 18 } 19 20 ; Similar to the above, but the compare is reversed to have the zeros on the LHS 21 define zeroext i8 @TEST_mm512_test_epi64_mask_2(<8 x i64> %__A, <8 x i64> %__B) local_unnamed_addr #0 { 22 ; CHECK-LABEL: TEST_mm512_test_epi64_mask_2: 23 ; CHECK: # %bb.0: # %entry 24 ; CHECK-NEXT: vptestmq %zmm0, %zmm1, %k0 25 ; CHECK-NEXT: kmovw %k0, %eax 26 ; CHECK-NEXT: # kill: def $al killed $al killed $eax 27 ; CHECK-NEXT: vzeroupper 28 ; CHECK-NEXT: retq 29 entry: 30 %and.i.i = and <8 x i64> %__B, %__A 31 %0 = icmp ne <8 x i64> zeroinitializer, %and.i.i 32 %1 = bitcast <8 x i1> %0 to i8 33 ret i8 %1 34 } 35 36 ; Function Attrs: norecurse nounwind readnone 37 define zeroext i16 @TEST_mm512_test_epi32_mask(<8 x i64> %__A, <8 x i64> %__B) local_unnamed_addr #0 { 38 ; CHECK-LABEL: TEST_mm512_test_epi32_mask: 39 ; CHECK: # %bb.0: # %entry 40 ; CHECK-NEXT: vptestmd %zmm0, %zmm1, %k0 41 ; CHECK-NEXT: kmovw %k0, %eax 42 ; CHECK-NEXT: # kill: def $ax killed $ax killed $eax 43 ; CHECK-NEXT: vzeroupper 44 ; CHECK-NEXT: retq 45 entry: 46 %and.i.i = and <8 x i64> %__B, %__A 47 %0 = bitcast <8 x i64> %and.i.i to <16 x i32> 48 %1 = icmp ne <16 x i32> %0, zeroinitializer 49 %2 = bitcast <16 x i1> %1 to i16 50 ret i16 %2 51 } 52 53 ; Function Attrs: norecurse nounwind readnone 54 define zeroext i8 @TEST_mm512_mask_test_epi64_mask(i8 %__U, <8 x i64> %__A, <8 x i64> %__B) local_unnamed_addr #0 { 55 ; CHECK-LABEL: TEST_mm512_mask_test_epi64_mask: 56 ; CHECK: # %bb.0: # %entry 57 ; CHECK-NEXT: vptestmq %zmm0, %zmm1, %k0 58 ; CHECK-NEXT: kmovw %k0, %eax 59 ; CHECK-NEXT: andb %dil, %al 60 ; CHECK-NEXT: # kill: def $al killed $al killed $eax 61 ; CHECK-NEXT: vzeroupper 62 ; CHECK-NEXT: retq 63 entry: 64 %and.i.i = and <8 x i64> %__B, %__A 65 %0 = icmp ne <8 x i64> %and.i.i, zeroinitializer 66 %1 = bitcast i8 %__U to <8 x i1> 67 %2 = and <8 x i1> %0, %1 68 %3 = bitcast <8 x i1> %2 to i8 69 ret i8 %3 70 } 71 72 ; Function Attrs: norecurse nounwind readnone 73 define zeroext i16 @TEST_mm512_mask_test_epi32_mask(i16 %__U, <8 x i64> %__A, <8 x i64> %__B) local_unnamed_addr #0 { 74 ; CHECK-LABEL: TEST_mm512_mask_test_epi32_mask: 75 ; CHECK: # %bb.0: # %entry 76 ; CHECK-NEXT: vptestmd %zmm0, %zmm1, %k0 77 ; CHECK-NEXT: kmovw %k0, %eax 78 ; CHECK-NEXT: andl %edi, %eax 79 ; CHECK-NEXT: # kill: def $ax killed $ax killed $eax 80 ; CHECK-NEXT: vzeroupper 81 ; CHECK-NEXT: retq 82 entry: 83 %and.i.i = and <8 x i64> %__B, %__A 84 %0 = bitcast <8 x i64> %and.i.i to <16 x i32> 85 %1 = icmp ne <16 x i32> %0, zeroinitializer 86 %2 = bitcast i16 %__U to <16 x i1> 87 %3 = and <16 x i1> %1, %2 88 %4 = bitcast <16 x i1> %3 to i16 89 ret i16 %4 90 } 91 92 ; Function Attrs: norecurse nounwind readnone 93 define zeroext i8 @TEST_mm512_testn_epi64_mask(<8 x i64> %__A, <8 x i64> %__B) local_unnamed_addr #0 { 94 ; CHECK-LABEL: TEST_mm512_testn_epi64_mask: 95 ; CHECK: # %bb.0: # %entry 96 ; CHECK-NEXT: vptestnmq %zmm0, %zmm1, %k0 97 ; CHECK-NEXT: kmovw %k0, %eax 98 ; CHECK-NEXT: # kill: def $al killed $al killed $eax 99 ; CHECK-NEXT: vzeroupper 100 ; CHECK-NEXT: retq 101 entry: 102 %and.i.i = and <8 x i64> %__B, %__A 103 %0 = icmp eq <8 x i64> %and.i.i, zeroinitializer 104 %1 = bitcast <8 x i1> %0 to i8 105 ret i8 %1 106 } 107 108 ; Similar to the above, but the compare is reversed to have the zeros on the LHS 109 define zeroext i8 @TEST_mm512_testn_epi64_mask_2(<8 x i64> %__A, <8 x i64> %__B) local_unnamed_addr #0 { 110 ; CHECK-LABEL: TEST_mm512_testn_epi64_mask_2: 111 ; CHECK: # %bb.0: # %entry 112 ; CHECK-NEXT: vptestnmq %zmm0, %zmm1, %k0 113 ; CHECK-NEXT: kmovw %k0, %eax 114 ; CHECK-NEXT: # kill: def $al killed $al killed $eax 115 ; CHECK-NEXT: vzeroupper 116 ; CHECK-NEXT: retq 117 entry: 118 %and.i.i = and <8 x i64> %__B, %__A 119 %0 = icmp eq <8 x i64> zeroinitializer, %and.i.i 120 %1 = bitcast <8 x i1> %0 to i8 121 ret i8 %1 122 } 123 124 ; Function Attrs: norecurse nounwind readnone 125 define zeroext i16 @TEST_mm512_testn_epi32_mask(<8 x i64> %__A, <8 x i64> %__B) local_unnamed_addr #0 { 126 ; CHECK-LABEL: TEST_mm512_testn_epi32_mask: 127 ; CHECK: # %bb.0: # %entry 128 ; CHECK-NEXT: vptestnmd %zmm0, %zmm1, %k0 129 ; CHECK-NEXT: kmovw %k0, %eax 130 ; CHECK-NEXT: # kill: def $ax killed $ax killed $eax 131 ; CHECK-NEXT: vzeroupper 132 ; CHECK-NEXT: retq 133 entry: 134 %and.i.i = and <8 x i64> %__B, %__A 135 %0 = bitcast <8 x i64> %and.i.i to <16 x i32> 136 %1 = icmp eq <16 x i32> %0, zeroinitializer 137 %2 = bitcast <16 x i1> %1 to i16 138 ret i16 %2 139 } 140 141 ; Function Attrs: norecurse nounwind readnone 142 define zeroext i8 @TEST_mm512_mask_testn_epi64_mask(i8 %__U, <8 x i64> %__A, <8 x i64> %__B) local_unnamed_addr #0 { 143 ; CHECK-LABEL: TEST_mm512_mask_testn_epi64_mask: 144 ; CHECK: # %bb.0: # %entry 145 ; CHECK-NEXT: vptestnmq %zmm0, %zmm1, %k0 146 ; CHECK-NEXT: kmovw %k0, %eax 147 ; CHECK-NEXT: andb %dil, %al 148 ; CHECK-NEXT: # kill: def $al killed $al killed $eax 149 ; CHECK-NEXT: vzeroupper 150 ; CHECK-NEXT: retq 151 entry: 152 %and.i.i = and <8 x i64> %__B, %__A 153 %0 = icmp eq <8 x i64> %and.i.i, zeroinitializer 154 %1 = bitcast i8 %__U to <8 x i1> 155 %2 = and <8 x i1> %0, %1 156 %3 = bitcast <8 x i1> %2 to i8 157 ret i8 %3 158 } 159 160 ; Function Attrs: norecurse nounwind readnone 161 define zeroext i16 @TEST_mm512_mask_testn_epi32_mask(i16 %__U, <8 x i64> %__A, <8 x i64> %__B) local_unnamed_addr #0 { 162 ; CHECK-LABEL: TEST_mm512_mask_testn_epi32_mask: 163 ; CHECK: # %bb.0: # %entry 164 ; CHECK-NEXT: vptestnmd %zmm0, %zmm1, %k0 165 ; CHECK-NEXT: kmovw %k0, %eax 166 ; CHECK-NEXT: andl %edi, %eax 167 ; CHECK-NEXT: # kill: def $ax killed $ax killed $eax 168 ; CHECK-NEXT: vzeroupper 169 ; CHECK-NEXT: retq 170 entry: 171 %and.i.i = and <8 x i64> %__B, %__A 172 %0 = bitcast <8 x i64> %and.i.i to <16 x i32> 173 %1 = icmp eq <16 x i32> %0, zeroinitializer 174 %2 = bitcast i16 %__U to <16 x i1> 175 %3 = and <16 x i1> %1, %2 176 %4 = bitcast <16 x i1> %3 to i16 177 ret i16 %4 178 } 179 180