[SPCA] more assembly

This commit is contained in:
RobinB27
2026-01-10 19:57:50 +01:00
parent 59f4151a3e
commit 35c06e4edf
6 changed files with 37 additions and 2 deletions

View File

@@ -0,0 +1,9 @@
max:
cmpl %esi, %edi // Set condition flags
jle .IF // Conditional jump if %edi <= %esi
movl %edi, %edx // %edi -> return register
jmp .ELSE
.IF:
movl %esi, %edx // &esi -> return register
.ELSE:
ret

View File

@@ -0,0 +1,8 @@
absdiff:
movl %edi, %eax
subl %esi, %eax // arg2 - arg1 -> eax
movl %esi, %edx
subl %edi, %edx // arg1 - arg2 -> edx
cmpl %esi, %edi // Set condition flags
cmovle %edx, %eax // edx -> eax, only if eax <= edx
ret