1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=slp-vectorizer -slp-vectorize-non-power-of-2 -mtriple=x86_64-apple-macosx -S %s | FileCheck --check-prefixes=CHECK,NON-POW2 %s
3 ; RUN: opt -passes=slp-vectorizer -slp-vectorize-non-power-of-2=false -mtriple=x86_64-apple-macosx -S %s | FileCheck --check-prefixes=CHECK,POW2-ONLY %s
5 define void @vec3_vectorize_call(ptr %Colour, float %0) {
6 ; NON-POW2-LABEL: @vec3_vectorize_call(
7 ; NON-POW2-NEXT: entry:
8 ; NON-POW2-NEXT: [[TMP1:%.*]] = load <2 x float>, ptr [[COLOUR:%.*]], align 4
9 ; NON-POW2-NEXT: [[TMP2:%.*]] = insertelement <3 x float> poison, float [[TMP0:%.*]], i32 2
10 ; NON-POW2-NEXT: [[TMP4:%.*]] = call <3 x float> @llvm.vector.insert.v3f32.v2f32(<3 x float> [[TMP2]], <2 x float> [[TMP1]], i64 0)
11 ; NON-POW2-NEXT: [[TMP5:%.*]] = call <3 x float> @llvm.fmuladd.v3f32(<3 x float> [[TMP4]], <3 x float> zeroinitializer, <3 x float> zeroinitializer)
12 ; NON-POW2-NEXT: store <3 x float> [[TMP5]], ptr [[COLOUR]], align 4
13 ; NON-POW2-NEXT: ret void
15 ; POW2-ONLY-LABEL: @vec3_vectorize_call(
16 ; POW2-ONLY-NEXT: entry:
17 ; POW2-ONLY-NEXT: [[TMP1:%.*]] = load <2 x float>, ptr [[COLOUR:%.*]], align 4
18 ; POW2-ONLY-NEXT: [[TMP2:%.*]] = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> [[TMP1]], <2 x float> zeroinitializer, <2 x float> zeroinitializer)
19 ; POW2-ONLY-NEXT: store <2 x float> [[TMP2]], ptr [[COLOUR]], align 4
20 ; POW2-ONLY-NEXT: [[ARRAYIDX99_I1:%.*]] = getelementptr float, ptr [[COLOUR]], i64 2
21 ; POW2-ONLY-NEXT: [[TMP3:%.*]] = call float @llvm.fmuladd.f32(float [[TMP0:%.*]], float 0.000000e+00, float 0.000000e+00)
22 ; POW2-ONLY-NEXT: store float [[TMP3]], ptr [[ARRAYIDX99_I1]], align 4
23 ; POW2-ONLY-NEXT: ret void
26 %1 = load float, ptr %Colour, align 4
27 %2 = call float @llvm.fmuladd.f32(float %1, float 0.000000e+00, float 0.000000e+00)
28 store float %2, ptr %Colour, align 4
29 %arrayidx91.i = getelementptr float, ptr %Colour, i64 1
30 %3 = load float, ptr %arrayidx91.i, align 4
31 %4 = call float @llvm.fmuladd.f32(float %3, float 0.000000e+00, float 0.000000e+00)
32 store float %4, ptr %arrayidx91.i, align 4
33 %arrayidx99.i1 = getelementptr float, ptr %Colour, i64 2
34 %5 = call float @llvm.fmuladd.f32(float %0, float 0.000000e+00, float 0.000000e+00)
35 store float %5, ptr %arrayidx99.i1, align 4
39 define void @vec3_fmuladd_64(ptr %Colour, double %0) {
40 ; CHECK-LABEL: @vec3_fmuladd_64(
42 ; CHECK-NEXT: [[ARRAYIDX80:%.*]] = getelementptr float, ptr [[COLOUR:%.*]], i64 2
43 ; CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x double> poison, double [[TMP0:%.*]], i32 0
44 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <2 x double> [[TMP1]], <2 x double> poison, <2 x i32> zeroinitializer
45 ; CHECK-NEXT: [[TMP3:%.*]] = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> [[TMP2]], <2 x double> zeroinitializer, <2 x double> zeroinitializer)
46 ; CHECK-NEXT: [[TMP4:%.*]] = fptrunc <2 x double> [[TMP3]] to <2 x float>
47 ; CHECK-NEXT: store <2 x float> [[TMP4]], ptr [[COLOUR]], align 4
48 ; CHECK-NEXT: [[TMP5:%.*]] = call double @llvm.fmuladd.f64(double [[TMP0]], double 0.000000e+00, double 0.000000e+00)
49 ; CHECK-NEXT: [[CONV82:%.*]] = fptrunc double [[TMP5]] to float
50 ; CHECK-NEXT: store float [[CONV82]], ptr [[ARRAYIDX80]], align 4
51 ; CHECK-NEXT: ret void
54 %arrayidx72 = getelementptr float, ptr %Colour, i64 1
55 %arrayidx80 = getelementptr float, ptr %Colour, i64 2
56 %1 = call double @llvm.fmuladd.f64(double %0, double 0.000000e+00, double 0.000000e+00)
57 %conv66 = fptrunc double %1 to float
58 store float %conv66, ptr %Colour, align 4
59 %2 = call double @llvm.fmuladd.f64(double %0, double 0.000000e+00, double 0.000000e+00)
60 %conv74 = fptrunc double %2 to float
61 store float %conv74, ptr %arrayidx72, align 4
62 %3 = call double @llvm.fmuladd.f64(double %0, double 0.000000e+00, double 0.000000e+00)
63 %conv82 = fptrunc double %3 to float
64 store float %conv82, ptr %arrayidx80, align 4
68 declare float @llvm.fmuladd.f32(float, float, float)
70 declare double @llvm.fmuladd.f64(double, double, double)