Computers implement an instruction set architecture that define the set of action the hardware the should be capable of performing. These machine instructions provide the necessary components for programs to be written and executed.
Questions tagged [machine-instruction]
67 questions
193
votes
6 answers
How was the first compiler written?
I heard about the chicken and the egg and bootstrapping. I have a few questions.
What wrote the first compiler that converted something into binary instructions?
Is assembly compiled or translated into binary instructions?
...I'd find it hard to…

Shawn Mclean
- 56,733
- 95
- 279
- 406
90
votes
4 answers
What is the loop inversion technique?
I was going through a document which talks about just-in-time compiler (JIT) optimization techniques for Java. One of them was "loop inversion". And the document says:
You replace a regular while loop with a do-while loop. And the
do-while loop…

Trying
- 14,004
- 9
- 70
- 110
30
votes
2 answers
Is syscall an instruction on x86_64?
I wanted to check the code for performing system calls in glibc. I found something like this:
ENTRY (syscall)
movq %rdi, %rax /* Syscall number -> rax. */
movq %rsi, %rdi /* shift arg1 - arg5. */
movq %rdx, %rsi
movq %rcx,…

pythonic
- 20,589
- 43
- 136
- 219
15
votes
2 answers
What does the ARM7 IT (if then) instruction really do?
I am having trouble wrapping my head around the functionality of the IT instruction (if then). The quick reference card has this:
Operation: If-Then
Assembler: IT{pattern} {cond}
Action: Makes up to four following instructions conditional,…

wallyk
- 56,922
- 16
- 83
- 148
14
votes
3 answers
Why can assembly instructions contain multiplications in the "lea" instruction?
I am working on a very low level part of the application in which performance is critical.
While investigating the generated assembly, I noticed the following instruction:
lea eax,[edx*8+8]
I am used to seeing additions when using memory references…

Patrick
- 23,217
- 12
- 67
- 130
13
votes
3 answers
Is there any performance difference between greater than and greater than or equal?
On today's modern processors, is there any performance difference between greater than and greater than or equal comparison for a branch condition? If I have a condition that could just as easily be either, is there any slight advantage to choosing…

WilliamKF
- 41,123
- 68
- 193
- 295
13
votes
1 answer
Difference between an instruction and a micro-op
What is the difference between a machine instruction and a micro-op? I found a following definition here:
A small, basic instruction, used in series to make up a high-level
machine instruction
Here is what I found on Wikipedia
In computer…

flashburn
- 4,180
- 7
- 54
- 109
12
votes
4 answers
ADC instruction in ASM 8086
When I use ADC for exmaple:
AL = 01 and BL = 02, and CF = 1
when I make this:
ADC AL,BL
Will AL be 3 or 4? (with the CF addition or without?)

Tal
- 303
- 1
- 6
- 11
11
votes
1 answer
What x86 instructions take two (or more) memory operands?
I thought that there was zero. But, I see here,
Instructions with two memory operands are extremely rare
I can't find anything that explains what instructions, though rare, exist. What are the exceptions?

Evan Carroll
- 78,363
- 46
- 261
- 468
11
votes
1 answer
Can C++ have code in the global scope?
Is it legal to have code (which compiles to assembly instructions in the global scope of a C++ source file? Previously, I was under the impression that except for the Ch programming language (an interpreter for C/C++), you cannot have code in the…

Galaxy
- 2,363
- 2
- 25
- 59
11
votes
1 answer
Difference between long and short jump (x86)
I've read that short jumps are to be used when the relative jump is less than 124 in address, and long jumps should be used otherwise.
What is the difference in terms of operations performed in the CPU / performance between the two types of jumps on…

nadavge
- 590
- 1
- 3
- 14
9
votes
3 answers
What does actual machine code look like at various points?
There seems to be many opinions on what machine code actually is. I've heard some say it's assembly, or binary, or hex.
Is it correct to say that machine code is essentially a set of instructions for a particular processor? If so, I imagine these…

Igorio
- 918
- 1
- 7
- 17
8
votes
4 answers
How long does each machine language instruction take to execute?
Do operations like set, read, move and compare all take the same time to execute?
If not: Is there any way to find out how long.
Is there some name for what I mean, some specific type cpu's speed of executing the different assembly language…

xrDDDD
- 583
- 9
- 23
8
votes
4 answers
Processor Instruction Cycle Execution Time
My guess is that the __no_operation() intrinsic (ARM) instruction should take 1/(168 MHz) to execute, provided that each NOP executes in one clock cycle, which I would like to verify via documentation.
Is there a standard location for…

bunkerdive
- 2,031
- 1
- 25
- 28
6
votes
2 answers
Dynamic vs Static instruction count
What is the difference between dynamic and static instruction count?
a. Derive an expression to calculate the user CPU time as a function
of following parameters: the dynamic instruction count (N),
clock cycle per instruction (CPI)…

Assasins
- 1,593
- 5
- 20
- 22