1 ; RUN: llvm-as -o - %s | llc -march=cellspu > %t1.s
2 ; RUN: grep fa %t1.s | count 2 &&
3 ; RUN: grep fs %t1.s | count 2 &&
4 ; RUN: grep fm %t1.s | count 6 &&
5 ; RUN: grep fma %t1.s | count 2 &&
6 ; RUN: grep fms %t1.s | count 2 &&
7 ; RUN: grep fnms %t1.s | count 3
9 ; This file includes standard floating point arithmetic instructions
10 ; NOTE fdiv is tested separately since it is a compound operation
12 define float @fp_add(float %arg1, float %arg2) {
13 %A = add float %arg1, %arg2 ; <float> [#uses=1]
17 define <4 x float> @fp_add_vec(<4 x float> %arg1, <4 x float> %arg2) {
18 %A = add <4 x float> %arg1, %arg2 ; <<4 x float>> [#uses=1]
22 define float @fp_sub(float %arg1, float %arg2) {
23 %A = sub float %arg1, %arg2 ; <float> [#uses=1]
27 define <4 x float> @fp_sub_vec(<4 x float> %arg1, <4 x float> %arg2) {
28 %A = sub <4 x float> %arg1, %arg2 ; <<4 x float>> [#uses=1]
32 define float @fp_mul(float %arg1, float %arg2) {
33 %A = mul float %arg1, %arg2 ; <float> [#uses=1]
37 define <4 x float> @fp_mul_vec(<4 x float> %arg1, <4 x float> %arg2) {
38 %A = mul <4 x float> %arg1, %arg2 ; <<4 x float>> [#uses=1]
42 define float @fp_mul_add(float %arg1, float %arg2, float %arg3) {
43 %A = mul float %arg1, %arg2 ; <float> [#uses=1]
44 %B = add float %A, %arg3 ; <float> [#uses=1]
48 define <4 x float> @fp_mul_add_vec(<4 x float> %arg1, <4 x float> %arg2, <4 x float> %arg3) {
49 %A = mul <4 x float> %arg1, %arg2 ; <<4 x float>> [#uses=1]
50 %B = add <4 x float> %A, %arg3 ; <<4 x float>> [#uses=1]
54 define float @fp_mul_sub(float %arg1, float %arg2, float %arg3) {
55 %A = mul float %arg1, %arg2 ; <float> [#uses=1]
56 %B = sub float %A, %arg3 ; <float> [#uses=1]
60 define <4 x float> @fp_mul_sub_vec(<4 x float> %arg1, <4 x float> %arg2, <4 x float> %arg3) {
61 %A = mul <4 x float> %arg1, %arg2 ; <<4 x float>> [#uses=1]
62 %B = sub <4 x float> %A, %arg3 ; <<4 x float>> [#uses=1]
66 ; Test the straightforward way of getting fnms
68 define float @fp_neg_mul_sub_1(float %arg1, float %arg2, float %arg3) {
69 %A = mul float %arg1, %arg2
70 %B = sub float %arg3, %A
74 ; Test another way of getting fnms
75 ; - ( a *b -c ) = c - a * b
76 define float @fp_neg_mul_sub_2(float %arg1, float %arg2, float %arg3) {
77 %A = mul float %arg1, %arg2
78 %B = sub float %A, %arg3
79 %C = sub float -0.0, %B
83 define <4 x float> @fp_neg_mul_sub_vec(<4 x float> %arg1, <4 x float> %arg2, <4 x float> %arg3) {
84 %A = mul <4 x float> %arg1, %arg2
85 %B = sub <4 x float> %A, %arg3
86 %D = sub <4 x float> < float -0.0, float -0.0, float -0.0, float -0.0 >, %B