brintos

brintos / llvm-project-archived public Read only

0
0
Text · 17.3 KiB · 108d1b9 Raw
274 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 -mattr=avx -passes=slp-vectorizer -S | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=AVX2564; RUN: opt < %s -mtriple=x86_64-unknown -mattr=avx2 -passes=slp-vectorizer -S | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=AVX2565; RUN: opt < %s -mtriple=x86_64-unknown -mattr=avx512vl,avx512dq,avx512bw -passes=slp-vectorizer -S | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=AVX5126 7target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"8 9@src64 = common global [8 x double] zeroinitializer, align 6410@src32 = common global [16 x float] zeroinitializer, align 6411@dst64 = common global [8 x double] zeroinitializer, align 6412@dst32 = common global [16 x float] zeroinitializer, align 6413 14declare float @llvm.sqrt.f32(float)15declare double @llvm.sqrt.f64(double)16 17;18; SQRT19;20 21define void @sqrt_2f64() #0 {22; CHECK-LABEL: @sqrt_2f64(23; CHECK-NEXT:    [[TMP1:%.*]] = load <2 x double>, ptr @src64, align 824; CHECK-NEXT:    [[TMP2:%.*]] = call <2 x double> @llvm.sqrt.v2f64(<2 x double> [[TMP1]])25; CHECK-NEXT:    store <2 x double> [[TMP2]], ptr @dst64, align 826; CHECK-NEXT:    ret void27;28  %a0 = load double, ptr @src64, align 829  %a1 = load double, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 1), align 830  %sqrt0 = call double @llvm.sqrt.f64(double %a0)31  %sqrt1 = call double @llvm.sqrt.f64(double %a1)32  store double %sqrt0, ptr @dst64, align 833  store double %sqrt1, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 1), align 834  ret void35}36 37define void @sqrt_4f64() #0 {38; SSE-LABEL: @sqrt_4f64(39; SSE-NEXT:    [[TMP1:%.*]] = load <2 x double>, ptr @src64, align 840; SSE-NEXT:    [[TMP2:%.*]] = call <2 x double> @llvm.sqrt.v2f64(<2 x double> [[TMP1]])41; SSE-NEXT:    store <2 x double> [[TMP2]], ptr @dst64, align 842; SSE-NEXT:    [[TMP3:%.*]] = load <2 x double>, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 2), align 843; SSE-NEXT:    [[TMP4:%.*]] = call <2 x double> @llvm.sqrt.v2f64(<2 x double> [[TMP3]])44; SSE-NEXT:    store <2 x double> [[TMP4]], ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 2), align 845; SSE-NEXT:    ret void46;47; AVX-LABEL: @sqrt_4f64(48; AVX-NEXT:    [[TMP1:%.*]] = load <4 x double>, ptr @src64, align 849; AVX-NEXT:    [[TMP2:%.*]] = call <4 x double> @llvm.sqrt.v4f64(<4 x double> [[TMP1]])50; AVX-NEXT:    store <4 x double> [[TMP2]], ptr @dst64, align 851; AVX-NEXT:    ret void52;53  %a0 = load double, ptr @src64, align 854  %a1 = load double, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 1), align 855  %a2 = load double, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 2), align 856  %a3 = load double, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 3), align 857  %sqrt0 = call double @llvm.sqrt.f64(double %a0)58  %sqrt1 = call double @llvm.sqrt.f64(double %a1)59  %sqrt2 = call double @llvm.sqrt.f64(double %a2)60  %sqrt3 = call double @llvm.sqrt.f64(double %a3)61  store double %sqrt0, ptr @dst64, align 862  store double %sqrt1, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 1), align 863  store double %sqrt2, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 2), align 864  store double %sqrt3, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 3), align 865  ret void66}67 68define void @sqrt_8f64() #0 {69; SSE-LABEL: @sqrt_8f64(70; SSE-NEXT:    [[TMP1:%.*]] = load <2 x double>, ptr @src64, align 471; SSE-NEXT:    [[TMP2:%.*]] = call <2 x double> @llvm.sqrt.v2f64(<2 x double> [[TMP1]])72; SSE-NEXT:    store <2 x double> [[TMP2]], ptr @dst64, align 473; SSE-NEXT:    [[TMP3:%.*]] = load <2 x double>, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 2), align 474; SSE-NEXT:    [[TMP4:%.*]] = call <2 x double> @llvm.sqrt.v2f64(<2 x double> [[TMP3]])75; SSE-NEXT:    store <2 x double> [[TMP4]], ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 2), align 476; SSE-NEXT:    [[TMP5:%.*]] = load <2 x double>, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 4), align 477; SSE-NEXT:    [[TMP6:%.*]] = call <2 x double> @llvm.sqrt.v2f64(<2 x double> [[TMP5]])78; SSE-NEXT:    store <2 x double> [[TMP6]], ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 4), align 479; SSE-NEXT:    [[TMP7:%.*]] = load <2 x double>, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 6), align 480; SSE-NEXT:    [[TMP8:%.*]] = call <2 x double> @llvm.sqrt.v2f64(<2 x double> [[TMP7]])81; SSE-NEXT:    store <2 x double> [[TMP8]], ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 6), align 482; SSE-NEXT:    ret void83;84; AVX256-LABEL: @sqrt_8f64(85; AVX256-NEXT:    [[TMP1:%.*]] = load <4 x double>, ptr @src64, align 486; AVX256-NEXT:    [[TMP2:%.*]] = call <4 x double> @llvm.sqrt.v4f64(<4 x double> [[TMP1]])87; AVX256-NEXT:    store <4 x double> [[TMP2]], ptr @dst64, align 488; AVX256-NEXT:    [[TMP3:%.*]] = load <4 x double>, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 4), align 489; AVX256-NEXT:    [[TMP4:%.*]] = call <4 x double> @llvm.sqrt.v4f64(<4 x double> [[TMP3]])90; AVX256-NEXT:    store <4 x double> [[TMP4]], ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 4), align 491; AVX256-NEXT:    ret void92;93; AVX512-LABEL: @sqrt_8f64(94; AVX512-NEXT:    [[TMP1:%.*]] = load <8 x double>, ptr @src64, align 495; AVX512-NEXT:    [[TMP2:%.*]] = call <8 x double> @llvm.sqrt.v8f64(<8 x double> [[TMP1]])96; AVX512-NEXT:    store <8 x double> [[TMP2]], ptr @dst64, align 497; AVX512-NEXT:    ret void98;99  %a0 = load double, ptr @src64, align 4100  %a1 = load double, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 1), align 4101  %a2 = load double, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 2), align 4102  %a3 = load double, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 3), align 4103  %a4 = load double, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 4), align 4104  %a5 = load double, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 5), align 4105  %a6 = load double, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 6), align 4106  %a7 = load double, ptr getelementptr inbounds ([8 x double], ptr @src64, i32 0, i64 7), align 4107  %sqrt0 = call double @llvm.sqrt.f64(double %a0)108  %sqrt1 = call double @llvm.sqrt.f64(double %a1)109  %sqrt2 = call double @llvm.sqrt.f64(double %a2)110  %sqrt3 = call double @llvm.sqrt.f64(double %a3)111  %sqrt4 = call double @llvm.sqrt.f64(double %a4)112  %sqrt5 = call double @llvm.sqrt.f64(double %a5)113  %sqrt6 = call double @llvm.sqrt.f64(double %a6)114  %sqrt7 = call double @llvm.sqrt.f64(double %a7)115  store double %sqrt0, ptr @dst64, align 4116  store double %sqrt1, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 1), align 4117  store double %sqrt2, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 2), align 4118  store double %sqrt3, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 3), align 4119  store double %sqrt4, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 4), align 4120  store double %sqrt5, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 5), align 4121  store double %sqrt6, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 6), align 4122  store double %sqrt7, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 7), align 4123  ret void124}125 126define void @sqrt_4f32() #0 {127; CHECK-LABEL: @sqrt_4f32(128; CHECK-NEXT:    [[TMP1:%.*]] = load <4 x float>, ptr @src32, align 4129; CHECK-NEXT:    [[TMP2:%.*]] = call <4 x float> @llvm.sqrt.v4f32(<4 x float> [[TMP1]])130; CHECK-NEXT:    store <4 x float> [[TMP2]], ptr @dst32, align 4131; CHECK-NEXT:    ret void132;133  %a0 = load float, ptr @src32, align 4134  %a1 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 1), align 4135  %a2 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 2), align 4136  %a3 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 3), align 4137  %sqrt0 = call float @llvm.sqrt.f32(float %a0)138  %sqrt1 = call float @llvm.sqrt.f32(float %a1)139  %sqrt2 = call float @llvm.sqrt.f32(float %a2)140  %sqrt3 = call float @llvm.sqrt.f32(float %a3)141  store float %sqrt0, ptr @dst32, align 4142  store float %sqrt1, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 1), align 4143  store float %sqrt2, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 2), align 4144  store float %sqrt3, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 3), align 4145  ret void146}147 148define void @sqrt_8f32() #0 {149; SSE-LABEL: @sqrt_8f32(150; SSE-NEXT:    [[TMP1:%.*]] = load <4 x float>, ptr @src32, align 4151; SSE-NEXT:    [[TMP2:%.*]] = call <4 x float> @llvm.sqrt.v4f32(<4 x float> [[TMP1]])152; SSE-NEXT:    store <4 x float> [[TMP2]], ptr @dst32, align 4153; SSE-NEXT:    [[TMP3:%.*]] = load <4 x float>, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 4), align 4154; SSE-NEXT:    [[TMP4:%.*]] = call <4 x float> @llvm.sqrt.v4f32(<4 x float> [[TMP3]])155; SSE-NEXT:    store <4 x float> [[TMP4]], ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 4), align 4156; SSE-NEXT:    ret void157;158; AVX-LABEL: @sqrt_8f32(159; AVX-NEXT:    [[TMP1:%.*]] = load <8 x float>, ptr @src32, align 4160; AVX-NEXT:    [[TMP2:%.*]] = call <8 x float> @llvm.sqrt.v8f32(<8 x float> [[TMP1]])161; AVX-NEXT:    store <8 x float> [[TMP2]], ptr @dst32, align 4162; AVX-NEXT:    ret void163;164  %a0 = load float, ptr @src32, align 4165  %a1 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 1), align 4166  %a2 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 2), align 4167  %a3 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 3), align 4168  %a4 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 4), align 4169  %a5 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 5), align 4170  %a6 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 6), align 4171  %a7 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 7), align 4172  %sqrt0 = call float @llvm.sqrt.f32(float %a0)173  %sqrt1 = call float @llvm.sqrt.f32(float %a1)174  %sqrt2 = call float @llvm.sqrt.f32(float %a2)175  %sqrt3 = call float @llvm.sqrt.f32(float %a3)176  %sqrt4 = call float @llvm.sqrt.f32(float %a4)177  %sqrt5 = call float @llvm.sqrt.f32(float %a5)178  %sqrt6 = call float @llvm.sqrt.f32(float %a6)179  %sqrt7 = call float @llvm.sqrt.f32(float %a7)180  store float %sqrt0, ptr @dst32, align 4181  store float %sqrt1, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 1), align 4182  store float %sqrt2, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 2), align 4183  store float %sqrt3, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 3), align 4184  store float %sqrt4, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 4), align 4185  store float %sqrt5, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 5), align 4186  store float %sqrt6, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 6), align 4187  store float %sqrt7, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 7), align 4188  ret void189}190 191define void @sqrt_16f32() #0 {192; SSE-LABEL: @sqrt_16f32(193; SSE-NEXT:    [[TMP1:%.*]] = load <4 x float>, ptr @src32, align 4194; SSE-NEXT:    [[TMP2:%.*]] = call <4 x float> @llvm.sqrt.v4f32(<4 x float> [[TMP1]])195; SSE-NEXT:    store <4 x float> [[TMP2]], ptr @dst32, align 4196; SSE-NEXT:    [[TMP3:%.*]] = load <4 x float>, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 4), align 4197; SSE-NEXT:    [[TMP4:%.*]] = call <4 x float> @llvm.sqrt.v4f32(<4 x float> [[TMP3]])198; SSE-NEXT:    store <4 x float> [[TMP4]], ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 4), align 4199; SSE-NEXT:    [[TMP5:%.*]] = load <4 x float>, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 8), align 4200; SSE-NEXT:    [[TMP6:%.*]] = call <4 x float> @llvm.sqrt.v4f32(<4 x float> [[TMP5]])201; SSE-NEXT:    store <4 x float> [[TMP6]], ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 8), align 4202; SSE-NEXT:    [[TMP7:%.*]] = load <4 x float>, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 12), align 4203; SSE-NEXT:    [[TMP8:%.*]] = call <4 x float> @llvm.sqrt.v4f32(<4 x float> [[TMP7]])204; SSE-NEXT:    store <4 x float> [[TMP8]], ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 12), align 4205; SSE-NEXT:    ret void206;207; AVX256-LABEL: @sqrt_16f32(208; AVX256-NEXT:    [[TMP1:%.*]] = load <8 x float>, ptr @src32, align 4209; AVX256-NEXT:    [[TMP2:%.*]] = call <8 x float> @llvm.sqrt.v8f32(<8 x float> [[TMP1]])210; AVX256-NEXT:    store <8 x float> [[TMP2]], ptr @dst32, align 4211; AVX256-NEXT:    [[TMP3:%.*]] = load <8 x float>, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 8), align 4212; AVX256-NEXT:    [[TMP4:%.*]] = call <8 x float> @llvm.sqrt.v8f32(<8 x float> [[TMP3]])213; AVX256-NEXT:    store <8 x float> [[TMP4]], ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 8), align 4214; AVX256-NEXT:    ret void215;216; AVX512-LABEL: @sqrt_16f32(217; AVX512-NEXT:    [[TMP1:%.*]] = load <16 x float>, ptr @src32, align 4218; AVX512-NEXT:    [[TMP2:%.*]] = call <16 x float> @llvm.sqrt.v16f32(<16 x float> [[TMP1]])219; AVX512-NEXT:    store <16 x float> [[TMP2]], ptr @dst32, align 4220; AVX512-NEXT:    ret void221;222  %a0  = load float, ptr @src32, align 4223  %a1  = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64  1), align 4224  %a2  = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64  2), align 4225  %a3  = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64  3), align 4226  %a4  = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64  4), align 4227  %a5  = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64  5), align 4228  %a6  = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64  6), align 4229  %a7  = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64  7), align 4230  %a8  = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64  8), align 4231  %a9  = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64  9), align 4232  %a10 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 10), align 4233  %a11 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 11), align 4234  %a12 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 12), align 4235  %a13 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 13), align 4236  %a14 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 14), align 4237  %a15 = load float, ptr getelementptr inbounds ([16 x float], ptr @src32, i32 0, i64 15), align 4238  %sqrt0  = call float @llvm.sqrt.f32(float %a0 )239  %sqrt1  = call float @llvm.sqrt.f32(float %a1 )240  %sqrt2  = call float @llvm.sqrt.f32(float %a2 )241  %sqrt3  = call float @llvm.sqrt.f32(float %a3 )242  %sqrt4  = call float @llvm.sqrt.f32(float %a4 )243  %sqrt5  = call float @llvm.sqrt.f32(float %a5 )244  %sqrt6  = call float @llvm.sqrt.f32(float %a6 )245  %sqrt7  = call float @llvm.sqrt.f32(float %a7 )246  %sqrt8  = call float @llvm.sqrt.f32(float %a8 )247  %sqrt9  = call float @llvm.sqrt.f32(float %a9 )248  %sqrt10 = call float @llvm.sqrt.f32(float %a10)249  %sqrt11 = call float @llvm.sqrt.f32(float %a11)250  %sqrt12 = call float @llvm.sqrt.f32(float %a12)251  %sqrt13 = call float @llvm.sqrt.f32(float %a13)252  %sqrt14 = call float @llvm.sqrt.f32(float %a14)253  %sqrt15 = call float @llvm.sqrt.f32(float %a15)254  store float %sqrt0 , ptr @dst32, align 4255  store float %sqrt1 , ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64  1), align 4256  store float %sqrt2 , ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64  2), align 4257  store float %sqrt3 , ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64  3), align 4258  store float %sqrt4 , ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64  4), align 4259  store float %sqrt5 , ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64  5), align 4260  store float %sqrt6 , ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64  6), align 4261  store float %sqrt7 , ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64  7), align 4262  store float %sqrt8 , ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64  8), align 4263  store float %sqrt9 , ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64  9), align 4264  store float %sqrt10, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 10), align 4265  store float %sqrt11, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 11), align 4266  store float %sqrt12, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 12), align 4267  store float %sqrt13, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 13), align 4268  store float %sqrt14, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 14), align 4269  store float %sqrt15, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 15), align 4270  ret void271}272 273attributes #0 = { nounwind }274