1 /* SPDX-License-Identifier: MIT
2  *
3  * Permission is hereby granted, free of charge, to any person
4  * obtaining a copy of this software and associated documentation
5  * files (the "Software"), to deal in the Software without
6  * restriction, including without limitation the rights to use, copy,
7  * modify, merge, publish, distribute, sublicense, and/or sell copies
8  * of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be
12  * included in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
18  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21  * SOFTWARE.
22  *
23  * Copyright:
24  *   2021      Atharva Nimbalkar <atharvakn@gmail.com>
25  */
26 
27 #if !defined(SIMDE_ARM_NEON_XAR_H)
28 #define SIMDE_ARM_NEON_XAR_H
29 
30 #include "types.h"
31 #include "eor.h"
32 
33 HEDLEY_DIAGNOSTIC_PUSH
34 SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
35 SIMDE_BEGIN_DECLS_
36 
37 SIMDE_FUNCTION_ATTRIBUTES
38 simde_uint64x2_t
simde_vxarq_u64(simde_uint64x2_t a,simde_uint64x2_t b,const int d)39 simde_vxarq_u64(simde_uint64x2_t a, simde_uint64x2_t b, const int d)
40     SIMDE_REQUIRE_CONSTANT_RANGE(d, 0, 63) {
41   simde_uint64x2_private
42     r_,
43     t = simde_uint64x2_to_private(simde_veorq_u64(a,b));
44 
45   SIMDE_VECTORIZE
46   for (size_t i=0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
47     r_.values[i] = ((t.values[i] >> d) | (t.values[i] << (64 - d)));
48   }
49 
50   return simde_uint64x2_from_private(r_);
51 }
52 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(__ARM_FEATURE_SHA3)
53   #define simde_vxarq_u64(a, b, d) vxarq_u64((a), (b), (d))
54 #endif
55 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES) || (defined(SIMDE_ENABLE_NATIVE_ALIASES) && !defined(__ARM_FEATURE_SHA3))
56   #undef vxarq_u64
57   #define vxarq_u64(a, b, d) simde_vxarq_u64((a), (b), (d))
58 #endif
59 
60 SIMDE_END_DECLS_
61 HEDLEY_DIAGNOSTIC_POP
62 
63 #endif /* !defined(SIMDE_ARM_NEON_XAR_H) */
64