1 ; RUN: llc -mtriple=aarch64-unknown-unknown < %s | FileCheck %s
3 ; Following test cases check:
6 ; recip = 1.0 / D; a * recip; b * recip; c * recip;
7 define void @three_fdiv_float(float %D, float %a, float %b, float %c) #0 {
8 ; CHECK-LABEL: three_fdiv_float:
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)
21 define void @three_fdiv_double(double %D, double %a, double %b, double %c) #0 {
22 ; CHECK-LABEL: three_fdiv_double:
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)
35 define 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:
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)
49 define 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:
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)
63 ; Following test cases check we never combine two FDIVs if neither of them
64 ; calculates a reciprocal.
65 define void @two_fdiv_float(float %D, float %a, float %b) #0 {
66 ; CHECK-LABEL: two_fdiv_float:
70 %div = fdiv float %a, %D
71 %div1 = fdiv float %b, %D
72 tail call void @foo_2f(float %div, float %div1)
76 define void @two_fdiv_double(double %D, double %a, double %b) #0 {
77 ; CHECK-LABEL: two_fdiv_double:
81 %div = fdiv double %a, %D
82 %div1 = fdiv double %b, %D
83 tail call void @foo_2d(double %div, double %div1)
87 declare void @foo_3f(float, float, float)
88 declare void @foo_3d(double, double, double)
89 declare void @foo_3_4xf(<4 x float>, <4 x float>, <4 x float>)
90 declare void @foo_3_2xd(<2 x double>, <2 x double>, <2 x double>)
91 declare void @foo_2f(float, float)
92 declare void @foo_2d(double, double)
94 attributes #0 = { "unsafe-fp-math"="true" }