1a1e14b36ce132786703d3b2bc5aeff639caf915
[openssl.git] / crypto / ec / curve448 / arch_neon / arch_intrinsics.h
1 /* Copyright (c) 2016 Cryptography Research, Inc.
2  * Released under the MIT License.  See LICENSE.txt for license information.
3  */
4
5 #ifndef __ARCH_NEON_ARCH_INTRINSICS_H__
6 #define __ARCH_NEON_ARCH_INTRINSICS_H__
7
8 #define ARCH_WORD_BITS 32
9
10 static __inline__ __attribute((always_inline,unused))
11 uint32_t word_is_zero(uint32_t a) {
12     uint32_t ret;
13     __asm__("subs %0, %1, #1;\n\tsbc %0, %0, %0" : "=r"(ret) : "r"(a) : "cc");
14     return ret;
15 }
16
17 static __inline__ __attribute((always_inline,unused))
18 uint64_t widemul(uint32_t a, uint32_t b) {
19     /* Could be UMULL, but it's hard to express to CC that the registers must be different */
20     return ((uint64_t)a) * b; 
21 }
22
23 #endif /* __ARCH_NEON_ARCH_INTRINSICS_H__ */
24