Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Faster arithmetic operations

vindos
Beginner
287 Views
hi
i am making an application that includes lotz of shift and other logical operations.These operations are performed on integers and shorts.
Which Library should i be using to make these oeprations faster.I guess MKL deals with only vector arithmetics.plz give tips on where to start.
bbye
0 Kudos
1 Reply
TimP
Honored Contributor III
287 Views
Scalar shifts and the like are compiled in line by your compiler. A library function call would take longer than any reasonable compiler generated code. The main thing to watch is that you specify the architecture you want to optimize; for example, if you specify 'gcc -march=pentium4', the compiler will know about the P4 preference for a sequence of adds over a left shift or multiply.
Another thing to watch is that you don't force unnecessary conversions between short int and int data types, and don't over-use short int.
Only a vector library offers enough advantage for special instructions, to overcome the overhead of function calls.
0 Kudos
Reply