1; RUN: llc < %s -march=cellspu > %t1.s
2; RUN: grep dfa    %t1.s | count 2
3; RUN: grep dfs    %t1.s | count 2
4; RUN: grep dfm    %t1.s | count 6
5; RUN: grep dfma   %t1.s | count 2
6; RUN: grep dfms   %t1.s | count 2
7; RUN: grep dfnms  %t1.s | count 4
8;
9; This file includes double precision floating point arithmetic instructions
10target datalayout = "E-p:32:32:128-f64:64:128-f32:32:128-i64:32:128-i32:32:128-i16:16:128-i8:8:128-i1:8:128-a0:0:128-v128:128:128-s0:128:128"
11target triple = "spu"
12
13define double @fadd(double %arg1, double %arg2) {
14        %A = fadd double %arg1, %arg2
15        ret double %A
16}
17
18define <2 x double> @fadd_vec(<2 x double> %arg1, <2 x double> %arg2) {
19        %A = fadd <2 x double> %arg1, %arg2
20        ret <2 x double> %A
21}
22
23define double @fsub(double %arg1, double %arg2) {
24        %A = fsub double %arg1,  %arg2
25        ret double %A
26}
27
28define <2 x double> @fsub_vec(<2 x double> %arg1, <2 x double> %arg2) {
29        %A = fsub <2 x double> %arg1,  %arg2
30        ret <2 x double> %A
31}
32
33define double @fmul(double %arg1, double %arg2) {
34        %A = fmul double %arg1,  %arg2
35        ret double %A
36}
37
38define <2 x double> @fmul_vec(<2 x double> %arg1, <2 x double> %arg2) {
39        %A = fmul <2 x double> %arg1,  %arg2
40        ret <2 x double> %A
41}
42
43define double @fma(double %arg1, double %arg2, double %arg3) {
44        %A = fmul double %arg1,  %arg2
45        %B = fadd double %A, %arg3
46        ret double %B
47}
48
49define <2 x double> @fma_vec(<2 x double> %arg1, <2 x double> %arg2, <2 x double> %arg3) {
50        %A = fmul <2 x double> %arg1,  %arg2
51        %B = fadd <2 x double> %A, %arg3
52        ret <2 x double> %B
53}
54
55define double @fms(double %arg1, double %arg2, double %arg3) {
56        %A = fmul double %arg1,  %arg2
57        %B = fsub double %A, %arg3
58        ret double %B
59}
60
61define <2 x double> @fms_vec(<2 x double> %arg1, <2 x double> %arg2, <2 x double> %arg3) {
62        %A = fmul <2 x double> %arg1,  %arg2
63        %B = fsub <2 x double> %A, %arg3
64        ret <2 x double> %B
65}
66
67; - (a * b - c)
68define double @d_fnms_1(double %arg1, double %arg2, double %arg3) {
69        %A = fmul double %arg1,  %arg2
70        %B = fsub double %A, %arg3
71        %C = fsub double -0.000000e+00, %B               ; <double> [#uses=1]
72        ret double %C
73}
74
75; Annother way of getting fnms
76; - ( a * b ) + c => c - (a * b)
77define double @d_fnms_2(double %arg1, double %arg2, double %arg3) {
78        %A = fmul double %arg1,  %arg2
79        %B = fsub double %arg3, %A
80        ret double %B
81}
82
83; FNMS: - (a * b - c) => c - (a * b)
84define <2 x double> @d_fnms_vec_1(<2 x double> %arg1, <2 x double> %arg2, <2 x double> %arg3) {
85        %A = fmul <2 x double> %arg1,  %arg2
86        %B = fsub <2 x double> %arg3, %A
87        ret <2 x double> %B
88}
89
90; Another way to get fnms using a constant vector
91; - ( a * b - c)
92define <2 x double> @d_fnms_vec_2(<2 x double> %arg1, <2 x double> %arg2, <2 x double> %arg3) {
93        %A = fmul <2 x double> %arg1,  %arg2     ; <<2 x double>> [#uses=1]
94        %B = fsub <2 x double> %A, %arg3 ; <<2 x double>> [#uses=1]
95        %C = fsub <2 x double> < double -0.00000e+00, double -0.00000e+00 >, %B
96        ret <2 x double> %C
97}
98
99;define double @fdiv_1(double %arg1, double %arg2) {
100;       %A = fdiv double %arg1,  %arg2  ; <double> [#uses=1]
101;       ret double %A
102;}
103