1 #include "BasicMathsBenchmarksF32.h"
2 #include "Error.h"
3 
4 
vec_mult_f32()5     void BasicMathsBenchmarksF32::vec_mult_f32()
6     {
7        arm_mult_f32(this->inp1,this->inp2,this->outp,this->nb);
8     }
9 
vec_add_f32()10     void BasicMathsBenchmarksF32::vec_add_f32()
11     {
12        arm_add_f32(inp1,inp2,outp,this->nb);
13     }
14 
vec_sub_f32()15     void BasicMathsBenchmarksF32::vec_sub_f32()
16     {
17        arm_sub_f32(inp1,inp2,outp,this->nb);
18     }
19 
vec_abs_f32()20     void BasicMathsBenchmarksF32::vec_abs_f32()
21     {
22        arm_abs_f32(inp1,outp,this->nb);
23     }
24 
vec_negate_f32()25     void BasicMathsBenchmarksF32::vec_negate_f32()
26     {
27        arm_negate_f32(inp1,outp,this->nb);
28     }
29 
vec_offset_f32()30     void BasicMathsBenchmarksF32::vec_offset_f32()
31     {
32        arm_offset_f32(inp1,1.0,outp,this->nb);
33     }
34 
vec_scale_f32()35     void BasicMathsBenchmarksF32::vec_scale_f32()
36     {
37        arm_scale_f32(inp1,1.0,outp,this->nb);
38     }
39 
vec_dot_f32()40     void BasicMathsBenchmarksF32::vec_dot_f32()
41     {
42        float32_t result;
43 
44        arm_dot_prod_f32(inp1,inp2,this->nb,&result);
45 
46     }
47 
48 
setUp(Testing::testID_t id,std::vector<Testing::param_t> & params,Client::PatternMgr * mgr)49     void BasicMathsBenchmarksF32::setUp(Testing::testID_t id,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr)
50     {
51 
52        this->setForceInCache(true);
53        std::vector<Testing::param_t>::iterator it = params.begin();
54        this->nb = *it;
55 
56        input1.reload(BasicMathsBenchmarksF32::INPUT1_F32_ID,mgr,this->nb);
57        input2.reload(BasicMathsBenchmarksF32::INPUT2_F32_ID,mgr,this->nb);
58 
59 
60        output.create(this->nb,BasicMathsBenchmarksF32::OUT_SAMPLES_F32_ID,mgr);
61 
62        switch(id)
63        {
64          case BasicMathsBenchmarksF32::VEC_MULT_F32_1:
65          case BasicMathsBenchmarksF32::VEC_ADD_F32_2:
66          case BasicMathsBenchmarksF32::VEC_SUB_F32_3:
67          case BasicMathsBenchmarksF32::VEC_ABS_F32_4:
68          case BasicMathsBenchmarksF32::VEC_OFFSET_F32_6:
69          case BasicMathsBenchmarksF32::VEC_SCALE_F32_7:
70 
71            /* This an overhead doing this because ptr() function is doing lot of checks
72             to ensure patterns are fresh.
73             So for small benchmark lengths it is better doing it in the setUp function
74            */
75            this->inp1=input1.ptr();
76            this->inp2=input2.ptr();
77            this->outp=output.ptr();
78 
79          break;
80 
81          case BasicMathsBenchmarksF32::VEC_NEGATE_F32_5:
82            this->inp1=input1.ptr();
83            this->outp=output.ptr();
84          break;
85 
86          case BasicMathsBenchmarksF32::VEC_DOT_F32_8:
87            this->inp1=input1.ptr();
88            this->inp2=input2.ptr();
89          break;
90        }
91 
92     }
93 
tearDown(Testing::testID_t id,Client::PatternMgr * mgr)94     void BasicMathsBenchmarksF32::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
95     {
96     }
97