source: icGREP/icgrep-devel/llvm-3.8.0.src/test/CodeGen/AArch64/fdiv-combine.ll @ 5027

Last change on this file since 5027 was 5027, checked in by cameron, 3 years ago

Upgrade to llvm 3.8

File size: 2.6 KB
Line 
1; RUN: llc -march=aarch64 < %s | FileCheck %s
2
3; Following test cases check:
4;   a / D; b / D; c / D;
5;                =>
6;   recip = 1.0 / D; a * recip; b * recip; c * recip;
7define void @three_fdiv_float(float %D, float %a, float %b, float %c) #0 {
8; CHECK-LABEL: three_fdiv_float:
9; CHECK: fdiv
10; CHECK-NEXT-NOT: fdiv
11; CHECK: fmul
12; CHECK: fmul
13; CHECK: fmul
14  %div = fdiv float %a, %D
15  %div1 = fdiv float %b, %D
16  %div2 = fdiv float %c, %D
17  tail call void @foo_3f(float %div, float %div1, float %div2)
18  ret void
19}
20
21define void @three_fdiv_double(double %D, double %a, double %b, double %c) #0 {
22; CHECK-LABEL: three_fdiv_double:
23; CHECK: fdiv
24; CHECK-NEXT-NOT: fdiv
25; CHECK: fmul
26; CHECK: fmul
27; CHECK: fmul
28  %div = fdiv double %a, %D
29  %div1 = fdiv double %b, %D
30  %div2 = fdiv double %c, %D
31  tail call void @foo_3d(double %div, double %div1, double %div2)
32  ret void
33}
34
35define void @three_fdiv_4xfloat(<4 x float> %D, <4 x float> %a, <4 x float> %b, <4 x float> %c) #0 {
36; CHECK-LABEL: three_fdiv_4xfloat:
37; CHECK: fdiv
38; CHECK-NEXT-NOT: fdiv
39; CHECK: fmul
40; CHECK: fmul
41; CHECK: fmul
42  %div = fdiv <4 x float> %a, %D
43  %div1 = fdiv <4 x float> %b, %D
44  %div2 = fdiv <4 x float> %c, %D
45  tail call void @foo_3_4xf(<4 x float> %div, <4 x float> %div1, <4 x float> %div2)
46  ret void
47}
48
49define void @three_fdiv_2xdouble(<2 x double> %D, <2 x double> %a, <2 x double> %b, <2 x double> %c) #0 {
50; CHECK-LABEL: three_fdiv_2xdouble:
51; CHECK: fdiv
52; CHECK-NEXT-NOT: fdiv
53; CHECK: fmul
54; CHECK: fmul
55; CHECK: fmul
56  %div = fdiv <2 x double> %a, %D
57  %div1 = fdiv <2 x double> %b, %D
58  %div2 = fdiv <2 x double> %c, %D
59  tail call void @foo_3_2xd(<2 x double> %div, <2 x double> %div1, <2 x double> %div2)
60  ret void
61}
62
63; Following test cases check we never combine two FDIVs if neither of them
64; calculates a reciprocal.
65define void @two_fdiv_float(float %D, float %a, float %b) #0 {
66; CHECK-LABEL: two_fdiv_float:
67; CHECK: fdiv
68; CHECK: fdiv
69; CHECK-NEXT-NOT: fmul
70  %div = fdiv float %a, %D
71  %div1 = fdiv float %b, %D
72  tail call void @foo_2f(float %div, float %div1)
73  ret void
74}
75
76define void @two_fdiv_double(double %D, double %a, double %b) #0 {
77; CHECK-LABEL: two_fdiv_double:
78; CHECK: fdiv
79; CHECK: fdiv
80; CHECK-NEXT-NOT: fmul
81  %div = fdiv double %a, %D
82  %div1 = fdiv double %b, %D
83  tail call void @foo_2d(double %div, double %div1)
84  ret void
85}
86
87declare void @foo_3f(float, float, float)
88declare void @foo_3d(double, double, double)
89declare void @foo_3_4xf(<4 x float>, <4 x float>, <4 x float>)
90declare void @foo_3_2xd(<2 x double>, <2 x double>, <2 x double>)
91declare void @foo_2f(float, float)
92declare void @foo_2d(double, double)
93
94attributes #0 = { "unsafe-fp-math"="true" }
Note: See TracBrowser for help on using the repository browser.