276 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -mtriple=x86_64-unknown -passes=slp-vectorizer -S | FileCheck %s --check-prefix=CHECK --check-prefix=SSE3; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=corei7-avx -passes=slp-vectorizer -S | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=AVX2564; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=bdver1 -passes=slp-vectorizer -S | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=AVX2565; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=core-avx2 -passes=slp-vectorizer -S | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=AVX2566; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=skylake-avx512 -mattr=-prefer-256-bit -passes=slp-vectorizer -S | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=AVX5127; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=skylake-avx512 -mattr=+prefer-256-bit -passes=slp-vectorizer -S | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=AVX2568 9target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"10 11@src64 = common global [8 x double] zeroinitializer, align 6412@src32 = common global [16 x float] zeroinitializer, align 6413@dst64 = common global [8 x double] zeroinitializer, align 6414@dst32 = common global [16 x float] zeroinitializer, align 6415 16declare float @llvm.fabs.f32(float)17declare double @llvm.fabs.f64(double)18 19;20; FABS21;22 23define void @fabs_2f64() #0 {24; CHECK-LABEL: @fabs_2f64(25; CHECK-NEXT: [[TMP1:%.*]] = load <2 x double>, ptr @src64, align 826; CHECK-NEXT: [[TMP2:%.*]] = call <2 x double> @llvm.fabs.v2f64(<2 x double> [[TMP1]])27; CHECK-NEXT: store <2 x double> [[TMP2]], ptr @dst64, align 828; CHECK-NEXT: ret void29;30 %a0 = load double, ptr @src64, align 831 %a1 = load double, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 1), align 832 %fabs0 = call double @llvm.fabs.f64(double %a0)33 %fabs1 = call double @llvm.fabs.f64(double %a1)34 store double %fabs0, ptr @dst64, align 835 store double %fabs1, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 1), align 836 ret void37}38 39define void @fabs_4f64() #0 {40; SSE-LABEL: @fabs_4f64(41; SSE-NEXT: [[TMP1:%.*]] = load <2 x double>, ptr @src64, align 842; SSE-NEXT: [[TMP2:%.*]] = call <2 x double> @llvm.fabs.v2f64(<2 x double> [[TMP1]])43; SSE-NEXT: store <2 x double> [[TMP2]], ptr @dst64, align 844; SSE-NEXT: [[TMP3:%.*]] = load <2 x double>, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 2), align 845; SSE-NEXT: [[TMP4:%.*]] = call <2 x double> @llvm.fabs.v2f64(<2 x double> [[TMP3]])46; SSE-NEXT: store <2 x double> [[TMP4]], ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 2), align 847; SSE-NEXT: ret void48;49; AVX-LABEL: @fabs_4f64(50; AVX-NEXT: [[TMP1:%.*]] = load <4 x double>, ptr @src64, align 851; AVX-NEXT: [[TMP2:%.*]] = call <4 x double> @llvm.fabs.v4f64(<4 x double> [[TMP1]])52; AVX-NEXT: store <4 x double> [[TMP2]], ptr @dst64, align 853; AVX-NEXT: ret void54;55 %a0 = load double, ptr @src64, align 856 %a1 = load double, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 1), align 857 %a2 = load double, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 2), align 858 %a3 = load double, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 3), align 859 %fabs0 = call double @llvm.fabs.f64(double %a0)60 %fabs1 = call double @llvm.fabs.f64(double %a1)61 %fabs2 = call double @llvm.fabs.f64(double %a2)62 %fabs3 = call double @llvm.fabs.f64(double %a3)63 store double %fabs0, ptr @dst64, align 864 store double %fabs1, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 1), align 865 store double %fabs2, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 2), align 866 store double %fabs3, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 3), align 867 ret void68}69 70define void @fabs_8f64() #0 {71; SSE-LABEL: @fabs_8f64(72; SSE-NEXT: [[TMP1:%.*]] = load <2 x double>, ptr @src64, align 473; SSE-NEXT: [[TMP2:%.*]] = call <2 x double> @llvm.fabs.v2f64(<2 x double> [[TMP1]])74; SSE-NEXT: store <2 x double> [[TMP2]], ptr @dst64, align 475; SSE-NEXT: [[TMP3:%.*]] = load <2 x double>, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 2), align 476; SSE-NEXT: [[TMP4:%.*]] = call <2 x double> @llvm.fabs.v2f64(<2 x double> [[TMP3]])77; SSE-NEXT: store <2 x double> [[TMP4]], ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 2), align 478; SSE-NEXT: [[TMP5:%.*]] = load <2 x double>, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 4), align 479; SSE-NEXT: [[TMP6:%.*]] = call <2 x double> @llvm.fabs.v2f64(<2 x double> [[TMP5]])80; SSE-NEXT: store <2 x double> [[TMP6]], ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 4), align 481; SSE-NEXT: [[TMP7:%.*]] = load <2 x double>, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 6), align 482; SSE-NEXT: [[TMP8:%.*]] = call <2 x double> @llvm.fabs.v2f64(<2 x double> [[TMP7]])83; SSE-NEXT: store <2 x double> [[TMP8]], ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 6), align 484; SSE-NEXT: ret void85;86; AVX256-LABEL: @fabs_8f64(87; AVX256-NEXT: [[TMP1:%.*]] = load <4 x double>, ptr @src64, align 488; AVX256-NEXT: [[TMP2:%.*]] = call <4 x double> @llvm.fabs.v4f64(<4 x double> [[TMP1]])89; AVX256-NEXT: store <4 x double> [[TMP2]], ptr @dst64, align 490; AVX256-NEXT: [[TMP3:%.*]] = load <4 x double>, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 4), align 491; AVX256-NEXT: [[TMP4:%.*]] = call <4 x double> @llvm.fabs.v4f64(<4 x double> [[TMP3]])92; AVX256-NEXT: store <4 x double> [[TMP4]], ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 4), align 493; AVX256-NEXT: ret void94;95; AVX512-LABEL: @fabs_8f64(96; AVX512-NEXT: [[TMP1:%.*]] = load <8 x double>, ptr @src64, align 497; AVX512-NEXT: [[TMP2:%.*]] = call <8 x double> @llvm.fabs.v8f64(<8 x double> [[TMP1]])98; AVX512-NEXT: store <8 x double> [[TMP2]], ptr @dst64, align 499; AVX512-NEXT: ret void100;101 %a0 = load double, ptr @src64, align 4102 %a1 = load double, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 1), align 4103 %a2 = load double, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 2), align 4104 %a3 = load double, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 3), align 4105 %a4 = load double, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 4), align 4106 %a5 = load double, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 5), align 4107 %a6 = load double, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 6), align 4108 %a7 = load double, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 7), align 4109 %fabs0 = call double @llvm.fabs.f64(double %a0)110 %fabs1 = call double @llvm.fabs.f64(double %a1)111 %fabs2 = call double @llvm.fabs.f64(double %a2)112 %fabs3 = call double @llvm.fabs.f64(double %a3)113 %fabs4 = call double @llvm.fabs.f64(double %a4)114 %fabs5 = call double @llvm.fabs.f64(double %a5)115 %fabs6 = call double @llvm.fabs.f64(double %a6)116 %fabs7 = call double @llvm.fabs.f64(double %a7)117 store double %fabs0, ptr @dst64, align 4118 store double %fabs1, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 1), align 4119 store double %fabs2, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 2), align 4120 store double %fabs3, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 3), align 4121 store double %fabs4, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 4), align 4122 store double %fabs5, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 5), align 4123 store double %fabs6, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 6), align 4124 store double %fabs7, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 7), align 4125 ret void126}127 128define void @fabs_4f32() #0 {129; CHECK-LABEL: @fabs_4f32(130; CHECK-NEXT: [[TMP1:%.*]] = load <4 x float>, ptr @src32, align 4131; CHECK-NEXT: [[TMP2:%.*]] = call <4 x float> @llvm.fabs.v4f32(<4 x float> [[TMP1]])132; CHECK-NEXT: store <4 x float> [[TMP2]], ptr @dst32, align 4133; CHECK-NEXT: ret void134;135 %a0 = load float, ptr @src32, align 4136 %a1 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 1), align 4137 %a2 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 2), align 4138 %a3 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 3), align 4139 %fabs0 = call float @llvm.fabs.f32(float %a0)140 %fabs1 = call float @llvm.fabs.f32(float %a1)141 %fabs2 = call float @llvm.fabs.f32(float %a2)142 %fabs3 = call float @llvm.fabs.f32(float %a3)143 store float %fabs0, ptr @dst32, align 4144 store float %fabs1, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 1), align 4145 store float %fabs2, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 2), align 4146 store float %fabs3, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 3), align 4147 ret void148}149 150define void @fabs_8f32() #0 {151; SSE-LABEL: @fabs_8f32(152; SSE-NEXT: [[TMP1:%.*]] = load <4 x float>, ptr @src32, align 4153; SSE-NEXT: [[TMP2:%.*]] = call <4 x float> @llvm.fabs.v4f32(<4 x float> [[TMP1]])154; SSE-NEXT: store <4 x float> [[TMP2]], ptr @dst32, align 4155; SSE-NEXT: [[TMP3:%.*]] = load <4 x float>, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 4), align 4156; SSE-NEXT: [[TMP4:%.*]] = call <4 x float> @llvm.fabs.v4f32(<4 x float> [[TMP3]])157; SSE-NEXT: store <4 x float> [[TMP4]], ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 4), align 4158; SSE-NEXT: ret void159;160; AVX-LABEL: @fabs_8f32(161; AVX-NEXT: [[TMP1:%.*]] = load <8 x float>, ptr @src32, align 4162; AVX-NEXT: [[TMP2:%.*]] = call <8 x float> @llvm.fabs.v8f32(<8 x float> [[TMP1]])163; AVX-NEXT: store <8 x float> [[TMP2]], ptr @dst32, align 4164; AVX-NEXT: ret void165;166 %a0 = load float, ptr @src32, align 4167 %a1 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 1), align 4168 %a2 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 2), align 4169 %a3 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 3), align 4170 %a4 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 4), align 4171 %a5 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 5), align 4172 %a6 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 6), align 4173 %a7 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 7), align 4174 %fabs0 = call float @llvm.fabs.f32(float %a0)175 %fabs1 = call float @llvm.fabs.f32(float %a1)176 %fabs2 = call float @llvm.fabs.f32(float %a2)177 %fabs3 = call float @llvm.fabs.f32(float %a3)178 %fabs4 = call float @llvm.fabs.f32(float %a4)179 %fabs5 = call float @llvm.fabs.f32(float %a5)180 %fabs6 = call float @llvm.fabs.f32(float %a6)181 %fabs7 = call float @llvm.fabs.f32(float %a7)182 store float %fabs0, ptr @dst32, align 4183 store float %fabs1, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 1), align 4184 store float %fabs2, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 2), align 4185 store float %fabs3, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 3), align 4186 store float %fabs4, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 4), align 4187 store float %fabs5, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 5), align 4188 store float %fabs6, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 6), align 4189 store float %fabs7, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 7), align 4190 ret void191}192 193define void @fabs_16f32() #0 {194; SSE-LABEL: @fabs_16f32(195; SSE-NEXT: [[TMP1:%.*]] = load <4 x float>, ptr @src32, align 4196; SSE-NEXT: [[TMP2:%.*]] = call <4 x float> @llvm.fabs.v4f32(<4 x float> [[TMP1]])197; SSE-NEXT: store <4 x float> [[TMP2]], ptr @dst32, align 4198; SSE-NEXT: [[TMP3:%.*]] = load <4 x float>, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 4), align 4199; SSE-NEXT: [[TMP4:%.*]] = call <4 x float> @llvm.fabs.v4f32(<4 x float> [[TMP3]])200; SSE-NEXT: store <4 x float> [[TMP4]], ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 4), align 4201; SSE-NEXT: [[TMP5:%.*]] = load <4 x float>, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 8), align 4202; SSE-NEXT: [[TMP6:%.*]] = call <4 x float> @llvm.fabs.v4f32(<4 x float> [[TMP5]])203; SSE-NEXT: store <4 x float> [[TMP6]], ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 8), align 4204; SSE-NEXT: [[TMP7:%.*]] = load <4 x float>, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 12), align 4205; SSE-NEXT: [[TMP8:%.*]] = call <4 x float> @llvm.fabs.v4f32(<4 x float> [[TMP7]])206; SSE-NEXT: store <4 x float> [[TMP8]], ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 12), align 4207; SSE-NEXT: ret void208;209; AVX256-LABEL: @fabs_16f32(210; AVX256-NEXT: [[TMP1:%.*]] = load <8 x float>, ptr @src32, align 4211; AVX256-NEXT: [[TMP2:%.*]] = call <8 x float> @llvm.fabs.v8f32(<8 x float> [[TMP1]])212; AVX256-NEXT: store <8 x float> [[TMP2]], ptr @dst32, align 4213; AVX256-NEXT: [[TMP3:%.*]] = load <8 x float>, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 8), align 4214; AVX256-NEXT: [[TMP4:%.*]] = call <8 x float> @llvm.fabs.v8f32(<8 x float> [[TMP3]])215; AVX256-NEXT: store <8 x float> [[TMP4]], ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 8), align 4216; AVX256-NEXT: ret void217;218; AVX512-LABEL: @fabs_16f32(219; AVX512-NEXT: [[TMP1:%.*]] = load <16 x float>, ptr @src32, align 4220; AVX512-NEXT: [[TMP2:%.*]] = call <16 x float> @llvm.fabs.v16f32(<16 x float> [[TMP1]])221; AVX512-NEXT: store <16 x float> [[TMP2]], ptr @dst32, align 4222; AVX512-NEXT: ret void223;224 %a0 = load float, ptr @src32, align 4225 %a1 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 1), align 4226 %a2 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 2), align 4227 %a3 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 3), align 4228 %a4 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 4), align 4229 %a5 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 5), align 4230 %a6 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 6), align 4231 %a7 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 7), align 4232 %a8 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 8), align 4233 %a9 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 9), align 4234 %a10 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 10), align 4235 %a11 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 11), align 4236 %a12 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 12), align 4237 %a13 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 13), align 4238 %a14 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 14), align 4239 %a15 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 15), align 4240 %fabs0 = call float @llvm.fabs.f32(float %a0 )241 %fabs1 = call float @llvm.fabs.f32(float %a1 )242 %fabs2 = call float @llvm.fabs.f32(float %a2 )243 %fabs3 = call float @llvm.fabs.f32(float %a3 )244 %fabs4 = call float @llvm.fabs.f32(float %a4 )245 %fabs5 = call float @llvm.fabs.f32(float %a5 )246 %fabs6 = call float @llvm.fabs.f32(float %a6 )247 %fabs7 = call float @llvm.fabs.f32(float %a7 )248 %fabs8 = call float @llvm.fabs.f32(float %a8 )249 %fabs9 = call float @llvm.fabs.f32(float %a9 )250 %fabs10 = call float @llvm.fabs.f32(float %a10)251 %fabs11 = call float @llvm.fabs.f32(float %a11)252 %fabs12 = call float @llvm.fabs.f32(float %a12)253 %fabs13 = call float @llvm.fabs.f32(float %a13)254 %fabs14 = call float @llvm.fabs.f32(float %a14)255 %fabs15 = call float @llvm.fabs.f32(float %a15)256 store float %fabs0 , ptr @dst32, align 4257 store float %fabs1 , ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 1), align 4258 store float %fabs2 , ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 2), align 4259 store float %fabs3 , ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 3), align 4260 store float %fabs4 , ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 4), align 4261 store float %fabs5 , ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 5), align 4262 store float %fabs6 , ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 6), align 4263 store float %fabs7 , ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 7), align 4264 store float %fabs8 , ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 8), align 4265 store float %fabs9 , ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 9), align 4266 store float %fabs10, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 10), align 4267 store float %fabs11, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 11), align 4268 store float %fabs12, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 12), align 4269 store float %fabs13, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 13), align 4270 store float %fabs14, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 14), align 4271 store float %fabs15, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 15), align 4272 ret void273}274 275attributes #0 = { nounwind }276