summaryrefslogtreecommitdiffstats
path: root/libgsmhr/asm.s
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2015-12-27 19:18:14 +0100
committerHarald Welte <laforge@gnumonks.org>2015-12-27 19:18:14 +0100
commit1ea1d362fd3f239840170d1746f735e5e5ad1fdb (patch)
treeb15604c3e633d1d1f49b9f9d328e684a376592f2 /libgsmhr/asm.s
parent7a04624563ac72b7237e39d6fcee5dab96f4d948 (diff)
WIP on adding MMX support for some of the HR codec primitives
Diffstat (limited to 'libgsmhr/asm.s')
-rw-r--r--libgsmhr/asm.s49
1 files changed, 49 insertions, 0 deletions
diff --git a/libgsmhr/asm.s b/libgsmhr/asm.s
new file mode 100644
index 0000000..d1d491e
--- /dev/null
+++ b/libgsmhr/asm.s
@@ -0,0 +1,49 @@
+
+.globl sat_adds32b
+.type sat_adds32b,@function
+sat_adds32b:
+ mov %edi, %eax
+ shr $0x1f, %edi
+ add $0x7fffffff, %edi
+ add %esi, %eax
+ cmovo %edi, %eax
+ retq
+.size sat_adds32b, .-sat_adds32b
+
+.globl sat_subs32b
+.type sat_subs32b,@function
+sat_subs32b:
+ mov %edi, %eax
+ shr $0x1f, %edi
+ add $0x7fffffff, %edi
+ sub %esi, %eax
+ cmovo %edi, %eax
+ retq
+.size sat_subs32b, .-sat_subs32b
+
+.globl sat_divs32b
+.type sat_divs32b,@function
+sat_divs32b:
+ mov %edi, %eax
+ lea 0x1(%rsi), %edx
+ add $0x80000000, %edi
+ or %edx, %edi
+ cdq
+ neg %edi
+ sbb $-1, %eax
+ idiv %esi
+ retq
+.size sat_divs32b, .-sat_divs32b
+
+.globl sat_muls32b
+.type sat_muls32b,@function
+sat_muls32b:
+ mov %edi, %eax
+ xor %esi, %edi
+ shr $0x1f, %edi
+ add $0x7fffffff, %edi
+ imul %esi
+ cmovc %edi, %eax
+ retq
+.size sat_muls32b, .-sat_muls32b
+