1
2
3
4
5
6
7
8
9
10
11#ifndef _XTENSA_ASMMACRO_H
12#define _XTENSA_ASMMACRO_H
13
14#include <variant/core.h>
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49 .macro __loopi ar, at, size, incr
50
51#if XCHAL_HAVE_LOOPS
52 movi \at, ((\size + \incr - 1) / (\incr))
53 loop \at, 99f
54#else
55 addi \at, \ar, \size
56 98:
57#endif
58
59 .endm
60
61
62
63
64
65 .macro __loops ar, as, at, incr_log2, mask_log2, cond, ncond
66
67#if XCHAL_HAVE_LOOPS
68 .ifgt \incr_log2 - 1
69 addi \at, \as, (1 << \incr_log2) - 1
70 .ifnc \mask_log2,
71 extui \at, \at, \incr_log2, \mask_log2
72 .else
73 srli \at, \at, \incr_log2
74 .endif
75 .endif
76 loop\cond \at, 99f
77#else
78 .ifnc \mask_log2,
79 extui \at, \as, \incr_log2, \mask_log2
80 .else
81 .ifnc \ncond,
82 srli \at, \as, \incr_log2
83 .endif
84 .endif
85 .ifnc \ncond,
86 b\ncond \at, 99f
87
88 .endif
89 .ifnc \mask_log2,
90 slli \at, \at, \incr_log2
91 add \at, \ar, \at
92 .else
93 add \at, \ar, \as
94 .endif
95#endif
96 98:
97
98 .endm
99
100
101
102
103
104 .macro __loopt ar, as, at, incr_log2
105
106#if XCHAL_HAVE_LOOPS
107 sub \at, \as, \ar
108 .ifgt \incr_log2 - 1
109 addi \at, \at, (1 << \incr_log2) - 1
110 srli \at, \at, \incr_log2
111 .endif
112 loop \at, 99f
113#else
114 98:
115#endif
116
117 .endm
118
119
120
121
122
123 .macro __loop as
124
125#if XCHAL_HAVE_LOOPS
126 loop \as, 99f
127#else
128 98:
129#endif
130
131 .endm
132
133
134
135
136
137 .macro __endl ar, as
138#if !XCHAL_HAVE_LOOPS
139 bltu \ar, \as, 98b
140#endif
141 99:
142 .endm
143
144
145
146
147
148 .macro __endla ar, as, incr
149 addi \ar, \ar, \incr
150 __endl \ar \as
151 .endm
152
153
154#endif
155