|
TBCI Numerical high perf. C++ Library
2.8.0
|
Preprocessor macros for estimating the "cost" of operations. More...

Go to the source code of this file.
Macros | |
| #define | COST_UNIT_LOAD 2 |
| There are several basic operations which are assigned a relative cost: (a good choice is to use twice the no. More... | |
| #define | COST_UNIT_STORE COST_UNIT_LOAD |
| #define | COST_NU_LOAD 6 |
| #define | COST_NU_STORE (COST_NU_LOAD-2) |
| #define | COST_MEMSET (COST_UNIT_STORE/2) |
| #define | COST_MEMCPY ((COST_UNIT_LOAD+COST_UNIT_STORE)/2) |
| #define | COST_ADD 2 |
| #define | COST_SUB COST_ADD |
| #define | COST_MULT 4 |
| #define | COST_DIV (COST_MULT+2) |
| #define | COST_CALL 4 |
| #define | COST_LOOP 2 |
| #define | COST_BRANCH 6 |
| #define | COST_SCHEDULE 10000 |
Preprocessor macros for estimating the "cost" of operations.
Definition in file cost.h.
| #define COST_MEMCPY ((COST_UNIT_LOAD+COST_UNIT_STORE)/2) |
| #define COST_MEMSET (COST_UNIT_STORE/2) |
| #define COST_NU_STORE (COST_NU_LOAD-2) |
| #define COST_UNIT_LOAD 2 |
There are several basic operations which are assigned a relative cost: (a good choice is to use twice the no.
of avg. CPU cycles)
COST_UNIT_LOAD: Cost of a load op in a unit stride COST_UNIT_STORE: Cost of a store op in a unit stride COST_NU_LOAD: Cost of a load op in a non-unit stride COST_NU_STORE: Cost of a store op in a non-unit stride COST_MEMSET: Cost of a memset per element COST_MEMCPY: Cost of a memcpy per element COST_ADD: Cost of an addition op COST_SUB: Cost of a subtraction op COST_MULT: Cost of a multiplication op COST_DIV: Cost of a division op COST_CALL: Cost of a (non-inlined) library call (incl. return) COST_LOOP: Cost of a loop or easily predictable branch COST_BRANCH: Cost of a hard to predict branch COST_SCHEDULE: Cost of signalling another thread and have it scheduled by the OS
Estimating the cost of certain operation can be useful to have the compiler decide which function to pick, if there are several alternatives.
| #define COST_UNIT_STORE COST_UNIT_LOAD |
1.8.5