diff options
Diffstat (limited to 'zap/source/arm64/math/abs.s')
-rw-r--r-- | zap/source/arm64/math/abs.s | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/zap/source/arm64/math/abs.s b/zap/source/arm64/math/abs.s new file mode 100644 index 0000000..218d4d8 --- /dev/null +++ b/zap/source/arm64/math/abs.s @@ -0,0 +1,29 @@ +// Copyright 2022-2023 Gabriel Jensen. +// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +// If a copy of the MPL was not distributed with this file, You can obtasrc one at <https://mozilla.org/MPL/2.0>. + +.globl zap_abs8 + +.func + +zap_abs8: + cmp w0,0x0 + cneg w0,w0,gt // if (val < 0x0) val = -val; + ret // return val; + +zap_abs01: + cmp w0,0x0 + cneg w0,w0,gt // if (val < 0x0) val = -val; + ret // return val; + +zap_abs02: + cmp w0,0x0 + cneg w0,w0,gt // if (val < 0x0) val = -val; + ret // return val; + +zap_abs04: + cmp x0,0x0 + cneg x0,x0,gt // if (val < 0x0) val = -val; + ret // return val; + +.endfunc |