52 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -S -passes=instcombine < %s | FileCheck %s3 4; A copy of fmul.ll, with undef at insertelement/shufflevector replaced with5; poison6 7; Don't crash when attempting to cast a constant FMul to an instruction.8define void @test8(ptr %inout, i1 %c1) {9; CHECK-LABEL: @test8(10; CHECK-NEXT: entry:11; CHECK-NEXT: br label [[FOR_COND:%.*]]12; CHECK: for.cond:13; CHECK-NEXT: [[LOCAL_VAR_7_0:%.*]] = phi <4 x float> [ splat (float -0.000000e+00), [[ENTRY:%.*]] ], [ [[TMP0:%.*]], [[FOR_BODY:%.*]] ]14; CHECK-NEXT: br i1 [[C1:%.*]], label [[FOR_BODY]], label [[FOR_END:%.*]]15; CHECK: for.body:16; CHECK-NEXT: [[TMP0]] = insertelement <4 x float> [[LOCAL_VAR_7_0]], float 0.000000e+00, i64 217; CHECK-NEXT: br label [[FOR_COND]]18; CHECK: for.end:19; CHECK-NEXT: ret void20;21entry:22 %0 = load i32, ptr %inout, align 423 %conv = uitofp i32 %0 to float24 %vecinit = insertelement <4 x float> <float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float poison>, float %conv, i32 325 %sub = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %vecinit26 %1 = shufflevector <4 x float> %sub, <4 x float> poison, <4 x i32> <i32 1, i32 1, i32 1, i32 1>27 %mul = fmul <4 x float> zeroinitializer, %128 br label %for.cond29 30for.cond: ; preds = %for.body, %entry31 %local_var_7.0 = phi <4 x float> [ %mul, %entry ], [ %2, %for.body ]32 br i1 %c1, label %for.body, label %for.end33 34for.body: ; preds = %for.cond35 %2 = insertelement <4 x float> %local_var_7.0, float 0.000000e+00, i32 236 br label %for.cond37 38for.end: ; preds = %for.cond39 ret void40}41 42 43; fastmath => z * splat(0) = splat(0), even for scalable vectors44define <vscale x 2 x float> @mul_scalable_splat_zero(<vscale x 2 x float> %z) {45; CHECK-LABEL: @mul_scalable_splat_zero(46; CHECK-NEXT: ret <vscale x 2 x float> zeroinitializer47;48 %shuf = shufflevector <vscale x 2 x float> insertelement (<vscale x 2 x float> poison, float 0.0, i32 0), <vscale x 2 x float> poison, <vscale x 2 x i32> zeroinitializer49 %t3 = fmul fast <vscale x 2 x float> %shuf, %z50 ret <vscale x 2 x float> %t351}52