1; RUN: opt -S -reassociate < %s | FileCheck %s
2
3define void @main(float, float) {
4; CHECK-LABEL: @main(
5; CHECK-NEXT:  wrapper_entry:
6; CHECK-NEXT:    [[TMP2:%.*]] = fsub float undef, %0
7; CHECK-NEXT:    [[TMP3:%.*]] = fsub float undef, %1
8; CHECK-NEXT:    [[TMP4:%.*]] = call float @llvm.rsqrt.f32(float undef)
9; CHECK-NEXT:    [[REASS_ADD2:%.*]] = fadd fast float [[TMP3]], [[TMP2]]
10; CHECK-NEXT:    [[REASS_MUL3:%.*]] = fmul fast float [[REASS_ADD2]], undef
11; CHECK-NEXT:    [[REASS_ADD1:%.*]] = fadd fast float [[REASS_MUL3]], fmul (float undef, float undef)
12; CHECK-NEXT:    [[REASS_MUL:%.*]] = fmul fast float [[REASS_ADD1]], [[TMP4]]
13; CHECK-NEXT:    [[TMP5:%.*]] = call float @foo2(float [[REASS_MUL]], float 0.000000e+00)
14; CHECK-NEXT:    [[MUL36:%.*]] = fmul fast float [[TMP5]], 1.500000e+00
15; CHECK-NEXT:    call void @foo1(i32 4, float [[MUL36]])
16; CHECK-NEXT:    ret void
17;
18wrapper_entry:
19  %2 = fsub float undef, %0
20  %3 = fsub float undef, %1
21  %4 = call float @llvm.rsqrt.f32(float undef)
22  %5 = fmul fast float undef, %4
23  %6 = fmul fast float %2, %4
24  %7 = fmul fast float %3, %4
25  %8 = fmul fast float %5, undef
26  %9 = fmul fast float %6, undef
27  %10 = fmul fast float %7, undef
28  %11 = fadd fast float %8, %9
29  %12 = fadd fast float %11, %10
30  %13 = call float @foo2(float %12, float 0.000000e+00)
31  %mul36 = fmul fast float %13, 1.500000e+00
32  call void @foo1(i32 4, float %mul36)
33  ret void
34}
35
36declare void @foo1(i32, float)
37
38declare float @foo2(float, float) #1
39
40declare float @llvm.rsqrt.f32(float) #1
41
42attributes #0 = { argmemonly nounwind }
43attributes #1 = { nounwind readnone }
44
45