1 | /* Copyright 2019 Google LLC. All Rights Reserved. |
2 | |
3 | Licensed under the Apache License, Version 2.0 (the "License"); |
4 | you may not use this file except in compliance with the License. |
5 | You may obtain a copy of the License at |
6 | |
7 | http://www.apache.org/licenses/LICENSE-2.0 |
8 | |
9 | Unless required by applicable law or agreed to in writing, software |
10 | distributed under the License is distributed on an "AS IS" BASIS, |
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | See the License for the specific language governing permissions and |
13 | limitations under the License. |
14 | ==============================================================================*/ |
15 | |
16 | // Some helpers to write inline asm. |
17 | |
18 | #ifndef RUY_RUY_ASM_HELPERS_H_ |
19 | #define RUY_RUY_ASM_HELPERS_H_ |
20 | |
21 | #include "ruy/opt_set.h" |
22 | |
23 | // Enclose load-prefetch instructions in RUY_PREFETCH_LOAD() so we can |
24 | // conditionally enable them based on the RUY_OPT_SET. |
25 | #if RUY_OPT(PREFETCH_LOAD) |
26 | #define RUY_PREFETCH_LOAD(X) X |
27 | #else |
28 | #define RUY_PREFETCH_LOAD(X) |
29 | #endif |
30 | |
31 | // Enclose store-prefetch instructions in RUY_PREFETCH_STORE() so we can |
32 | // conditionally enable them based on the RUY_OPT_SET. |
33 | #if RUY_OPT(PREFETCH_STORE) |
34 | #define RUY_PREFETCH_STORE(X) X |
35 | #else |
36 | #define RUY_PREFETCH_STORE(X) |
37 | #endif |
38 | |
39 | // The usual stringification macro. |
40 | #define RUY_STR(s) RUY_STR_UNEXPANDED(s) |
41 | #define RUY_STR_UNEXPANDED(s) #s |
42 | |
43 | #endif // RUY_RUY_ASM_HELPERS_H_ |
44 | |