blob: 2579a404eea500823c34f7dd13270061bb720353 [file] [log] [blame]
Scott Michel0a92af42007-12-19 20:50:49 +00001; RUN: llvm-as -o - %s | llc -march=cellspu > %t1.s
Chris Lattner994d6cf2008-01-18 19:53:43 +00002; 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
Scott Michel0a92af42007-12-19 20:50:49 +00007; RUN: grep dfnms %t1.s | count 4
8;
9; This file includes double precision floating point arithmetic instructions
Scott Michel9de5d0d2008-01-11 02:53:15 +000010target 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"
Scott Michel0a92af42007-12-19 20:50:49 +000012
13define double @fadd(double %arg1, double %arg2) {
Scott Michel53dec472008-03-05 23:00:19 +000014 %A = add double %arg1, %arg2
15 ret double %A
Scott Michel0a92af42007-12-19 20:50:49 +000016}
17
18define <2 x double> @fadd_vec(<2 x double> %arg1, <2 x double> %arg2) {
Scott Michel53dec472008-03-05 23:00:19 +000019 %A = add <2 x double> %arg1, %arg2
20 ret <2 x double> %A
Scott Michel0a92af42007-12-19 20:50:49 +000021}
22
23define double @fsub(double %arg1, double %arg2) {
Scott Michel53dec472008-03-05 23:00:19 +000024 %A = sub double %arg1, %arg2
25 ret double %A
Scott Michel0a92af42007-12-19 20:50:49 +000026}
27
28define <2 x double> @fsub_vec(<2 x double> %arg1, <2 x double> %arg2) {
Scott Michel53dec472008-03-05 23:00:19 +000029 %A = sub <2 x double> %arg1, %arg2
30 ret <2 x double> %A
Scott Michel0a92af42007-12-19 20:50:49 +000031}
32
33define double @fmul(double %arg1, double %arg2) {
Scott Michel53dec472008-03-05 23:00:19 +000034 %A = mul double %arg1, %arg2
35 ret double %A
Scott Michel0a92af42007-12-19 20:50:49 +000036}
37
38define <2 x double> @fmul_vec(<2 x double> %arg1, <2 x double> %arg2) {
Scott Michel53dec472008-03-05 23:00:19 +000039 %A = mul <2 x double> %arg1, %arg2
40 ret <2 x double> %A
Scott Michel0a92af42007-12-19 20:50:49 +000041}
42
43define double @fma(double %arg1, double %arg2, double %arg3) {
Scott Michel53dec472008-03-05 23:00:19 +000044 %A = mul double %arg1, %arg2
45 %B = add double %A, %arg3
46 ret double %B
Scott Michel0a92af42007-12-19 20:50:49 +000047}
48
49define <2 x double> @fma_vec(<2 x double> %arg1, <2 x double> %arg2, <2 x double> %arg3) {
Scott Michel53dec472008-03-05 23:00:19 +000050 %A = mul <2 x double> %arg1, %arg2
51 %B = add <2 x double> %A, %arg3
52 ret <2 x double> %B
Scott Michel0a92af42007-12-19 20:50:49 +000053}
54
55define double @fms(double %arg1, double %arg2, double %arg3) {
Scott Michel53dec472008-03-05 23:00:19 +000056 %A = mul double %arg1, %arg2
57 %B = sub double %A, %arg3
58 ret double %B
Scott Michel0a92af42007-12-19 20:50:49 +000059}
60
61define <2 x double> @fms_vec(<2 x double> %arg1, <2 x double> %arg2, <2 x double> %arg3) {
Scott Michel53dec472008-03-05 23:00:19 +000062 %A = mul <2 x double> %arg1, %arg2
63 %B = sub <2 x double> %A, %arg3
64 ret <2 x double> %B
Scott Michel0a92af42007-12-19 20:50:49 +000065}
66
67; - (a * b - c)
68define double @d_fnms_1(double %arg1, double %arg2, double %arg3) {
Scott Michel53dec472008-03-05 23:00:19 +000069 %A = mul double %arg1, %arg2
70 %B = sub double %A, %arg3
71 %C = sub double -0.000000e+00, %B ; <double> [#uses=1]
72 ret double %C
Scott Michel0a92af42007-12-19 20:50:49 +000073}
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) {
Scott Michel53dec472008-03-05 23:00:19 +000078 %A = mul double %arg1, %arg2
79 %B = sub double %arg3, %A
80 ret double %B
Scott Michel0a92af42007-12-19 20:50:49 +000081}
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) {
Scott Michel53dec472008-03-05 23:00:19 +000085 %A = mul <2 x double> %arg1, %arg2
86 %B = sub <2 x double> %arg3, %A ;
87 ret <2 x double> %B
Scott Michel0a92af42007-12-19 20:50:49 +000088}
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) {
Scott Michel53dec472008-03-05 23:00:19 +000093 %A = mul <2 x double> %arg1, %arg2 ; <<2 x double>> [#uses=1]
94 %B = sub <2 x double> %A, %arg3 ; <<2 x double>> [#uses=1]
95 %C = sub <2 x double> < double -0.00000e+00, double -0.00000e+00 >, %B
96 ret <2 x double> %C
Scott Michel0a92af42007-12-19 20:50:49 +000097}
98
99;define double @fdiv_1(double %arg1, double %arg2) {
Scott Michel53dec472008-03-05 23:00:19 +0000100; %A = fdiv double %arg1, %arg2 ; <double> [#uses=1]
101; ret double %A
Scott Michel0a92af42007-12-19 20:50:49 +0000102;}