summaryrefslogtreecommitdiff
path: root/x86_64/arithmetic.s
blob: 34216f189b207ac6c73e9ff387ed0229725df297 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Simple program exercising CPU's arithmetic instructions

.globl _start

.section .text

_start:
	movq $3, %rdi
	movq %rdi, %rax
	mulq %rdi
	movq $2, %rdi
	addq %rdi, %rax
	movq $4, %rdi
	mulq %rdi

	movq $10, %rax
	movq $3, %rdi
	divq %rdi	 # Remainder goes to %rdx
	movq %rax, %rdi

	mov $60, %rax
	syscall