diff options
author | Scott Michel <scottm@aero.org> | 2007-12-19 20:50:49 +0000 |
---|---|---|
committer | Scott Michel <scottm@aero.org> | 2007-12-19 20:50:49 +0000 |
commit | 0a92af487b8ae5d004a3460e3518a3815d9b36a8 (patch) | |
tree | 8c044831565392edb47310097faaf93a42beaf42 /test/CodeGen/CellSPU/sp_farith.ll | |
parent | 170783a5fc13fff2878d4d347d8bd9096f2ef8d9 (diff) | |
download | external_llvm-0a92af487b8ae5d004a3460e3518a3815d9b36a8.tar.gz external_llvm-0a92af487b8ae5d004a3460e3518a3815d9b36a8.tar.bz2 external_llvm-0a92af487b8ae5d004a3460e3518a3815d9b36a8.zip |
More working CellSPU test cases:
- call.ll: Function call
- ctpop.ll: Count population
- dp_farith.ll: DP arithmetic
- eqv.ll: Equivalence primitives
- fcmp.ll: SP comparisons
- fdiv.ll: SP division
- fneg-fabs.ll: SP negation, aboslute value
- int2fp.ll: Integer -> SP conversion
- rotate_ops.ll: Rotation primitives
- select_bits.ll: (a & c) | (b & ~c) bit selection
- shift_ops.ll: Shift primitives
- sp_farith.ll: SP arithmentic
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45217 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/CellSPU/sp_farith.ll')
-rw-r--r-- | test/CodeGen/CellSPU/sp_farith.ll | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/test/CodeGen/CellSPU/sp_farith.ll b/test/CodeGen/CellSPU/sp_farith.ll new file mode 100644 index 0000000000..c7e719982d --- /dev/null +++ b/test/CodeGen/CellSPU/sp_farith.ll @@ -0,0 +1,88 @@ +; RUN: llvm-as -o - %s | llc -march=cellspu > %t1.s +; RUN: grep fa %t1.s | count 2 && +; RUN: grep fs %t1.s | count 2 && +; RUN: grep fm %t1.s | count 6 && +; RUN: grep fma %t1.s | count 2 && +; RUN: grep fms %t1.s | count 2 && +; RUN: grep fnms %t1.s | count 3 +; +; This file includes standard floating point arithmetic instructions +; NOTE fdiv is tested separately since it is a compound operation + +define float @fp_add(float %arg1, float %arg2) { + %A = add float %arg1, %arg2 ; <float> [#uses=1] + ret float %A +} + +define <4 x float> @fp_add_vec(<4 x float> %arg1, <4 x float> %arg2) { + %A = add <4 x float> %arg1, %arg2 ; <<4 x float>> [#uses=1] + ret <4 x float> %A +} + +define float @fp_sub(float %arg1, float %arg2) { + %A = sub float %arg1, %arg2 ; <float> [#uses=1] + ret float %A +} + +define <4 x float> @fp_sub_vec(<4 x float> %arg1, <4 x float> %arg2) { + %A = sub <4 x float> %arg1, %arg2 ; <<4 x float>> [#uses=1] + ret <4 x float> %A +} + +define float @fp_mul(float %arg1, float %arg2) { + %A = mul float %arg1, %arg2 ; <float> [#uses=1] + ret float %A +} + +define <4 x float> @fp_mul_vec(<4 x float> %arg1, <4 x float> %arg2) { + %A = mul <4 x float> %arg1, %arg2 ; <<4 x float>> [#uses=1] + ret <4 x float> %A +} + +define float @fp_mul_add(float %arg1, float %arg2, float %arg3) { + %A = mul float %arg1, %arg2 ; <float> [#uses=1] + %B = add float %A, %arg3 ; <float> [#uses=1] + ret float %B +} + +define <4 x float> @fp_mul_add_vec(<4 x float> %arg1, <4 x float> %arg2, <4 x float> %arg3) { + %A = mul <4 x float> %arg1, %arg2 ; <<4 x float>> [#uses=1] + %B = add <4 x float> %A, %arg3 ; <<4 x float>> [#uses=1] + ret <4 x float> %B +} + +define float @fp_mul_sub(float %arg1, float %arg2, float %arg3) { + %A = mul float %arg1, %arg2 ; <float> [#uses=1] + %B = sub float %A, %arg3 ; <float> [#uses=1] + ret float %B +} + +define <4 x float> @fp_mul_sub_vec(<4 x float> %arg1, <4 x float> %arg2, <4 x float> %arg3) { + %A = mul <4 x float> %arg1, %arg2 ; <<4 x float>> [#uses=1] + %B = sub <4 x float> %A, %arg3 ; <<4 x float>> [#uses=1] + ret <4 x float> %B +} + +; Test the straightforward way of getting fnms +; c - a * b +define float @fp_neg_mul_sub_1(float %arg1, float %arg2, float %arg3) { + %A = mul float %arg1, %arg2 + %B = sub float %arg3, %A + ret float %B +} + +; Test another way of getting fnms +; - ( a *b -c ) = c - a * b +define float @fp_neg_mul_sub_2(float %arg1, float %arg2, float %arg3) { + %A = mul float %arg1, %arg2 + %B = sub float %A, %arg3 + %C = sub float -0.0, %B + ret float %C +} + +define <4 x float> @fp_neg_mul_sub_vec(<4 x float> %arg1, <4 x float> %arg2, <4 x float> %arg3) { + %A = mul <4 x float> %arg1, %arg2 + %B = sub <4 x float> %A, %arg3 + %D = sub <4 x float> < float -0.0, float -0.0, float -0.0, float -0.0 >, %B + ret <4 x float> %D +} |