mirror of
https://github.com/pkivolowitz/asm_book.git
synced 2026-06-22 18:16:47 +08:00
correct min and max based on nudge from u\TNorthover
This commit is contained in:
parent
26d3d18f88
commit
f09521fd6d
1 changed files with 22 additions and 4 deletions
|
|
@ -119,10 +119,28 @@ main:
|
||||||
ldr \a, [sp], 16
|
ldr \a, [sp], 16
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
.macro MIN src_a, src_b, dest
|
/* The smaller of src_a and src_b is put into dest. A cmp instruction
|
||||||
csel \dest, \src_a, \src_b, GT
|
or other instruction that sets the flags must be performed first.
|
||||||
.endm
|
This macro makes it easy to remember which register does what in the
|
||||||
|
csel.
|
||||||
|
|
||||||
.macro MAX src_a, src_b, dest
|
Thank you to u/TNorthover for nudge to add the cmp.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.macro MIN src_a, src_b, dest
|
||||||
|
cmp \src_a, \src_b
|
||||||
csel \dest, \src_a, \src_b, LT
|
csel \dest, \src_a, \src_b, LT
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
/* The larger of src_a and src_b is put into dest. A cmp instruction
|
||||||
|
or other instruction that sets the flags must be performed first.
|
||||||
|
This macro makes it easy to remember which register does what in the
|
||||||
|
csel.
|
||||||
|
|
||||||
|
Thank you to u/TNorthover for nudge to add the cmp.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.macro MAX src_a, src_b, dest
|
||||||
|
cmp \src_a, \src_b
|
||||||
|
csel \dest, \src_a, \src_b, GT
|
||||||
|
.endm
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue