From 20834dcc57537cd95260a4a22f5d91a027adfd35 Mon Sep 17 00:00:00 2001 From: Carlos Maiolino Date: Thu, 10 Jul 2025 22:20:01 +0200 Subject: Add x86_64 asm Signed-off-by: Carlos Maiolino --- x86_64/arithmetic.s | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 x86_64/arithmetic.s (limited to 'x86_64/arithmetic.s') diff --git a/x86_64/arithmetic.s b/x86_64/arithmetic.s new file mode 100644 index 0000000..34216f1 --- /dev/null +++ b/x86_64/arithmetic.s @@ -0,0 +1,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 -- cgit v1.2.3