503 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-prefixes=CHECK,SSE3; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=corei7-avx -passes=slp-vectorizer -S | FileCheck %s --check-prefixes=CHECK,AVX,AVX2564; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=bdver1 -passes=slp-vectorizer -S | FileCheck %s --check-prefixes=CHECK,AVX,AVX2565; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=core-avx2 -passes=slp-vectorizer -S | FileCheck %s --check-prefixes=CHECK,AVX,AVX2566; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=skylake-avx512 -mattr=-prefer-256-bit -passes=slp-vectorizer -S | FileCheck %s --check-prefixes=CHECK,AVX,AVX5127; RUN: opt < %s -mtriple=x86_64-unknown -mcpu=skylake-avx512 -mattr=+prefer-256-bit -passes=slp-vectorizer -S | FileCheck %s --check-prefixes=CHECK,AVX,AVX2568 9@srcA64 = common global [8 x double] zeroinitializer, align 6410@srcB64 = common global [8 x double] zeroinitializer, align 6411@srcC64 = common global [8 x double] zeroinitializer, align 6412@srcA32 = common global [16 x float] zeroinitializer, align 6413@srcB32 = common global [16 x float] zeroinitializer, align 6414@srcC32 = common global [16 x float] zeroinitializer, align 6415@dst64 = common global [8 x double] zeroinitializer, align 6416@dst32 = common global [16 x float] zeroinitializer, align 6417 18declare float @llvm.maxnum.f32(float, float)19declare double @llvm.maxnum.f64(double, double)20 21;22; CHECK23;24 25define void @fmaxnum_2f64() #0 {26; CHECK-LABEL: @fmaxnum_2f64(27; CHECK-NEXT: [[TMP1:%.*]] = load <2 x double>, ptr @srcA64, align 828; CHECK-NEXT: [[TMP2:%.*]] = load <2 x double>, ptr @srcB64, align 829; CHECK-NEXT: [[TMP3:%.*]] = call <2 x double> @llvm.maxnum.v2f64(<2 x double> [[TMP1]], <2 x double> [[TMP2]])30; CHECK-NEXT: store <2 x double> [[TMP3]], ptr @dst64, align 831; CHECK-NEXT: ret void32;33 %a0 = load double, ptr @srcA64, align 834 %a1 = load double, ptr getelementptr inbounds ([8 x double], ptr @srcA64, i32 0, i64 1), align 835 %b0 = load double, ptr @srcB64, align 836 %b1 = load double, ptr getelementptr inbounds ([8 x double], ptr @srcB64, i32 0, i64 1), align 837 %fmaxnum0 = call double @llvm.maxnum.f64(double %a0, double %b0)38 %fmaxnum1 = call double @llvm.maxnum.f64(double %a1, double %b1)39 store double %fmaxnum0, ptr @dst64, align 840 store double %fmaxnum1, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 1), align 841 ret void42}43 44define void @fmaxnum_4f64() #0 {45; SSE-LABEL: @fmaxnum_4f64(46; SSE-NEXT: [[TMP1:%.*]] = load <2 x double>, ptr @srcA64, align 847; SSE-NEXT: [[TMP2:%.*]] = load <2 x double>, ptr @srcB64, align 848; SSE-NEXT: [[TMP3:%.*]] = call <2 x double> @llvm.maxnum.v2f64(<2 x double> [[TMP1]], <2 x double> [[TMP2]])49; SSE-NEXT: store <2 x double> [[TMP3]], ptr @dst64, align 850; SSE-NEXT: [[TMP4:%.*]] = load <2 x double>, ptr getelementptr inbounds ([8 x double], ptr @srcA64, i32 0, i64 2), align 851; SSE-NEXT: [[TMP5:%.*]] = load <2 x double>, ptr getelementptr inbounds ([8 x double], ptr @srcB64, i32 0, i64 2), align 852; SSE-NEXT: [[TMP6:%.*]] = call <2 x double> @llvm.maxnum.v2f64(<2 x double> [[TMP4]], <2 x double> [[TMP5]])53; SSE-NEXT: store <2 x double> [[TMP6]], ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 2), align 854; SSE-NEXT: ret void55;56; AVX-LABEL: @fmaxnum_4f64(57; AVX-NEXT: [[TMP1:%.*]] = load <4 x double>, ptr @srcA64, align 858; AVX-NEXT: [[TMP2:%.*]] = load <4 x double>, ptr @srcB64, align 859; AVX-NEXT: [[TMP3:%.*]] = call <4 x double> @llvm.maxnum.v4f64(<4 x double> [[TMP1]], <4 x double> [[TMP2]])60; AVX-NEXT: store <4 x double> [[TMP3]], ptr @dst64, align 861; AVX-NEXT: ret void62;63 %a0 = load double, ptr @srcA64, align 864 %a1 = load double, ptr getelementptr inbounds ([8 x double], ptr @srcA64, i32 0, i64 1), align 865 %a2 = load double, ptr getelementptr inbounds ([8 x double], ptr @srcA64, i32 0, i64 2), align 866 %a3 = load double, ptr getelementptr inbounds ([8 x double], ptr @srcA64, i32 0, i64 3), align 867 %b0 = load double, ptr @srcB64, align 868 %b1 = load double, ptr getelementptr inbounds ([8 x double], ptr @srcB64, i32 0, i64 1), align 869 %b2 = load double, ptr getelementptr inbounds ([8 x double], ptr @srcB64, i32 0, i64 2), align 870 %b3 = load double, ptr getelementptr inbounds ([8 x double], ptr @srcB64, i32 0, i64 3), align 871 %fmaxnum0 = call double @llvm.maxnum.f64(double %a0, double %b0)72 %fmaxnum1 = call double @llvm.maxnum.f64(double %a1, double %b1)73 %fmaxnum2 = call double @llvm.maxnum.f64(double %a2, double %b2)74 %fmaxnum3 = call double @llvm.maxnum.f64(double %a3, double %b3)75 store double %fmaxnum0, ptr @dst64, align 876 store double %fmaxnum1, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 1), align 877 store double %fmaxnum2, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 2), align 878 store double %fmaxnum3, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 3), align 879 ret void80}81 82define void @fmaxnum_8f64() #0 {83; SSE-LABEL: @fmaxnum_8f64(84; SSE-NEXT: [[TMP1:%.*]] = load <2 x double>, ptr @srcA64, align 485; SSE-NEXT: [[TMP2:%.*]] = load <2 x double>, ptr @srcB64, align 486; SSE-NEXT: [[TMP3:%.*]] = call <2 x double> @llvm.maxnum.v2f64(<2 x double> [[TMP1]], <2 x double> [[TMP2]])87; SSE-NEXT: store <2 x double> [[TMP3]], ptr @dst64, align 488; SSE-NEXT: [[TMP4:%.*]] = load <2 x double>, ptr getelementptr inbounds ([8 x double], ptr @srcA64, i32 0, i64 2), align 489; SSE-NEXT: [[TMP5:%.*]] = load <2 x double>, ptr getelementptr inbounds ([8 x double], ptr @srcB64, i32 0, i64 2), align 490; SSE-NEXT: [[TMP6:%.*]] = call <2 x double> @llvm.maxnum.v2f64(<2 x double> [[TMP4]], <2 x double> [[TMP5]])91; SSE-NEXT: store <2 x double> [[TMP6]], ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 2), align 492; SSE-NEXT: [[TMP7:%.*]] = load <2 x double>, ptr getelementptr inbounds ([8 x double], ptr @srcA64, i32 0, i64 4), align 493; SSE-NEXT: [[TMP8:%.*]] = load <2 x double>, ptr getelementptr inbounds ([8 x double], ptr @srcB64, i32 0, i64 4), align 494; SSE-NEXT: [[TMP9:%.*]] = call <2 x double> @llvm.maxnum.v2f64(<2 x double> [[TMP7]], <2 x double> [[TMP8]])95; SSE-NEXT: store <2 x double> [[TMP9]], ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 4), align 496; SSE-NEXT: [[TMP10:%.*]] = load <2 x double>, ptr getelementptr inbounds ([8 x double], ptr @srcA64, i32 0, i64 6), align 497; SSE-NEXT: [[TMP11:%.*]] = load <2 x double>, ptr getelementptr inbounds ([8 x double], ptr @srcB64, i32 0, i64 6), align 498; SSE-NEXT: [[TMP12:%.*]] = call <2 x double> @llvm.maxnum.v2f64(<2 x double> [[TMP10]], <2 x double> [[TMP11]])99; SSE-NEXT: store <2 x double> [[TMP12]], ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 6), align 4100; SSE-NEXT: ret void101;102; AVX256-LABEL: @fmaxnum_8f64(103; AVX256-NEXT: [[TMP1:%.*]] = load <4 x double>, ptr @srcA64, align 4104; AVX256-NEXT: [[TMP2:%.*]] = load <4 x double>, ptr @srcB64, align 4105; AVX256-NEXT: [[TMP3:%.*]] = call <4 x double> @llvm.maxnum.v4f64(<4 x double> [[TMP1]], <4 x double> [[TMP2]])106; AVX256-NEXT: store <4 x double> [[TMP3]], ptr @dst64, align 4107; AVX256-NEXT: [[TMP4:%.*]] = load <4 x double>, ptr getelementptr inbounds ([8 x double], ptr @srcA64, i32 0, i64 4), align 4108; AVX256-NEXT: [[TMP5:%.*]] = load <4 x double>, ptr getelementptr inbounds ([8 x double], ptr @srcB64, i32 0, i64 4), align 4109; AVX256-NEXT: [[TMP6:%.*]] = call <4 x double> @llvm.maxnum.v4f64(<4 x double> [[TMP4]], <4 x double> [[TMP5]])110; AVX256-NEXT: store <4 x double> [[TMP6]], ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 4), align 4111; AVX256-NEXT: ret void112;113; AVX512-LABEL: @fmaxnum_8f64(114; AVX512-NEXT: [[TMP1:%.*]] = load <8 x double>, ptr @srcA64, align 4115; AVX512-NEXT: [[TMP2:%.*]] = load <8 x double>, ptr @srcB64, align 4116; AVX512-NEXT: [[TMP3:%.*]] = call <8 x double> @llvm.maxnum.v8f64(<8 x double> [[TMP1]], <8 x double> [[TMP2]])117; AVX512-NEXT: store <8 x double> [[TMP3]], ptr @dst64, align 4118; AVX512-NEXT: ret void119;120 %a0 = load double, ptr @srcA64, align 4121 %a1 = load double, ptr getelementptr inbounds ([8 x double], ptr @srcA64, i32 0, i64 1), align 4122 %a2 = load double, ptr getelementptr inbounds ([8 x double], ptr @srcA64, i32 0, i64 2), align 4123 %a3 = load double, ptr getelementptr inbounds ([8 x double], ptr @srcA64, i32 0, i64 3), align 4124 %a4 = load double, ptr getelementptr inbounds ([8 x double], ptr @srcA64, i32 0, i64 4), align 4125 %a5 = load double, ptr getelementptr inbounds ([8 x double], ptr @srcA64, i32 0, i64 5), align 4126 %a6 = load double, ptr getelementptr inbounds ([8 x double], ptr @srcA64, i32 0, i64 6), align 4127 %a7 = load double, ptr getelementptr inbounds ([8 x double], ptr @srcA64, i32 0, i64 7), align 4128 %b0 = load double, ptr @srcB64, align 4129 %b1 = load double, ptr getelementptr inbounds ([8 x double], ptr @srcB64, i32 0, i64 1), align 4130 %b2 = load double, ptr getelementptr inbounds ([8 x double], ptr @srcB64, i32 0, i64 2), align 4131 %b3 = load double, ptr getelementptr inbounds ([8 x double], ptr @srcB64, i32 0, i64 3), align 4132 %b4 = load double, ptr getelementptr inbounds ([8 x double], ptr @srcB64, i32 0, i64 4), align 4133 %b5 = load double, ptr getelementptr inbounds ([8 x double], ptr @srcB64, i32 0, i64 5), align 4134 %b6 = load double, ptr getelementptr inbounds ([8 x double], ptr @srcB64, i32 0, i64 6), align 4135 %b7 = load double, ptr getelementptr inbounds ([8 x double], ptr @srcB64, i32 0, i64 7), align 4136 %fmaxnum0 = call double @llvm.maxnum.f64(double %a0, double %b0)137 %fmaxnum1 = call double @llvm.maxnum.f64(double %a1, double %b1)138 %fmaxnum2 = call double @llvm.maxnum.f64(double %a2, double %b2)139 %fmaxnum3 = call double @llvm.maxnum.f64(double %a3, double %b3)140 %fmaxnum4 = call double @llvm.maxnum.f64(double %a4, double %b4)141 %fmaxnum5 = call double @llvm.maxnum.f64(double %a5, double %b5)142 %fmaxnum6 = call double @llvm.maxnum.f64(double %a6, double %b6)143 %fmaxnum7 = call double @llvm.maxnum.f64(double %a7, double %b7)144 store double %fmaxnum0, ptr @dst64, align 4145 store double %fmaxnum1, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 1), align 4146 store double %fmaxnum2, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 2), align 4147 store double %fmaxnum3, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 3), align 4148 store double %fmaxnum4, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 4), align 4149 store double %fmaxnum5, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 5), align 4150 store double %fmaxnum6, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 6), align 4151 store double %fmaxnum7, ptr getelementptr inbounds ([8 x double], ptr @dst64, i32 0, i64 7), align 4152 ret void153}154 155define void @fmaxnum_4f32() #0 {156; CHECK-LABEL: @fmaxnum_4f32(157; CHECK-NEXT: [[TMP1:%.*]] = load <4 x float>, ptr @srcA32, align 4158; CHECK-NEXT: [[TMP2:%.*]] = load <4 x float>, ptr @srcB32, align 4159; CHECK-NEXT: [[TMP3:%.*]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[TMP1]], <4 x float> [[TMP2]])160; CHECK-NEXT: store <4 x float> [[TMP3]], ptr @dst32, align 4161; CHECK-NEXT: ret void162;163 %a0 = load float, ptr @srcA32, align 4164 %a1 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 1), align 4165 %a2 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 2), align 4166 %a3 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 3), align 4167 %b0 = load float, ptr @srcB32, align 4168 %b1 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 1), align 4169 %b2 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 2), align 4170 %b3 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 3), align 4171 %fmaxnum0 = call float @llvm.maxnum.f32(float %a0, float %b0)172 %fmaxnum1 = call float @llvm.maxnum.f32(float %a1, float %b1)173 %fmaxnum2 = call float @llvm.maxnum.f32(float %a2, float %b2)174 %fmaxnum3 = call float @llvm.maxnum.f32(float %a3, float %b3)175 store float %fmaxnum0, ptr @dst32, align 4176 store float %fmaxnum1, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 1), align 4177 store float %fmaxnum2, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 2), align 4178 store float %fmaxnum3, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 3), align 4179 ret void180}181 182define void @fmaxnum_8f32() #0 {183; SSE-LABEL: @fmaxnum_8f32(184; SSE-NEXT: [[TMP1:%.*]] = load <4 x float>, ptr @srcA32, align 4185; SSE-NEXT: [[TMP2:%.*]] = load <4 x float>, ptr @srcB32, align 4186; SSE-NEXT: [[TMP3:%.*]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[TMP1]], <4 x float> [[TMP2]])187; SSE-NEXT: store <4 x float> [[TMP3]], ptr @dst32, align 4188; SSE-NEXT: [[TMP4:%.*]] = load <4 x float>, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 4), align 4189; SSE-NEXT: [[TMP5:%.*]] = load <4 x float>, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 4), align 4190; SSE-NEXT: [[TMP6:%.*]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[TMP4]], <4 x float> [[TMP5]])191; SSE-NEXT: store <4 x float> [[TMP6]], ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 4), align 4192; SSE-NEXT: ret void193;194; AVX-LABEL: @fmaxnum_8f32(195; AVX-NEXT: [[TMP1:%.*]] = load <8 x float>, ptr @srcA32, align 4196; AVX-NEXT: [[TMP2:%.*]] = load <8 x float>, ptr @srcB32, align 4197; AVX-NEXT: [[TMP3:%.*]] = call <8 x float> @llvm.maxnum.v8f32(<8 x float> [[TMP1]], <8 x float> [[TMP2]])198; AVX-NEXT: store <8 x float> [[TMP3]], ptr @dst32, align 4199; AVX-NEXT: ret void200;201 %a0 = load float, ptr @srcA32, align 4202 %a1 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 1), align 4203 %a2 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 2), align 4204 %a3 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 3), align 4205 %a4 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 4), align 4206 %a5 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 5), align 4207 %a6 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 6), align 4208 %a7 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 7), align 4209 %b0 = load float, ptr @srcB32, align 4210 %b1 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 1), align 4211 %b2 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 2), align 4212 %b3 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 3), align 4213 %b4 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 4), align 4214 %b5 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 5), align 4215 %b6 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 6), align 4216 %b7 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 7), align 4217 %fmaxnum0 = call float @llvm.maxnum.f32(float %a0, float %b0)218 %fmaxnum1 = call float @llvm.maxnum.f32(float %a1, float %b1)219 %fmaxnum2 = call float @llvm.maxnum.f32(float %a2, float %b2)220 %fmaxnum3 = call float @llvm.maxnum.f32(float %a3, float %b3)221 %fmaxnum4 = call float @llvm.maxnum.f32(float %a4, float %b4)222 %fmaxnum5 = call float @llvm.maxnum.f32(float %a5, float %b5)223 %fmaxnum6 = call float @llvm.maxnum.f32(float %a6, float %b6)224 %fmaxnum7 = call float @llvm.maxnum.f32(float %a7, float %b7)225 store float %fmaxnum0, ptr @dst32, align 4226 store float %fmaxnum1, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 1), align 4227 store float %fmaxnum2, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 2), align 4228 store float %fmaxnum3, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 3), align 4229 store float %fmaxnum4, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 4), align 4230 store float %fmaxnum5, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 5), align 4231 store float %fmaxnum6, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 6), align 4232 store float %fmaxnum7, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 7), align 4233 ret void234}235 236define void @fmaxnum_16f32() #0 {237; SSE-LABEL: @fmaxnum_16f32(238; SSE-NEXT: [[TMP1:%.*]] = load <4 x float>, ptr @srcA32, align 4239; SSE-NEXT: [[TMP2:%.*]] = load <4 x float>, ptr @srcB32, align 4240; SSE-NEXT: [[TMP3:%.*]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[TMP1]], <4 x float> [[TMP2]])241; SSE-NEXT: store <4 x float> [[TMP3]], ptr @dst32, align 4242; SSE-NEXT: [[TMP4:%.*]] = load <4 x float>, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 4), align 4243; SSE-NEXT: [[TMP5:%.*]] = load <4 x float>, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 4), align 4244; SSE-NEXT: [[TMP6:%.*]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[TMP4]], <4 x float> [[TMP5]])245; SSE-NEXT: store <4 x float> [[TMP6]], ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 4), align 4246; SSE-NEXT: [[TMP7:%.*]] = load <4 x float>, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 8), align 4247; SSE-NEXT: [[TMP8:%.*]] = load <4 x float>, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 8), align 4248; SSE-NEXT: [[TMP9:%.*]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[TMP7]], <4 x float> [[TMP8]])249; SSE-NEXT: store <4 x float> [[TMP9]], ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 8), align 4250; SSE-NEXT: [[TMP10:%.*]] = load <4 x float>, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 12), align 4251; SSE-NEXT: [[TMP11:%.*]] = load <4 x float>, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 12), align 4252; SSE-NEXT: [[TMP12:%.*]] = call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[TMP10]], <4 x float> [[TMP11]])253; SSE-NEXT: store <4 x float> [[TMP12]], ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 12), align 4254; SSE-NEXT: ret void255;256; AVX256-LABEL: @fmaxnum_16f32(257; AVX256-NEXT: [[TMP1:%.*]] = load <8 x float>, ptr @srcA32, align 4258; AVX256-NEXT: [[TMP2:%.*]] = load <8 x float>, ptr @srcB32, align 4259; AVX256-NEXT: [[TMP3:%.*]] = call <8 x float> @llvm.maxnum.v8f32(<8 x float> [[TMP1]], <8 x float> [[TMP2]])260; AVX256-NEXT: store <8 x float> [[TMP3]], ptr @dst32, align 4261; AVX256-NEXT: [[TMP4:%.*]] = load <8 x float>, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 8), align 4262; AVX256-NEXT: [[TMP5:%.*]] = load <8 x float>, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 8), align 4263; AVX256-NEXT: [[TMP6:%.*]] = call <8 x float> @llvm.maxnum.v8f32(<8 x float> [[TMP4]], <8 x float> [[TMP5]])264; AVX256-NEXT: store <8 x float> [[TMP6]], ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 8), align 4265; AVX256-NEXT: ret void266;267; AVX512-LABEL: @fmaxnum_16f32(268; AVX512-NEXT: [[TMP1:%.*]] = load <16 x float>, ptr @srcA32, align 4269; AVX512-NEXT: [[TMP2:%.*]] = load <16 x float>, ptr @srcB32, align 4270; AVX512-NEXT: [[TMP3:%.*]] = call <16 x float> @llvm.maxnum.v16f32(<16 x float> [[TMP1]], <16 x float> [[TMP2]])271; AVX512-NEXT: store <16 x float> [[TMP3]], ptr @dst32, align 4272; AVX512-NEXT: ret void273;274 %a0 = load float, ptr @srcA32, align 4275 %a1 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 1), align 4276 %a2 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 2), align 4277 %a3 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 3), align 4278 %a4 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 4), align 4279 %a5 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 5), align 4280 %a6 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 6), align 4281 %a7 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 7), align 4282 %a8 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 8), align 4283 %a9 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 9), align 4284 %a10 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 10), align 4285 %a11 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 11), align 4286 %a12 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 12), align 4287 %a13 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 13), align 4288 %a14 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 14), align 4289 %a15 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcA32, i32 0, i64 15), align 4290 %b0 = load float, ptr @srcB32, align 4291 %b1 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 1), align 4292 %b2 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 2), align 4293 %b3 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 3), align 4294 %b4 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 4), align 4295 %b5 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 5), align 4296 %b6 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 6), align 4297 %b7 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 7), align 4298 %b8 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 8), align 4299 %b9 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 9), align 4300 %b10 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 10), align 4301 %b11 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 11), align 4302 %b12 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 12), align 4303 %b13 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 13), align 4304 %b14 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 14), align 4305 %b15 = load float, ptr getelementptr inbounds ([16 x float], ptr @srcB32, i32 0, i64 15), align 4306 %fmaxnum0 = call float @llvm.maxnum.f32(float %a0 , float %b0 )307 %fmaxnum1 = call float @llvm.maxnum.f32(float %a1 , float %b1 )308 %fmaxnum2 = call float @llvm.maxnum.f32(float %a2 , float %b2 )309 %fmaxnum3 = call float @llvm.maxnum.f32(float %a3 , float %b3 )310 %fmaxnum4 = call float @llvm.maxnum.f32(float %a4 , float %b4 )311 %fmaxnum5 = call float @llvm.maxnum.f32(float %a5 , float %b5 )312 %fmaxnum6 = call float @llvm.maxnum.f32(float %a6 , float %b6 )313 %fmaxnum7 = call float @llvm.maxnum.f32(float %a7 , float %b7 )314 %fmaxnum8 = call float @llvm.maxnum.f32(float %a8 , float %b8 )315 %fmaxnum9 = call float @llvm.maxnum.f32(float %a9 , float %b9 )316 %fmaxnum10 = call float @llvm.maxnum.f32(float %a10, float %b10)317 %fmaxnum11 = call float @llvm.maxnum.f32(float %a11, float %b11)318 %fmaxnum12 = call float @llvm.maxnum.f32(float %a12, float %b12)319 %fmaxnum13 = call float @llvm.maxnum.f32(float %a13, float %b13)320 %fmaxnum14 = call float @llvm.maxnum.f32(float %a14, float %b14)321 %fmaxnum15 = call float @llvm.maxnum.f32(float %a15, float %b15)322 store float %fmaxnum0 , ptr @dst32, align 4323 store float %fmaxnum1 , ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 1), align 4324 store float %fmaxnum2 , ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 2), align 4325 store float %fmaxnum3 , ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 3), align 4326 store float %fmaxnum4 , ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 4), align 4327 store float %fmaxnum5 , ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 5), align 4328 store float %fmaxnum6 , ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 6), align 4329 store float %fmaxnum7 , ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 7), align 4330 store float %fmaxnum8 , ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 8), align 4331 store float %fmaxnum9 , ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 9), align 4332 store float %fmaxnum10, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 10), align 4333 store float %fmaxnum11, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 11), align 4334 store float %fmaxnum12, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 12), align 4335 store float %fmaxnum13, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 13), align 4336 store float %fmaxnum14, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 14), align 4337 store float %fmaxnum15, ptr getelementptr inbounds ([16 x float], ptr @dst32, i32 0, i64 15), align 4338 ret void339}340 341define float @reduction_v4f32_fast(ptr %p) {342; CHECK-LABEL: @reduction_v4f32_fast(343; CHECK-NEXT: [[TMP2:%.*]] = load <4 x float>, ptr [[P:%.*]], align 4344; CHECK-NEXT: [[TMP3:%.*]] = call fast float @llvm.vector.reduce.fmax.v4f32(<4 x float> [[TMP2]])345; CHECK-NEXT: ret float [[TMP3]]346;347 %g1 = getelementptr inbounds float, ptr %p, i64 1348 %g2 = getelementptr inbounds float, ptr %p, i64 2349 %g3 = getelementptr inbounds float, ptr %p, i64 3350 %t0 = load float, ptr %p, align 4351 %t1 = load float, ptr %g1, align 4352 %t2 = load float, ptr %g2, align 4353 %t3 = load float, ptr %g3, align 4354 %m1 = tail call fast float @llvm.maxnum.f32(float %t1, float %t0)355 %m2 = tail call fast float @llvm.maxnum.f32(float %t2, float %m1)356 %m3 = tail call fast float @llvm.maxnum.f32(float %t3, float %m2)357 ret float %m3358}359 360define float @reduction_v4f32_nnan(ptr %p) {361; CHECK-LABEL: @reduction_v4f32_nnan(362; CHECK-NEXT: [[TMP2:%.*]] = load <4 x float>, ptr [[P:%.*]], align 4363; CHECK-NEXT: [[TMP3:%.*]] = call nnan float @llvm.vector.reduce.fmax.v4f32(<4 x float> [[TMP2]])364; CHECK-NEXT: ret float [[TMP3]]365;366 %g1 = getelementptr inbounds float, ptr %p, i64 1367 %g2 = getelementptr inbounds float, ptr %p, i64 2368 %g3 = getelementptr inbounds float, ptr %p, i64 3369 %t0 = load float, ptr %p, align 4370 %t1 = load float, ptr %g1, align 4371 %t2 = load float, ptr %g2, align 4372 %t3 = load float, ptr %g3, align 4373 %m1 = tail call nnan float @llvm.maxnum.f32(float %t1, float %t0)374 %m2 = tail call nnan float @llvm.maxnum.f32(float %t2, float %m1)375 %m3 = tail call nnan float @llvm.maxnum.f32(float %t3, float %m2)376 ret float %m3377}378 379; Negative test - must have nnan.380 381define float @reduction_v4f32_not_fast(ptr %p) {382; CHECK-LABEL: @reduction_v4f32_not_fast(383; CHECK-NEXT: [[G1:%.*]] = getelementptr inbounds float, ptr [[P:%.*]], i64 1384; CHECK-NEXT: [[G2:%.*]] = getelementptr inbounds float, ptr [[P]], i64 2385; CHECK-NEXT: [[G3:%.*]] = getelementptr inbounds float, ptr [[P]], i64 3386; CHECK-NEXT: [[T0:%.*]] = load float, ptr [[P]], align 4387; CHECK-NEXT: [[T1:%.*]] = load float, ptr [[G1]], align 4388; CHECK-NEXT: [[T2:%.*]] = load float, ptr [[G2]], align 4389; CHECK-NEXT: [[T3:%.*]] = load float, ptr [[G3]], align 4390; CHECK-NEXT: [[M1:%.*]] = tail call float @llvm.maxnum.f32(float [[T1]], float [[T0]])391; CHECK-NEXT: [[M2:%.*]] = tail call float @llvm.maxnum.f32(float [[T2]], float [[M1]])392; CHECK-NEXT: [[M3:%.*]] = tail call float @llvm.maxnum.f32(float [[T3]], float [[M2]])393; CHECK-NEXT: ret float [[M3]]394;395 %g1 = getelementptr inbounds float, ptr %p, i64 1396 %g2 = getelementptr inbounds float, ptr %p, i64 2397 %g3 = getelementptr inbounds float, ptr %p, i64 3398 %t0 = load float, ptr %p, align 4399 %t1 = load float, ptr %g1, align 4400 %t2 = load float, ptr %g2, align 4401 %t3 = load float, ptr %g3, align 4402 %m1 = tail call float @llvm.maxnum.f32(float %t1, float %t0)403 %m2 = tail call float @llvm.maxnum.f32(float %t2, float %m1)404 %m3 = tail call float @llvm.maxnum.f32(float %t3, float %m2)405 ret float %m3406}407 408define float @reduction_v8f32_fast(ptr %p) {409; CHECK-LABEL: @reduction_v8f32_fast(410; CHECK-NEXT: [[TMP2:%.*]] = load <8 x float>, ptr [[P:%.*]], align 4411; CHECK-NEXT: [[TMP3:%.*]] = call fast float @llvm.vector.reduce.fmax.v8f32(<8 x float> [[TMP2]])412; CHECK-NEXT: ret float [[TMP3]]413;414 %g1 = getelementptr inbounds float, ptr %p, i64 1415 %g2 = getelementptr inbounds float, ptr %p, i64 2416 %g3 = getelementptr inbounds float, ptr %p, i64 3417 %g4 = getelementptr inbounds float, ptr %p, i64 4418 %g5 = getelementptr inbounds float, ptr %p, i64 5419 %g6 = getelementptr inbounds float, ptr %p, i64 6420 %g7 = getelementptr inbounds float, ptr %p, i64 7421 %t0 = load float, ptr %p, align 4422 %t1 = load float, ptr %g1, align 4423 %t2 = load float, ptr %g2, align 4424 %t3 = load float, ptr %g3, align 4425 %t4 = load float, ptr %g4, align 4426 %t5 = load float, ptr %g5, align 4427 %t6 = load float, ptr %g6, align 4428 %t7 = load float, ptr %g7, align 4429 %m1 = tail call fast float @llvm.maxnum.f32(float %t1, float %t0)430 %m2 = tail call fast float @llvm.maxnum.f32(float %t2, float %m1)431 %m3 = tail call fast float @llvm.maxnum.f32(float %t3, float %m2)432 %m4 = tail call fast float @llvm.maxnum.f32(float %t4, float %m3)433 %m5 = tail call fast float @llvm.maxnum.f32(float %m4, float %t6)434 %m6 = tail call fast float @llvm.maxnum.f32(float %m5, float %t5)435 %m7 = tail call fast float @llvm.maxnum.f32(float %m6, float %t7)436 ret float %m7437}438 439define double @reduction_v2f64_fast(ptr %p) {440; CHECK-LABEL: @reduction_v2f64_fast(441; CHECK-NEXT: [[G1:%.*]] = getelementptr inbounds double, ptr [[P:%.*]], i64 1442; CHECK-NEXT: [[T0:%.*]] = load double, ptr [[P]], align 4443; CHECK-NEXT: [[T1:%.*]] = load double, ptr [[G1]], align 4444; CHECK-NEXT: [[M1:%.*]] = tail call fast double @llvm.maxnum.f64(double [[T1]], double [[T0]])445; CHECK-NEXT: ret double [[M1]]446;447 %g1 = getelementptr inbounds double, ptr %p, i64 1448 %t0 = load double, ptr %p, align 4449 %t1 = load double, ptr %g1, align 4450 %m1 = tail call fast double @llvm.maxnum.f64(double %t1, double %t0)451 ret double %m1452}453 454define double @reduction_v4f64_fast(ptr %p) {455; CHECK-LABEL: @reduction_v4f64_fast(456; CHECK-NEXT: [[TMP2:%.*]] = load <4 x double>, ptr [[P:%.*]], align 4457; CHECK-NEXT: [[TMP3:%.*]] = call fast double @llvm.vector.reduce.fmax.v4f64(<4 x double> [[TMP2]])458; CHECK-NEXT: ret double [[TMP3]]459;460 %g1 = getelementptr inbounds double, ptr %p, i64 1461 %g2 = getelementptr inbounds double, ptr %p, i64 2462 %g3 = getelementptr inbounds double, ptr %p, i64 3463 %t0 = load double, ptr %p, align 4464 %t1 = load double, ptr %g1, align 4465 %t2 = load double, ptr %g2, align 4466 %t3 = load double, ptr %g3, align 4467 %m1 = tail call fast double @llvm.maxnum.f64(double %t1, double %t0)468 %m2 = tail call fast double @llvm.maxnum.f64(double %t2, double %m1)469 %m3 = tail call fast double @llvm.maxnum.f64(double %t3, double %m2)470 ret double %m3471}472 473; Negative test - must have nnan.474 475define double @reduction_v4f64_wrong_fmf(ptr %p) {476; CHECK-LABEL: @reduction_v4f64_wrong_fmf(477; CHECK-NEXT: [[G1:%.*]] = getelementptr inbounds double, ptr [[P:%.*]], i64 1478; CHECK-NEXT: [[G2:%.*]] = getelementptr inbounds double, ptr [[P]], i64 2479; CHECK-NEXT: [[G3:%.*]] = getelementptr inbounds double, ptr [[P]], i64 3480; CHECK-NEXT: [[T0:%.*]] = load double, ptr [[P]], align 4481; CHECK-NEXT: [[T1:%.*]] = load double, ptr [[G1]], align 4482; CHECK-NEXT: [[T2:%.*]] = load double, ptr [[G2]], align 4483; CHECK-NEXT: [[T3:%.*]] = load double, ptr [[G3]], align 4484; CHECK-NEXT: [[M1:%.*]] = tail call ninf nsz double @llvm.maxnum.f64(double [[T1]], double [[T0]])485; CHECK-NEXT: [[M2:%.*]] = tail call ninf nsz double @llvm.maxnum.f64(double [[T2]], double [[M1]])486; CHECK-NEXT: [[M3:%.*]] = tail call ninf nsz double @llvm.maxnum.f64(double [[T3]], double [[M2]])487; CHECK-NEXT: ret double [[M3]]488;489 %g1 = getelementptr inbounds double, ptr %p, i64 1490 %g2 = getelementptr inbounds double, ptr %p, i64 2491 %g3 = getelementptr inbounds double, ptr %p, i64 3492 %t0 = load double, ptr %p, align 4493 %t1 = load double, ptr %g1, align 4494 %t2 = load double, ptr %g2, align 4495 %t3 = load double, ptr %g3, align 4496 %m1 = tail call ninf nsz double @llvm.maxnum.f64(double %t1, double %t0)497 %m2 = tail call ninf nsz double @llvm.maxnum.f64(double %t2, double %m1)498 %m3 = tail call ninf nsz double @llvm.maxnum.f64(double %t3, double %m2)499 ret double %m3500}501 502attributes #0 = { nounwind }503