1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2;RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=knl | FileCheck %s --check-prefix=CHECK --check-prefix=KNL 3;RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=skx | FileCheck %s --check-prefix=CHECK --check-prefix=SKX 4 5define <16 x i32> @shift_16_i32(<16 x i32> %a) { 6; CHECK-LABEL: shift_16_i32: 7; CHECK: # %bb.0: 8; CHECK-NEXT: vpsrld $1, %zmm0, %zmm0 9; CHECK-NEXT: vpslld $12, %zmm0, %zmm0 10; CHECK-NEXT: vpsrad $12, %zmm0, %zmm0 11; CHECK-NEXT: retq 12 %b = lshr <16 x i32> %a, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1> 13 %c = shl <16 x i32> %b, <i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12> 14 %d = ashr <16 x i32> %c, <i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12> 15 ret <16 x i32> %d; 16} 17 18define <8 x i64> @shift_8_i64(<8 x i64> %a) { 19; CHECK-LABEL: shift_8_i64: 20; CHECK: # %bb.0: 21; CHECK-NEXT: vpsrlq $1, %zmm0, %zmm0 22; CHECK-NEXT: vpsllq $12, %zmm0, %zmm0 23; CHECK-NEXT: vpsraq $12, %zmm0, %zmm0 24; CHECK-NEXT: retq 25 %b = lshr <8 x i64> %a, <i64 1, i64 1, i64 1, i64 1, i64 1, i64 1, i64 1, i64 1> 26 %c = shl <8 x i64> %b, <i64 12, i64 12, i64 12, i64 12, i64 12, i64 12, i64 12, i64 12> 27 %d = ashr <8 x i64> %c, <i64 12, i64 12, i64 12, i64 12, i64 12, i64 12, i64 12, i64 12> 28 ret <8 x i64> %d; 29} 30 31define <4 x i64> @shift_4_i64(<4 x i64> %a) { 32; KNL-LABEL: shift_4_i64: 33; KNL: # %bb.0: 34; KNL-NEXT: vpsrlq $1, %ymm0, %ymm0 35; KNL-NEXT: vpsllq $12, %ymm0, %ymm0 36; KNL-NEXT: vpsraq $12, %zmm0, %zmm0 37; KNL-NEXT: # kill: def $ymm0 killed $ymm0 killed $zmm0 38; KNL-NEXT: retq 39; 40; SKX-LABEL: shift_4_i64: 41; SKX: # %bb.0: 42; SKX-NEXT: vpsrlq $1, %ymm0, %ymm0 43; SKX-NEXT: vpsllq $12, %ymm0, %ymm0 44; SKX-NEXT: vpsraq $12, %ymm0, %ymm0 45; SKX-NEXT: retq 46 %b = lshr <4 x i64> %a, <i64 1, i64 1, i64 1, i64 1> 47 %c = shl <4 x i64> %b, <i64 12, i64 12, i64 12, i64 12> 48 %d = ashr <4 x i64> %c, <i64 12, i64 12, i64 12, i64 12> 49 ret <4 x i64> %d; 50} 51 52define <8 x i64> @variable_shl4(<8 x i64> %x, <8 x i64> %y) { 53; CHECK-LABEL: variable_shl4: 54; CHECK: # %bb.0: 55; CHECK-NEXT: vpsllvq %zmm1, %zmm0, %zmm0 56; CHECK-NEXT: retq 57 %k = shl <8 x i64> %x, %y 58 ret <8 x i64> %k 59} 60 61define <16 x i32> @variable_shl5(<16 x i32> %x, <16 x i32> %y) { 62; CHECK-LABEL: variable_shl5: 63; CHECK: # %bb.0: 64; CHECK-NEXT: vpsllvd %zmm1, %zmm0, %zmm0 65; CHECK-NEXT: retq 66 %k = shl <16 x i32> %x, %y 67 ret <16 x i32> %k 68} 69 70define <16 x i32> @variable_srl0(<16 x i32> %x, <16 x i32> %y) { 71; CHECK-LABEL: variable_srl0: 72; CHECK: # %bb.0: 73; CHECK-NEXT: vpsrlvd %zmm1, %zmm0, %zmm0 74; CHECK-NEXT: retq 75 %k = lshr <16 x i32> %x, %y 76 ret <16 x i32> %k 77} 78 79define <8 x i64> @variable_srl2(<8 x i64> %x, <8 x i64> %y) { 80; CHECK-LABEL: variable_srl2: 81; CHECK: # %bb.0: 82; CHECK-NEXT: vpsrlvq %zmm1, %zmm0, %zmm0 83; CHECK-NEXT: retq 84 %k = lshr <8 x i64> %x, %y 85 ret <8 x i64> %k 86} 87 88define <16 x i32> @variable_sra1(<16 x i32> %x, <16 x i32> %y) { 89; CHECK-LABEL: variable_sra1: 90; CHECK: # %bb.0: 91; CHECK-NEXT: vpsravd %zmm1, %zmm0, %zmm0 92; CHECK-NEXT: retq 93 %k = ashr <16 x i32> %x, %y 94 ret <16 x i32> %k 95} 96 97define <8 x i64> @variable_sra2(<8 x i64> %x, <8 x i64> %y) { 98; CHECK-LABEL: variable_sra2: 99; CHECK: # %bb.0: 100; CHECK-NEXT: vpsravq %zmm1, %zmm0, %zmm0 101; CHECK-NEXT: retq 102 %k = ashr <8 x i64> %x, %y 103 ret <8 x i64> %k 104} 105 106define <4 x i64> @variable_sra3(<4 x i64> %x, <4 x i64> %y) { 107; KNL-LABEL: variable_sra3: 108; KNL: # %bb.0: 109; KNL-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1 110; KNL-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0 111; KNL-NEXT: vpsravq %zmm1, %zmm0, %zmm0 112; KNL-NEXT: # kill: def $ymm0 killed $ymm0 killed $zmm0 113; KNL-NEXT: retq 114; 115; SKX-LABEL: variable_sra3: 116; SKX: # %bb.0: 117; SKX-NEXT: vpsravq %ymm1, %ymm0, %ymm0 118; SKX-NEXT: retq 119 %k = ashr <4 x i64> %x, %y 120 ret <4 x i64> %k 121} 122 123define <8 x i16> @variable_sra4(<8 x i16> %x, <8 x i16> %y) { 124; KNL-LABEL: variable_sra4: 125; KNL: # %bb.0: 126; KNL-NEXT: vpmovzxwd {{.*#+}} ymm1 = xmm1[0],zero,xmm1[1],zero,xmm1[2],zero,xmm1[3],zero,xmm1[4],zero,xmm1[5],zero,xmm1[6],zero,xmm1[7],zero 127; KNL-NEXT: vpmovsxwd %xmm0, %ymm0 128; KNL-NEXT: vpsravd %ymm1, %ymm0, %ymm0 129; KNL-NEXT: vpmovdw %zmm0, %ymm0 130; KNL-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0 131; KNL-NEXT: retq 132; 133; SKX-LABEL: variable_sra4: 134; SKX: # %bb.0: 135; SKX-NEXT: vpsravw %xmm1, %xmm0, %xmm0 136; SKX-NEXT: retq 137 %k = ashr <8 x i16> %x, %y 138 ret <8 x i16> %k 139} 140 141define <16 x i32> @variable_sra01_load(<16 x i32> %x, <16 x i32>* %y) { 142; CHECK-LABEL: variable_sra01_load: 143; CHECK: # %bb.0: 144; CHECK-NEXT: vpsravd (%rdi), %zmm0, %zmm0 145; CHECK-NEXT: retq 146 %y1 = load <16 x i32>, <16 x i32>* %y 147 %k = ashr <16 x i32> %x, %y1 148 ret <16 x i32> %k 149} 150 151define <16 x i32> @variable_shl1_load(<16 x i32> %x, <16 x i32>* %y) { 152; CHECK-LABEL: variable_shl1_load: 153; CHECK: # %bb.0: 154; CHECK-NEXT: vpsllvd (%rdi), %zmm0, %zmm0 155; CHECK-NEXT: retq 156 %y1 = load <16 x i32>, <16 x i32>* %y 157 %k = shl <16 x i32> %x, %y1 158 ret <16 x i32> %k 159} 160 161define <16 x i32> @variable_srl0_load(<16 x i32> %x, <16 x i32>* %y) { 162; CHECK-LABEL: variable_srl0_load: 163; CHECK: # %bb.0: 164; CHECK-NEXT: vpsrlvd (%rdi), %zmm0, %zmm0 165; CHECK-NEXT: retq 166 %y1 = load <16 x i32>, <16 x i32>* %y 167 %k = lshr <16 x i32> %x, %y1 168 ret <16 x i32> %k 169} 170 171define <8 x i64> @variable_srl3_load(<8 x i64> %x, <8 x i64>* %y) { 172; CHECK-LABEL: variable_srl3_load: 173; CHECK: # %bb.0: 174; CHECK-NEXT: vpsrlvq (%rdi), %zmm0, %zmm0 175; CHECK-NEXT: retq 176 %y1 = load <8 x i64>, <8 x i64>* %y 177 %k = lshr <8 x i64> %x, %y1 178 ret <8 x i64> %k 179} 180