1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -S -slp-vectorizer %s -slp-threshold=-10 | FileCheck %s 3target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128" 4target triple = "aarch64--linux-gnu" 5 6%structA = type { [2 x float] } 7 8define void @test1(%structA* nocapture readonly %J, i32 %xmin, i32 %ymin) { 9; CHECK-LABEL: @test1( 10; CHECK-NEXT: entry: 11; CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x i32> poison, i32 [[XMIN:%.*]], i32 0 12; CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x i32> [[TMP0]], i32 [[YMIN:%.*]], i32 1 13; CHECK-NEXT: br label [[FOR_BODY3_LR_PH:%.*]] 14; CHECK: for.body3.lr.ph: 15; CHECK-NEXT: [[TMP2:%.*]] = sitofp <2 x i32> [[TMP1]] to <2 x float> 16; CHECK-NEXT: [[ARRAYIDX4:%.*]] = getelementptr inbounds [[STRUCTA:%.*]], %structA* [[J:%.*]], i64 0, i32 0, i64 0 17; CHECK-NEXT: [[ARRAYIDX9:%.*]] = getelementptr inbounds [[STRUCTA]], %structA* [[J]], i64 0, i32 0, i64 1 18; CHECK-NEXT: [[TMP3:%.*]] = bitcast float* [[ARRAYIDX4]] to <2 x float>* 19; CHECK-NEXT: [[TMP4:%.*]] = load <2 x float>, <2 x float>* [[TMP3]], align 4 20; CHECK-NEXT: [[TMP5:%.*]] = fsub fast <2 x float> [[TMP2]], [[TMP4]] 21; CHECK-NEXT: [[TMP6:%.*]] = fmul fast <2 x float> [[TMP5]], [[TMP5]] 22; CHECK-NEXT: [[TMP7:%.*]] = extractelement <2 x float> [[TMP6]], i32 0 23; CHECK-NEXT: [[TMP8:%.*]] = extractelement <2 x float> [[TMP6]], i32 1 24; CHECK-NEXT: [[ADD:%.*]] = fadd fast float [[TMP7]], [[TMP8]] 25; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[ADD]], 0.000000e+00 26; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY3_LR_PH]], label [[FOR_END27:%.*]] 27; CHECK: for.end27: 28; CHECK-NEXT: ret void 29; 30 31entry: 32 br label %for.body3.lr.ph 33 34for.body3.lr.ph: 35 %conv5 = sitofp i32 %ymin to float 36 %conv = sitofp i32 %xmin to float 37 %arrayidx4 = getelementptr inbounds %structA, %structA* %J, i64 0, i32 0, i64 0 38 %0 = load float, float* %arrayidx4, align 4 39 %sub = fsub fast float %conv, %0 40 %arrayidx9 = getelementptr inbounds %structA, %structA* %J, i64 0, i32 0, i64 1 41 %1 = load float, float* %arrayidx9, align 4 42 %sub10 = fsub fast float %conv5, %1 43 %mul11 = fmul fast float %sub, %sub 44 %mul12 = fmul fast float %sub10, %sub10 45 %add = fadd fast float %mul11, %mul12 46 %cmp = fcmp oeq float %add, 0.000000e+00 47 br i1 %cmp, label %for.body3.lr.ph, label %for.end27 48 49for.end27: 50 ret void 51} 52 53define void @test2(%structA* nocapture readonly %J, i32 %xmin, i32 %ymin) { 54; CHECK-LABEL: @test2( 55; CHECK-NEXT: entry: 56; CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x i32> poison, i32 [[XMIN:%.*]], i32 0 57; CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x i32> [[TMP0]], i32 [[YMIN:%.*]], i32 1 58; CHECK-NEXT: br label [[FOR_BODY3_LR_PH:%.*]] 59; CHECK: for.body3.lr.ph: 60; CHECK-NEXT: [[TMP2:%.*]] = sitofp <2 x i32> [[TMP1]] to <2 x float> 61; CHECK-NEXT: [[ARRAYIDX4:%.*]] = getelementptr inbounds [[STRUCTA:%.*]], %structA* [[J:%.*]], i64 0, i32 0, i64 0 62; CHECK-NEXT: [[ARRAYIDX9:%.*]] = getelementptr inbounds [[STRUCTA]], %structA* [[J]], i64 0, i32 0, i64 1 63; CHECK-NEXT: [[TMP3:%.*]] = bitcast float* [[ARRAYIDX4]] to <2 x float>* 64; CHECK-NEXT: [[TMP4:%.*]] = load <2 x float>, <2 x float>* [[TMP3]], align 4 65; CHECK-NEXT: [[TMP5:%.*]] = fsub fast <2 x float> [[TMP2]], [[TMP4]] 66; CHECK-NEXT: [[TMP6:%.*]] = fmul fast <2 x float> [[TMP5]], [[TMP5]] 67; CHECK-NEXT: [[TMP7:%.*]] = extractelement <2 x float> [[TMP6]], i32 0 68; CHECK-NEXT: [[TMP8:%.*]] = extractelement <2 x float> [[TMP6]], i32 1 69; CHECK-NEXT: [[ADD:%.*]] = fadd fast float [[TMP8]], [[TMP7]] 70; CHECK-NEXT: [[CMP:%.*]] = fcmp oeq float [[ADD]], 0.000000e+00 71; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY3_LR_PH]], label [[FOR_END27:%.*]] 72; CHECK: for.end27: 73; CHECK-NEXT: ret void 74; 75 76entry: 77 br label %for.body3.lr.ph 78 79for.body3.lr.ph: 80 %conv5 = sitofp i32 %ymin to float 81 %conv = sitofp i32 %xmin to float 82 %arrayidx4 = getelementptr inbounds %structA, %structA* %J, i64 0, i32 0, i64 0 83 %0 = load float, float* %arrayidx4, align 4 84 %sub = fsub fast float %conv, %0 85 %arrayidx9 = getelementptr inbounds %structA, %structA* %J, i64 0, i32 0, i64 1 86 %1 = load float, float* %arrayidx9, align 4 87 %sub10 = fsub fast float %conv5, %1 88 %mul11 = fmul fast float %sub, %sub 89 %mul12 = fmul fast float %sub10, %sub10 90 %add = fadd fast float %mul12, %mul11 ;;;<---- Operands commuted!! 91 %cmp = fcmp oeq float %add, 0.000000e+00 92 br i1 %cmp, label %for.body3.lr.ph, label %for.end27 93 94for.end27: 95 ret void 96} 97