1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt < %s -passes=slp-vectorizer -S -mtriple=riscv64-unknown-linux -mattr=+v -pass-remarks-output=%t | FileCheck %s 3; RUN: FileCheck %s --check-prefix=YAML < %t 4 5; YAML-LABEL: --- !Passed 6; YAML-NEXT: Pass: slp-vectorizer 7; YAML-NEXT: Name: StoresVectorized 8; YAML-NEXT: Function: min_double 9; YAML-NEXT: Args: 10; YAML-NEXT: - String: 'Stores SLP vectorized with cost ' 11; YAML-NEXT: - Cost: '-1' 12; YAML-NEXT: - String: ' and with tree size ' 13; YAML-NEXT: - TreeSize: '6' 14define i32 @min_double(ptr noalias nocapture %A, ptr noalias nocapture %B) { 15; CHECK-LABEL: @min_double( 16; CHECK-NEXT: entry: 17; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds double, ptr [[B:%.*]], i64 10 18; CHECK-NEXT: [[TMP0:%.*]] = load <2 x double>, ptr [[ARRAYIDX]], align 8 19; CHECK-NEXT: [[TMP1:%.*]] = fcmp olt <2 x double> [[TMP0]], zeroinitializer 20; CHECK-NEXT: [[TMP2:%.*]] = select <2 x i1> [[TMP1]], <2 x double> [[TMP0]], <2 x double> zeroinitializer 21; CHECK-NEXT: store <2 x double> [[TMP2]], ptr [[A:%.*]], align 8 22; CHECK-NEXT: ret i32 undef 23; 24entry: 25 %arrayidx = getelementptr inbounds double, ptr %B, i64 10 26 %0 = load double, ptr %arrayidx, align 8 27 %tobool = fcmp olt double %0, 0.000000e+00 28 %cond = select i1 %tobool, double %0, double 0.000000e+00 29 store double %cond, ptr %A, align 8 30 %arrayidx2 = getelementptr inbounds double, ptr %B, i64 11 31 %1 = load double, ptr %arrayidx2, align 8 32 %tobool3 = fcmp olt double %1, 0.000000e+00 33 %cond7 = select i1 %tobool3, double %1, double 0.000000e+00 34 %arrayidx8 = getelementptr inbounds double, ptr %A, i64 1 35 store double %cond7, ptr %arrayidx8, align 8 36 ret i32 undef 37} 38 39; YAML-LABEL: --- !Passed 40; YAML-NEXT: Pass: slp-vectorizer 41; YAML-NEXT: Name: StoresVectorized 42; YAML-NEXT: Function: min_float 43; YAML-NEXT: Args: 44; YAML-NEXT: - String: 'Stores SLP vectorized with cost ' 45; YAML-NEXT: - Cost: '-2' 46; YAML-NEXT: - String: ' and with tree size ' 47; YAML-NEXT: - TreeSize: '6' 48define i32 @min_float(ptr noalias nocapture %A, ptr noalias nocapture %B) { 49; CHECK-LABEL: @min_float( 50; CHECK-NEXT: entry: 51; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds float, ptr [[B:%.*]], i64 10 52; CHECK-NEXT: [[TMP0:%.*]] = load <2 x float>, ptr [[ARRAYIDX]], align 8 53; CHECK-NEXT: [[TMP1:%.*]] = fcmp ule <2 x float> [[TMP0]], zeroinitializer 54; CHECK-NEXT: [[TMP2:%.*]] = select <2 x i1> [[TMP1]], <2 x float> [[TMP0]], <2 x float> zeroinitializer 55; CHECK-NEXT: store <2 x float> [[TMP2]], ptr [[A:%.*]], align 8 56; CHECK-NEXT: ret i32 undef 57; 58entry: 59 %arrayidx = getelementptr inbounds float, ptr %B, i64 10 60 %0 = load float, ptr %arrayidx, align 8 61 %tobool = fcmp ule float %0, 0.000000e+00 62 %cond = select i1 %tobool, float %0, float 0.000000e+00 63 store float %cond, ptr %A, align 8 64 %arrayidx2 = getelementptr inbounds float, ptr %B, i64 11 65 %1 = load float, ptr %arrayidx2, align 8 66 %tobool3 = fcmp ule float %1, 0.000000e+00 67 %cond7 = select i1 %tobool3, float %1, float 0.000000e+00 68 %arrayidx8 = getelementptr inbounds float, ptr %A, i64 1 69 store float %cond7, ptr %arrayidx8, align 8 70 ret i32 undef 71} 72 73; YAML-LABEL: --- !Passed 74; YAML-NEXT: Pass: slp-vectorizer 75; YAML-NEXT: Name: StoresVectorized 76; YAML-NEXT: Function: max_double 77; YAML-NEXT: Args: 78; YAML-NEXT: - String: 'Stores SLP vectorized with cost ' 79; YAML-NEXT: - Cost: '-1' 80; YAML-NEXT: - String: ' and with tree size ' 81; YAML-NEXT: - TreeSize: '6' 82define i32 @max_double(ptr noalias nocapture %A, ptr noalias nocapture %B) { 83; CHECK-LABEL: @max_double( 84; CHECK-NEXT: entry: 85; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds double, ptr [[B:%.*]], i64 10 86; CHECK-NEXT: [[TMP0:%.*]] = load <2 x double>, ptr [[ARRAYIDX]], align 8 87; CHECK-NEXT: [[TMP1:%.*]] = fcmp ogt <2 x double> [[TMP0]], zeroinitializer 88; CHECK-NEXT: [[TMP2:%.*]] = select <2 x i1> [[TMP1]], <2 x double> [[TMP0]], <2 x double> zeroinitializer 89; CHECK-NEXT: store <2 x double> [[TMP2]], ptr [[A:%.*]], align 8 90; CHECK-NEXT: ret i32 undef 91; 92entry: 93 %arrayidx = getelementptr inbounds double, ptr %B, i64 10 94 %0 = load double, ptr %arrayidx, align 8 95 %tobool = fcmp ogt double %0, 0.000000e+00 96 %cond = select i1 %tobool, double %0, double 0.000000e+00 97 store double %cond, ptr %A, align 8 98 %arrayidx2 = getelementptr inbounds double, ptr %B, i64 11 99 %1 = load double, ptr %arrayidx2, align 8 100 %tobool3 = fcmp ogt double %1, 0.000000e+00 101 %cond7 = select i1 %tobool3, double %1, double 0.000000e+00 102 %arrayidx8 = getelementptr inbounds double, ptr %A, i64 1 103 store double %cond7, ptr %arrayidx8, align 8 104 ret i32 undef 105} 106 107; YAML-LABEL: --- !Passed 108; YAML-NEXT: Pass: slp-vectorizer 109; YAML-NEXT: Name: StoresVectorized 110; YAML-NEXT: Function: max_float 111; YAML-NEXT: Args: 112; YAML-NEXT: - String: 'Stores SLP vectorized with cost ' 113; YAML-NEXT: - Cost: '-2' 114; YAML-NEXT: - String: ' and with tree size ' 115; YAML-NEXT: - TreeSize: '6' 116define i32 @max_float(ptr noalias nocapture %A, ptr noalias nocapture %B) { 117; CHECK-LABEL: @max_float( 118; CHECK-NEXT: entry: 119; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds float, ptr [[B:%.*]], i64 10 120; CHECK-NEXT: [[TMP0:%.*]] = load <2 x float>, ptr [[ARRAYIDX]], align 8 121; CHECK-NEXT: [[TMP1:%.*]] = fcmp uge <2 x float> [[TMP0]], zeroinitializer 122; CHECK-NEXT: [[TMP2:%.*]] = select <2 x i1> [[TMP1]], <2 x float> [[TMP0]], <2 x float> zeroinitializer 123; CHECK-NEXT: store <2 x float> [[TMP2]], ptr [[A:%.*]], align 8 124; CHECK-NEXT: ret i32 undef 125; 126entry: 127 %arrayidx = getelementptr inbounds float, ptr %B, i64 10 128 %0 = load float, ptr %arrayidx, align 8 129 %tobool = fcmp uge float %0, 0.000000e+00 130 %cond = select i1 %tobool, float %0, float 0.000000e+00 131 store float %cond, ptr %A, align 8 132 %arrayidx2 = getelementptr inbounds float, ptr %B, i64 11 133 %1 = load float, ptr %arrayidx2, align 8 134 %tobool3 = fcmp uge float %1, 0.000000e+00 135 %cond7 = select i1 %tobool3, float %1, float 0.000000e+00 136 %arrayidx8 = getelementptr inbounds float, ptr %A, i64 1 137 store float %cond7, ptr %arrayidx8, align 8 138 ret i32 undef 139} 140 141