correct min and max based on nudge from u\TNorthover

This commit is contained in:
Perry Kivolowitz 2023-02-17 09:27:32 -06:00
parent 26d3d18f88
commit f09521fd6d

View file

@ -119,10 +119,28 @@ main:
ldr \a, [sp], 16
.endm
.macro MIN src_a, src_b, dest
csel \dest, \src_a, \src_b, GT
.endm
/* The smaller 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
.macro MIN src_a, src_b, dest
cmp \src_a, \src_b
csel \dest, \src_a, \src_b, LT
.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