120
|
1 ; RUN: opt -instcombine -S < %s | FileCheck %s
|
|
2
|
|
3 ; CHECK-LABEL: test_scalarize_phi
|
|
4 ; CHECK: fmul fast float
|
|
5 define void @test_scalarize_phi(i32 * %n, float * %inout) {
|
|
6 entry:
|
|
7 %0 = load volatile float, float * %inout, align 4
|
|
8 %splat.splatinsert = insertelement <4 x float> undef, float %0, i32 0
|
|
9 %splat.splat = shufflevector <4 x float> %splat.splatinsert, <4 x float> undef, <4 x i32> zeroinitializer
|
|
10 %splat.splatinsert1 = insertelement <4 x float> undef, float 3.0, i32 0
|
|
11 br label %for.cond
|
|
12
|
|
13 for.cond:
|
|
14 %x.0 = phi <4 x float> [ %splat.splat, %entry ], [ %mul, %for.body ]
|
|
15 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
|
|
16 %1 = load i32, i32 * %n, align 4
|
|
17 %cmp = icmp ne i32 %i.0, %1
|
|
18 br i1 %cmp, label %for.body, label %for.end
|
|
19
|
|
20 for.body:
|
|
21 %2 = extractelement <4 x float> %x.0, i32 1
|
|
22 store volatile float %2, float * %inout, align 4
|
|
23 %mul = fmul fast <4 x float> %x.0, <float 0x4002A3D700000000, float 0x4002A3D700000000, float 0x4002A3D700000000, float 0x4002A3D700000000>
|
|
24 %inc = add nsw i32 %i.0, 1
|
|
25 br label %for.cond
|
|
26
|
|
27 for.end:
|
|
28 ret void
|
|
29 }
|
|
30
|
|
31 ; CHECK-LABEL: test_extract_element_fastmath
|
|
32 ; CHECK: fadd fast float
|
|
33 define float @test_extract_element_fastmath(<4 x float> %x) #0 {
|
|
34 entry:
|
|
35 %add = fadd fast <4 x float> %x, <float 0x4002A3D700000000, float 0x4002A3D700000000, float 0x4002A3D700000000, float 0x4002A3D700000000>
|
|
36 %0 = extractelement <4 x float> %add, i32 2
|
|
37 ret float %0
|
|
38 }
|
|
39
|