1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2 ; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefix=X32 3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefix=X64 4 5 define <4 x i64> @vpandn(<4 x i64> %a, <4 x i64> %b) nounwind uwtable readnone ssp { 6 ; X32-LABEL: vpandn: 7 ; X32: # %bb.0: # %entry 8 ; X32-NEXT: vpcmpeqd %ymm1, %ymm1, %ymm1 9 ; X32-NEXT: vpsubq %ymm1, %ymm0, %ymm1 10 ; X32-NEXT: vpandn %ymm0, %ymm1, %ymm0 11 ; X32-NEXT: retl 12 ; 13 ; X64-LABEL: vpandn: 14 ; X64: # %bb.0: # %entry 15 ; X64-NEXT: vpcmpeqd %ymm1, %ymm1, %ymm1 16 ; X64-NEXT: vpsubq %ymm1, %ymm0, %ymm1 17 ; X64-NEXT: vpandn %ymm0, %ymm1, %ymm0 18 ; X64-NEXT: retq 19 entry: 20 ; Force the execution domain with an add. 21 %a2 = add <4 x i64> %a, <i64 1, i64 1, i64 1, i64 1> 22 %y = xor <4 x i64> %a2, <i64 -1, i64 -1, i64 -1, i64 -1> 23 %x = and <4 x i64> %a, %y 24 ret <4 x i64> %x 25 } 26 27 define <4 x i64> @vpand(<4 x i64> %a, <4 x i64> %b) nounwind uwtable readnone ssp { 28 ; X32-LABEL: vpand: 29 ; X32: # %bb.0: # %entry 30 ; X32-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2 31 ; X32-NEXT: vpsubq %ymm2, %ymm0, %ymm0 32 ; X32-NEXT: vpand %ymm1, %ymm0, %ymm0 33 ; X32-NEXT: retl 34 ; 35 ; X64-LABEL: vpand: 36 ; X64: # %bb.0: # %entry 37 ; X64-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2 38 ; X64-NEXT: vpsubq %ymm2, %ymm0, %ymm0 39 ; X64-NEXT: vpand %ymm1, %ymm0, %ymm0 40 ; X64-NEXT: retq 41 entry: 42 ; Force the execution domain with an add. 43 %a2 = add <4 x i64> %a, <i64 1, i64 1, i64 1, i64 1> 44 %x = and <4 x i64> %a2, %b 45 ret <4 x i64> %x 46 } 47 48 define <4 x i64> @vpor(<4 x i64> %a, <4 x i64> %b) nounwind uwtable readnone ssp { 49 ; X32-LABEL: vpor: 50 ; X32: # %bb.0: # %entry 51 ; X32-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2 52 ; X32-NEXT: vpsubq %ymm2, %ymm0, %ymm0 53 ; X32-NEXT: vpor %ymm1, %ymm0, %ymm0 54 ; X32-NEXT: retl 55 ; 56 ; X64-LABEL: vpor: 57 ; X64: # %bb.0: # %entry 58 ; X64-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2 59 ; X64-NEXT: vpsubq %ymm2, %ymm0, %ymm0 60 ; X64-NEXT: vpor %ymm1, %ymm0, %ymm0 61 ; X64-NEXT: retq 62 entry: 63 ; Force the execution domain with an add. 64 %a2 = add <4 x i64> %a, <i64 1, i64 1, i64 1, i64 1> 65 %x = or <4 x i64> %a2, %b 66 ret <4 x i64> %x 67 } 68 69 define <4 x i64> @vpxor(<4 x i64> %a, <4 x i64> %b) nounwind uwtable readnone ssp { 70 ; X32-LABEL: vpxor: 71 ; X32: # %bb.0: # %entry 72 ; X32-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2 73 ; X32-NEXT: vpsubq %ymm2, %ymm0, %ymm0 74 ; X32-NEXT: vpxor %ymm1, %ymm0, %ymm0 75 ; X32-NEXT: retl 76 ; 77 ; X64-LABEL: vpxor: 78 ; X64: # %bb.0: # %entry 79 ; X64-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2 80 ; X64-NEXT: vpsubq %ymm2, %ymm0, %ymm0 81 ; X64-NEXT: vpxor %ymm1, %ymm0, %ymm0 82 ; X64-NEXT: retq 83 entry: 84 ; Force the execution domain with an add. 85 %a2 = add <4 x i64> %a, <i64 1, i64 1, i64 1, i64 1> 86 %x = xor <4 x i64> %a2, %b 87 ret <4 x i64> %x 88 } 89 90 define <32 x i8> @vpblendvb(<32 x i1> %cond, <32 x i8> %x, <32 x i8> %y) { 91 ; X32-LABEL: vpblendvb: 92 ; X32: # %bb.0: 93 ; X32-NEXT: vpsllw $7, %ymm0, %ymm0 94 ; X32-NEXT: vpand {{\.LCPI.*}}, %ymm0, %ymm0 95 ; X32-NEXT: vpblendvb %ymm0, %ymm1, %ymm2, %ymm0 96 ; X32-NEXT: retl 97 ; 98 ; X64-LABEL: vpblendvb: 99 ; X64: # %bb.0: 100 ; X64-NEXT: vpsllw $7, %ymm0, %ymm0 101 ; X64-NEXT: vpand {{.*}}(%rip), %ymm0, %ymm0 102 ; X64-NEXT: vpblendvb %ymm0, %ymm1, %ymm2, %ymm0 103 ; X64-NEXT: retq 104 %min = select <32 x i1> %cond, <32 x i8> %x, <32 x i8> %y 105 ret <32 x i8> %min 106 } 107 108 define <8 x i32> @allOnes() nounwind { 109 ; X32-LABEL: allOnes: 110 ; X32: # %bb.0: 111 ; X32-NEXT: vpcmpeqd %ymm0, %ymm0, %ymm0 112 ; X32-NEXT: retl 113 ; 114 ; X64-LABEL: allOnes: 115 ; X64: # %bb.0: 116 ; X64-NEXT: vpcmpeqd %ymm0, %ymm0, %ymm0 117 ; X64-NEXT: retq 118 ret <8 x i32> <i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1> 119 } 120 121 define <16 x i16> @allOnes2() nounwind { 122 ; X32-LABEL: allOnes2: 123 ; X32: # %bb.0: 124 ; X32-NEXT: vpcmpeqd %ymm0, %ymm0, %ymm0 125 ; X32-NEXT: retl 126 ; 127 ; X64-LABEL: allOnes2: 128 ; X64: # %bb.0: 129 ; X64-NEXT: vpcmpeqd %ymm0, %ymm0, %ymm0 130 ; X64-NEXT: retq 131 ret <16 x i16> <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> 132 } 133