From 79bf34419f2b1ad8bb6fab4b42c1bd044821b245 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Tue, 13 May 2008 18:18:23 +0000 Subject: Add packed unsigned saturated subtraction routines git-svn-id: svn://mattst88.com/svn/alpha_mmintrin/trunk@4 f7d56953-e76f-4e43-a77e-20d50f6c004e --- alpha_mmintrin.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/alpha_mmintrin.h b/alpha_mmintrin.h index 34a2b63..525f04d 100644 --- a/alpha_mmintrin.h +++ b/alpha_mmintrin.h @@ -70,6 +70,20 @@ __addusw4(uint64_t m1, uint64_t m2) { return m1 + __minuw4(m2, ~m1); } +/* Subtract the 8-bit values in M1 to the 8-bit values in M2 using unsigned + * saturated arithmetic (psubusb) */ +static __inline uint64_t +__subusb8(uint64_t m1, uint64_t m2) { + return m1 - __minub8(m2, m1); +} + +/* Subtract the 16-bit values in M1 to the 16-bit values in M2 using unsigned + * saturating arithmetic (psubusw) */ +static __inline uint64_t +__subusw4(uint64_t m1, uint64_t m2) { + return m1 - __minuw4(m2, m1); +} + /* Multiply four 16-bit values in M1 by four 16-bit values in M2 and produce the low 16 bits of the results (pmullw). */ static __inline uint64_t -- cgit v1.2.3