1 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=knl | FileCheck %s 2 3 ; CHECK-LABEL: trunc_16x32_to_16x8 4 ; CHECK: vpmovdb 5 ; CHECK: ret 6 define <16 x i8> @trunc_16x32_to_16x8(<16 x i32> %i) nounwind readnone { 7 %x = trunc <16 x i32> %i to <16 x i8> 8 ret <16 x i8> %x 9 } 10 11 ; CHECK-LABEL: trunc_8x64_to_8x16 12 ; CHECK: vpmovqw 13 ; CHECK: ret 14 define <8 x i16> @trunc_8x64_to_8x16(<8 x i64> %i) nounwind readnone { 15 %x = trunc <8 x i64> %i to <8 x i16> 16 ret <8 x i16> %x 17 } 18 19 20 ; CHECK-LABEL: zext_16x8_to_16x32 21 ; CHECK: vpmovzxbd {{.*}}%zmm 22 ; CHECK: ret 23 define <16 x i32> @zext_16x8_to_16x32(<16 x i8> %i) nounwind readnone { 24 %x = zext <16 x i8> %i to <16 x i32> 25 ret <16 x i32> %x 26 } 27 28 ; CHECK-LABEL: sext_16x8_to_16x32 29 ; CHECK: vpmovsxbd {{.*}}%zmm 30 ; CHECK: ret 31 define <16 x i32> @sext_16x8_to_16x32(<16 x i8> %i) nounwind readnone { 32 %x = sext <16 x i8> %i to <16 x i32> 33 ret <16 x i32> %x 34 } 35 36 37 ; CHECK-LABEL: zext_16x16_to_16x32 38 ; CHECK: vpmovzxwd {{.*}}%zmm 39 ; CHECK: ret 40 define <16 x i32> @zext_16x16_to_16x32(<16 x i16> %i) nounwind readnone { 41 %x = zext <16 x i16> %i to <16 x i32> 42 ret <16 x i32> %x 43 } 44 45 ; CHECK-LABEL: zext_8x16_to_8x64 46 ; CHECK: vpmovzxwq 47 ; CHECK: ret 48 define <8 x i64> @zext_8x16_to_8x64(<8 x i16> %i) nounwind readnone { 49 %x = zext <8 x i16> %i to <8 x i64> 50 ret <8 x i64> %x 51 } 52 53 ;CHECK-LABEL: fptrunc_test 54 ;CHECK: vcvtpd2ps {{.*}}%zmm 55 ;CHECK: ret 56 define <8 x float> @fptrunc_test(<8 x double> %a) nounwind readnone { 57 %b = fptrunc <8 x double> %a to <8 x float> 58 ret <8 x float> %b 59 } 60 61 ;CHECK-LABEL: fpext_test 62 ;CHECK: vcvtps2pd {{.*}}%zmm 63 ;CHECK: ret 64 define <8 x double> @fpext_test(<8 x float> %a) nounwind readnone { 65 %b = fpext <8 x float> %a to <8 x double> 66 ret <8 x double> %b 67 } 68 69 ; CHECK-LABEL: zext_16i1_to_16xi32 70 ; CHECK: vpbroadcastd LCP{{.*}}(%rip), %zmm0 {%k1} {z} 71 ; CHECK: ret 72 define <16 x i32> @zext_16i1_to_16xi32(i16 %b) { 73 %a = bitcast i16 %b to <16 x i1> 74 %c = zext <16 x i1> %a to <16 x i32> 75 ret <16 x i32> %c 76 } 77 78 ; CHECK-LABEL: zext_8i1_to_8xi64 79 ; CHECK: vpbroadcastq LCP{{.*}}(%rip), %zmm0 {%k1} {z} 80 ; CHECK: ret 81 define <8 x i64> @zext_8i1_to_8xi64(i8 %b) { 82 %a = bitcast i8 %b to <8 x i1> 83 %c = zext <8 x i1> %a to <8 x i64> 84 ret <8 x i64> %c 85 } 86 87 ; CHECK-LABEL: trunc_16i8_to_16i1 88 ; CHECK: vpmovsxbd 89 ; CHECK: vpandd 90 ; CHECK: vptestmd 91 ; CHECK: ret 92 define i16 @trunc_16i8_to_16i1(<16 x i8> %a) { 93 %mask_b = trunc <16 x i8>%a to <16 x i1> 94 %mask = bitcast <16 x i1> %mask_b to i16 95 ret i16 %mask 96 } 97 98 ; CHECK-LABEL: trunc_16i32_to_16i1 99 ; CHECK: vpandd 100 ; CHECK: vptestmd 101 ; CHECK: ret 102 define i16 @trunc_16i32_to_16i1(<16 x i32> %a) { 103 %mask_b = trunc <16 x i32>%a to <16 x i1> 104 %mask = bitcast <16 x i1> %mask_b to i16 105 ret i16 %mask 106 } 107 108 ; CHECK-LABEL: trunc_8i16_to_8i1 109 ; CHECK: vpmovsxwq 110 ; CHECK: vpandq LCP{{.*}}(%rip){1to8} 111 ; CHECK: vptestmq 112 ; CHECK: ret 113 define i8 @trunc_8i16_to_8i1(<8 x i16> %a) { 114 %mask_b = trunc <8 x i16>%a to <8 x i1> 115 %mask = bitcast <8 x i1> %mask_b to i8 116 ret i8 %mask 117 } 118 119 ; CHECK-LABEL: sext_8i1_8i32 120 ; CHECK: vpbroadcastq LCP{{.*}}(%rip), %zmm0 {%k1} {z} 121 ; CHECK: ret 122 define <8 x i32> @sext_8i1_8i32(<8 x i32> %a1, <8 x i32> %a2) nounwind { 123 %x = icmp slt <8 x i32> %a1, %a2 124 %x1 = xor <8 x i1>%x, <i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true> 125 %y = sext <8 x i1> %x1 to <8 x i32> 126 ret <8 x i32> %y 127 } 128 129 ; CHECK-LABEL: trunc_v16i32_to_v16i16 130 ; CHECK: vpmovdw 131 ; CHECK: ret 132 define <16 x i16> @trunc_v16i32_to_v16i16(<16 x i32> %x) { 133 %1 = trunc <16 x i32> %x to <16 x i16> 134 ret <16 x i16> %1 135 } 136 137 ; CHECK-LABEL: trunc_i32_to_i1 138 ; CHECK: andl 139 ; CHECK: kmov 140 ; CHECK: kortest 141 ; CKECK: orl 142 ; CHECK: ret 143 define i16 @trunc_i32_to_i1(i32 %a) { 144 %a_i = trunc i32 %a to i1 145 %maskv = insertelement <16 x i1> <i1 true, i1 false, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true>, i1 %a_i, i32 0 146 %res = bitcast <16 x i1> %maskv to i16 147 ret i16 %res 148 } 149