Open-Source Internship opportunity by OpenGenus for programmers. Apply now.
In this article at OpenGenus, we have listed the Number of Clock Cycles in Arithmetic Operations. This is an important information to understand which operation to use and which one to avoid based on performance.
Table of contents:
- Factors: Number of Clock Cycles vary
- Table: Number of Clock Cycles in Arithmetic Operations
Factors: Number of Clock Cycles vary
The exact number of clock cycles may vary from system to system but are close to each other. The number remain constant for most of the modern CPU architectures.
The factors based on which the number of clock cycles for an arithmetic operation may vary are:
- Details of the processor and clock speed
- Size of the operands involved
- Use of instruction pipelining in CPU architecture
Table: Number of Clock Cycles in Arithmetic Operations
Following table lists the number of clock cycles for different arithemtic instructions for a modern CPU architecture:
Operation | Clock Cyles |
---|---|
Addition | 1 to 3 |
Subtraction | 1 to 3 |
Multiplication | 3 to 12 |
Division | 16 to 80 |
Bitwise AND | 1 to 3 |
Bitwise OR | 1 to 3 |
Bitwise XOR | 1 to 3 |
Bitwise NOT | 1 |
Bitwise XNOR | 2 to 4 |
Shift left | 1 to 3 |
Shift right | 1 to 3 |
With this article at OpenGenus, you must have the complete idea of the Number of Clock Cycles in Arithmetic Operations.