2023-02-12 13:24:51 +08:00
|
|
|
.text
|
2023-02-15 17:50:14 +08:00
|
|
|
.globl maxofthree
|
|
|
|
.globl add3
|
2023-02-12 13:24:51 +08:00
|
|
|
maxofthree:
|
|
|
|
mov %ecx, %eax # result (rax) initially holds x
|
|
|
|
cmp %edx, %eax # is x less than y?
|
|
|
|
cmovl %edx, %eax # if so, set result to y
|
|
|
|
cmp %r8d, %eax # is max(x,y) less than z?
|
|
|
|
cmovl %r8d, %eax # if so, set result to z
|
|
|
|
ret # the max will be in rax
|
|
|
|
add3:
|
|
|
|
mov %ecx, %eax
|
|
|
|
add %edx, %eax
|
|
|
|
add %r8d, %eax
|
|
|
|
ret
|