Debian Codegraph @

third-party/simde/mips/msa/st.h

raw
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 Evan Nemerson <[email protected]>
25 */
26
27 #if !defined(SIMDE_MIPS_MSA_ST_H)
28 #define SIMDE_MIPS_MSA_ST_H
29
30 #include "types.h"
31
32 HEDLEY_DIAGNOSTIC_PUSH
33 SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
34 SIMDE_BEGIN_DECLS_
35
36 SIMDE_FUNCTION_ATTRIBUTES
37 void
38 simde_msa_st_b(simde_v16i8 a, void * rs, const int s10)
39 SIMDE_REQUIRE_CONSTANT_RANGE(s10, 0, 1023) {
40 #if defined(SIMDE_MIPS_MSA_NATIVE)
41 return __msa_st_b(a, rs, s10);
42 #else
43 simde_memcpy(&(HEDLEY_REINTERPRET_CAST(int8_t*, rs)[s10]), &a, sizeof(a));
44 #endif
45 }
46 #if defined(SIMDE_MIPS_MSA_ENABLE_NATIVE_ALIASES)
47 #undef __msa_st_b
48 #define __msa_st_b(a, rs, s10) simde_msa_st_b((a), (rs), (s10))
49 #endif
50
51 SIMDE_FUNCTION_ATTRIBUTES
52 void
53 simde_msa_st_h(simde_v8i16 a, void * rs, const int s10)
54 SIMDE_REQUIRE_CONSTANT_RANGE(s10, 0, 1023)
55 HEDLEY_REQUIRE_MSG((s10 % sizeof(int16_t)) == 0, "`s10' must be a multiple of sizeof(int16_t)") {
56 #if defined(SIMDE_MIPS_MSA_NATIVE)
57 return __msa_st_h(a, rs, s10);
58 #else
59 simde_memcpy(&(HEDLEY_REINTERPRET_CAST(int8_t*, rs)[s10]), &a, sizeof(a));
60 #endif
61 }
62 #if defined(SIMDE_MIPS_MSA_ENABLE_NATIVE_ALIASES)
63 #undef __msa_st_h
64 #define __msa_st_h(a, rs, s10) simde_msa_st_h((a), (rs), (s10))
65 #endif
66
67 SIMDE_FUNCTION_ATTRIBUTES
68 void
69 simde_msa_st_w(simde_v4i32 a, void * rs, const int s10)
70 SIMDE_REQUIRE_CONSTANT_RANGE(s10, 0, 1023)
71 HEDLEY_REQUIRE_MSG((s10 % sizeof(int32_t)) == 0, "`s10' must be a multiple of sizeof(int32_t)") {
72 #if defined(SIMDE_MIPS_MSA_NATIVE)
73 return __msa_st_w(a, rs, s10);
74 #else
75 simde_memcpy(&(HEDLEY_REINTERPRET_CAST(int8_t*, rs)[s10]), &a, sizeof(a));
76 #endif
77 }
78 #if defined(SIMDE_MIPS_MSA_ENABLE_NATIVE_ALIASES)
79 #undef __msa_st_w
80 #define __msa_st_w(a, rs, s10) simde_msa_st_w((a), (rs), (s10))
81 #endif
82
83 SIMDE_FUNCTION_ATTRIBUTES
84 void
85 simde_msa_st_d(simde_v2i64 a, void * rs, const int s10)
86 SIMDE_REQUIRE_CONSTANT_RANGE(s10, 0, 1023)
87 HEDLEY_REQUIRE_MSG((s10 % sizeof(int64_t)) == 0, "`s10' must be a multiple of sizeof(int64_t)") {
88 #if defined(SIMDE_MIPS_MSA_NATIVE)
89 return __msa_st_d(a, rs, s10);
90 #else
91 simde_memcpy(&(HEDLEY_REINTERPRET_CAST(int8_t*, rs)[s10]), &a, sizeof(a));
92 #endif
93 }
94 #if defined(SIMDE_MIPS_MSA_ENABLE_NATIVE_ALIASES)
95 #undef __msa_st_d
96 #define __msa_st_d(a, rs, s10) simde_msa_st_d((a), (rs), (s10))
97 #endif
98
99 SIMDE_END_DECLS_
100 HEDLEY_DIAGNOSTIC_POP
101
102 #endif /* !defined(SIMDE_MIPS_MSA_ST_H) */