~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/hexagon/lib/memset.S

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/hexagon/lib/memset.S (Version linux-6.12-rc7) and /arch/sparc/lib/memset.S (Version linux-2.6.0)


  1 /* SPDX-License-Identifier: GPL-2.0-only */    !!   1 /* linux/arch/sparc/lib/memset.S: Sparc optimized memset, bzero and clear_user code
  2 /*                                             !!   2  * Copyright (C) 1991,1996 Free Software Foundation
  3  * Copyright (c) 2011, The Linux Foundation. A !!   3  * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
                                                   >>   4  * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
                                                   >>   5  *
                                                   >>   6  * Returns 0, if ok, and number of bytes not yet set if exception
                                                   >>   7  * occurs and we were called as clear_user.
  4  */                                                 8  */
  5                                                     9 
                                                   >>  10 #include <asm/cprefix.h>
                                                   >>  11 #include <asm/ptrace.h>
  6                                                    12 
  7 /* HEXAGON assembly optimized memset */        !!  13 /* Work around cpp -rob */
  8 /* Replaces the standard library function mems !!  14 #define ALLOC #alloc
                                                   >>  15 #define EXECINSTR #execinstr
                                                   >>  16 #define EX(x,y,a,b)                             \
                                                   >>  17 98:     x,y;                                    \
                                                   >>  18         .section .fixup,ALLOC,EXECINSTR;        \
                                                   >>  19         .align  4;                              \
                                                   >>  20 99:     ba 30f;                                 \
                                                   >>  21          a, b, %o0;                             \
                                                   >>  22         .section __ex_table,ALLOC;              \
                                                   >>  23         .align  4;                              \
                                                   >>  24         .word   98b, 99b;                       \
                                                   >>  25         .text;                                  \
                                                   >>  26         .align  4
                                                   >>  27 
                                                   >>  28 #define EXT(start,end,handler)                  \
                                                   >>  29         .section __ex_table,ALLOC;              \
                                                   >>  30         .align  4;                              \
                                                   >>  31         .word   start, 0, end, handler;         \
                                                   >>  32         .text;                                  \
                                                   >>  33         .align  4
                                                   >>  34 
                                                   >>  35 /* Please don't change these macros, unless you change the logic
                                                   >>  36  * in the .fixup section below as well.
                                                   >>  37  * Store 64 bytes at (BASE + OFFSET) using value SOURCE. */
                                                   >>  38 #define ZERO_BIG_BLOCK(base, offset, source)    \
                                                   >>  39         std     source, [base + offset + 0x00]; \
                                                   >>  40         std     source, [base + offset + 0x08]; \
                                                   >>  41         std     source, [base + offset + 0x10]; \
                                                   >>  42         std     source, [base + offset + 0x18]; \
                                                   >>  43         std     source, [base + offset + 0x20]; \
                                                   >>  44         std     source, [base + offset + 0x28]; \
                                                   >>  45         std     source, [base + offset + 0x30]; \
                                                   >>  46         std     source, [base + offset + 0x38];
                                                   >>  47 
                                                   >>  48 #define ZERO_LAST_BLOCKS(base, offset, source)  \
                                                   >>  49         std     source, [base - offset - 0x38]; \
                                                   >>  50         std     source, [base - offset - 0x30]; \
                                                   >>  51         std     source, [base - offset - 0x28]; \
                                                   >>  52         std     source, [base - offset - 0x20]; \
                                                   >>  53         std     source, [base - offset - 0x18]; \
                                                   >>  54         std     source, [base - offset - 0x10]; \
                                                   >>  55         std     source, [base - offset - 0x08]; \
                                                   >>  56         std     source, [base - offset - 0x00];
  9                                                    57 
 10                                                << 
 11         .macro HEXAGON_OPT_FUNC_BEGIN name     << 
 12         .text                                      58         .text
 13         .p2align 4                             !!  59         .align 4
 14         .globl \name                           !!  60 
 15         .type  \name, @function                !!  61         .globl  __bzero_begin
 16 \name:                                         !!  62 __bzero_begin:
 17         .endm                                  !!  63 
 18                                                !!  64         .globl  C_LABEL(__bzero), C_LABEL(__memset), 
 19         .macro HEXAGON_OPT_FUNC_FINISH name    !!  65         .globl  C_LABEL(memset)
 20         .size  \name, . - \name                !!  66         .globl  C_LABEL(__memset_start), C_LABEL(__memset_end)
 21         .endm                                  !!  67 C_LABEL(__memset_start):
 22                                                !!  68 C_LABEL(__memset):
 23 /* FUNCTION: memset (v2 version) */            !!  69 C_LABEL(memset):
 24 #if __HEXAGON_ARCH__ < 3                       !!  70         and     %o1, 0xff, %g3
 25 HEXAGON_OPT_FUNC_BEGIN memset                  !!  71         sll     %g3, 8, %g2
 26         {                                      !!  72         or      %g3, %g2, %g3
 27                 r6 = #8                        !!  73         sll     %g3, 16, %g2
 28                 r7 = extractu(r0, #3 , #0)     !!  74         or      %g3, %g2, %g3
 29                 p0 = cmp.eq(r2, #0)            !!  75         b       1f
 30                 p1 = cmp.gtu(r2, #7)           !!  76          mov    %o2, %o1
 31         }                                      !!  77 3:
 32         {                                      !!  78         cmp     %o2, 3
 33                 r4 = vsplatb(r1)               !!  79         be      2f
 34                 r8 = r0           /* leave r0  !!  80          EX(stb %g3, [%o0], sub %o1, 0)
 35                 r9 = sub(r6, r7)  /* bytes unt !!  81 
 36                 if p0 jumpr r31   /* count ==  !!  82         cmp     %o2, 2
 37         }                                      !!  83         be      2f
 38         {                                      !!  84          EX(stb %g3, [%o0 + 0x01], sub %o1, 1)
 39                 r3 = #0                        !!  85 
 40                 r7 = #0                        !!  86         EX(stb  %g3, [%o0 + 0x02], sub %o1, 2)
 41                 p0 = tstbit(r9, #0)            !!  87 2:
 42                 if p1 jump 2f /* skip byte loo !!  88         sub     %o2, 4, %o2
 43         }                                      !!  89         add     %o1, %o2, %o1
 44                                                !!  90         b       4f
 45 /* less than 8 bytes to set, so just set a byt !!  91          sub    %o0, %o2, %o0
 46                                                !!  92 
 47                 loop0(1f, r2) /* byte loop */  !!  93 C_LABEL(__bzero):
 48         .falign                                !!  94         mov     %g0, %g3
 49 1: /* byte loop */                             !!  95 1:
 50         {                                      !!  96         cmp     %o1, 7
 51                 memb(r8++#1) = r4              !!  97         bleu    7f
 52         }:endloop0                             !!  98          andcc  %o0, 3, %o2
 53                 jumpr r31                      !!  99 
 54         .falign                                !! 100         bne     3b
 55 2: /* skip byte loop */                        !! 101 4:
 56         {                                      !! 102          andcc  %o0, 4, %g0
 57                 r6 = #1                        !! 103 
 58                 p0 = tstbit(r9, #1)            !! 104         be      2f
 59                 p1 = cmp.eq(r2, #1)            !! 105          mov    %g3, %g2
 60                 if !p0 jump 3f /* skip initial !! 106 
 61         }                                      !! 107         EX(st   %g3, [%o0], sub %o1, 0)
 62         {                                      !! 108         sub     %o1, 4, %o1
 63                 memb(r8++#1) = r4              !! 109         add     %o0, 4, %o0
 64                 r3:2 = sub(r3:2, r7:6)         !! 110 2:
 65                 if p1 jumpr r31                !! 111         andcc   %o1, 0xffffff80, %o3    ! Now everything is 8 aligned and o1 is len to run
 66         }                                      !! 112         be      9f
 67         .falign                                !! 113          andcc  %o1, 0x78, %o2
 68 3: /* skip initial byte store */               !! 114 10:
 69         {                                      !! 115         ZERO_BIG_BLOCK(%o0, 0x00, %g2)
 70                 r6 = #2                        !! 116         subcc   %o3, 128, %o3
 71                 p0 = tstbit(r9, #2)            !! 117         ZERO_BIG_BLOCK(%o0, 0x40, %g2)
 72                 p1 = cmp.eq(r2, #2)            !! 118 11:
 73                 if !p0 jump 4f /* skip initial !! 119         EXT(10b, 11b, 20f)
 74         }                                      !! 120         bne     10b
 75         {                                      !! 121          add    %o0, 128, %o0
 76                 memh(r8++#2) = r4              !! 122 
 77                 r3:2 = sub(r3:2, r7:6)         !! 123         orcc    %o2, %g0, %g0
 78                 if p1 jumpr r31                !! 124 9:
 79         }                                      !! 125         be      13f
 80         .falign                                !! 126          andcc  %o1, 7, %o1
 81 4: /* skip initial half store */               !! 127 
 82         {                                      !! 128         srl     %o2, 1, %o3
 83                 r6 = #4                        !! 129         set     13f, %o4
 84                 p0 = cmp.gtu(r2, #7)           !! 130         sub     %o4, %o3, %o4
 85                 p1 = cmp.eq(r2, #4)            !! 131         jmp     %o4
 86                 if !p0 jump 5f /* skip initial !! 132          add    %o0, %o2, %o0
 87         }                                      !! 133 
 88         {                                      !! 134 12:
 89                 memw(r8++#4) = r4              !! 135         ZERO_LAST_BLOCKS(%o0, 0x48, %g2)
 90                 r3:2 = sub(r3:2, r7:6)         !! 136         ZERO_LAST_BLOCKS(%o0, 0x08, %g2)
 91                 p0 = cmp.gtu(r2, #11)          !! 137 13:
 92                 if p1 jumpr r31                !! 138         be      8f
 93         }                                      !! 139          andcc  %o1, 4, %g0
 94         .falign                                !! 140 
 95 5: /* skip initial word store */               !! 141         be      1f
 96         {                                      !! 142          andcc  %o1, 2, %g0
 97                 r10 = lsr(r2, #3)              !! 143 
 98                 p1 = cmp.eq(r3, #1)            !! 144         EX(st   %g3, [%o0], and %o1, 7)
 99                 if !p0 jump 7f /* skip double  !! 145         add     %o0, 4, %o0
100         }                                      !! 146 1:
101         {                                      !! 147         be      1f
102                 r5 = r4                        !! 148          andcc  %o1, 1, %g0
103                 r6 = #8                        !! 149 
104                 loop0(6f, r10) /* double loop  !! 150         EX(sth  %g3, [%o0], and %o1, 3)
105         }                                      !! 151         add     %o0, 2, %o0
106                                                !! 152 1:
107 /* set bytes a double word at a time  */       !! 153         bne,a   8f
108                                                !! 154          EX(stb %g3, [%o0], and %o1, 1)
109         .falign                                !! 155 8:
110 6: /* double loop */                           !! 156         retl
111         {                                      !! 157          clr    %o0
112                 memd(r8++#8) = r5:4            !! 158 7:
113                 r3:2 = sub(r3:2, r7:6)         !! 159         be      13b
114                 p1 = cmp.eq(r2, #8)            !! 160          orcc   %o1, 0, %g0
115         }:endloop0                             !! 161 
116         .falign                                !! 162         be      0f
117 7: /* skip double loop */                      !! 163 8:
118         {                                      !! 164          add    %o0, 1, %o0
119                 p0 = tstbit(r2, #2)            !! 165         subcc   %o1, 1, %o1
120                 if p1 jumpr r31                !! 166         bne,a   8b
121         }                                      !! 167          EX(stb %g3, [%o0 - 1], add %o1, 1)
122         {                                      !! 168 0:
123                 r6 = #4                        !! 169         retl
124                 p0 = tstbit(r2, #1)            !! 170          clr    %o0
125                 p1 = cmp.eq(r2, #4)            !! 171 C_LABEL(__memset_end):
126                 if !p0 jump 8f /* skip final w !! 172 
127         }                                      !! 173         .section .fixup,#alloc,#execinstr
128         {                                      !! 174         .align  4
129                 memw(r8++#4) = r4              !! 175 20:
130                 r3:2 = sub(r3:2, r7:6)         !! 176         cmp     %g2, 8
131                 if p1 jumpr r31                !! 177         bleu    1f
132         }                                      !! 178          and    %o1, 0x7f, %o1
133         .falign                                !! 179         sub     %g2, 9, %g2
134 8: /* skip final word store */                 !! 180         add     %o3, 64, %o3
135         {                                      !! 181 1:
136                 p1 = cmp.eq(r2, #2)            !! 182         sll     %g2, 3, %g2
137                 if !p0 jump 9f /* skip final h !! 183         add     %o3, %o1, %o0
138         }                                      !! 184         b 30f
139         {                                      !! 185          sub    %o0, %g2, %o0
140                 memh(r8++#2) = r4              !! 186 21:
141                 if p1 jumpr r31                !! 187         mov     8, %o0
142         }                                      !! 188         and     %o1, 7, %o1
143         .falign                                !! 189         sub     %o0, %g2, %o0
144 9: /* skip final half store */                 !! 190         sll     %o0, 3, %o0
145         {                                      !! 191         b 30f
146                 memb(r8++#1) = r4              !! 192          add    %o0, %o1, %o0
147                 jumpr r31                      !! 193 30:
148         }                                      !! 194 /* %o4 is faulting address, %o5 is %pc where fault occurred */
149 HEXAGON_OPT_FUNC_FINISH memset                 !! 195         save    %sp, -104, %sp
150 #endif                                         !! 196         mov     %i5, %o0
151                                                !! 197         mov     %i7, %o1
152                                                !! 198         call    C_LABEL(lookup_fault)
153 /*  FUNCTION: memset (v3 and higher version)   !! 199          mov    %i4, %o2
154 #if __HEXAGON_ARCH__ >= 3                      !! 200         ret
155 HEXAGON_OPT_FUNC_BEGIN memset                  !! 201          restore
156         {                                      !! 202 
157                 r7=vsplatb(r1)                 !! 203         .globl __bzero_end
158                 r6 = r0                        !! 204 __bzero_end:
159                 if (r2==#0) jump:nt .L1        << 
160         }                                      << 
161         {                                      << 
162                 r5:4=combine(r7,r7)            << 
163                 p0 = cmp.gtu(r2,#8)            << 
164                 if (p0.new) jump:nt .L3        << 
165         }                                      << 
166         {                                      << 
167                 r3 = r0                        << 
168                 loop0(.L47,r2)                 << 
169         }                                      << 
170         .falign                                << 
171 .L47:                                          << 
172         {                                      << 
173                 memb(r3++#1) = r1              << 
174         }:endloop0 /* start=.L47 */            << 
175                 jumpr r31                      << 
176 .L3:                                           << 
177         {                                      << 
178                 p0 = tstbit(r0,#0)             << 
179                 if (!p0.new) jump:nt .L8       << 
180                 p1 = cmp.eq(r2, #1)            << 
181         }                                      << 
182         {                                      << 
183                 r6 = add(r0, #1)               << 
184                 r2 = add(r2,#-1)               << 
185                 memb(r0) = r1                  << 
186                 if (p1) jump .L1               << 
187         }                                      << 
188 .L8:                                           << 
189         {                                      << 
190                 p0 = tstbit(r6,#1)             << 
191                 if (!p0.new) jump:nt .L10      << 
192         }                                      << 
193         {                                      << 
194                 r2 = add(r2,#-2)               << 
195                 memh(r6++#2) = r7              << 
196                 p0 = cmp.eq(r2, #2)            << 
197                 if (p0.new) jump:nt .L1        << 
198         }                                      << 
199 .L10:                                          << 
200         {                                      << 
201                 p0 = tstbit(r6,#2)             << 
202                 if (!p0.new) jump:nt .L12      << 
203         }                                      << 
204         {                                      << 
205                 r2 = add(r2,#-4)               << 
206                 memw(r6++#4) = r7              << 
207                 p0 = cmp.eq(r2, #4)            << 
208                 if (p0.new) jump:nt .L1        << 
209         }                                      << 
210 .L12:                                          << 
211         {                                      << 
212                 p0 = cmp.gtu(r2,#127)          << 
213                 if (!p0.new) jump:nt .L14      << 
214         }                                      << 
215                 r3 = and(r6,#31)               << 
216                 if (r3==#0) jump:nt .L17       << 
217         {                                      << 
218                 memd(r6++#8) = r5:4            << 
219                 r2 = add(r2,#-8)               << 
220         }                                      << 
221                 r3 = and(r6,#31)               << 
222                 if (r3==#0) jump:nt .L17       << 
223         {                                      << 
224                 memd(r6++#8) = r5:4            << 
225                 r2 = add(r2,#-8)               << 
226         }                                      << 
227                 r3 = and(r6,#31)               << 
228                 if (r3==#0) jump:nt .L17       << 
229         {                                      << 
230                 memd(r6++#8) = r5:4            << 
231                 r2 = add(r2,#-8)               << 
232         }                                      << 
233 .L17:                                          << 
234         {                                      << 
235                 r3 = lsr(r2,#5)                << 
236                 if (r1!=#0) jump:nt .L18       << 
237         }                                      << 
238         {                                      << 
239                 r8 = r3                        << 
240                 r3 = r6                        << 
241                 loop0(.L46,r3)                 << 
242         }                                      << 
243         .falign                                << 
244 .L46:                                          << 
245         {                                      << 
246                 dczeroa(r6)                    << 
247                 r6 = add(r6,#32)               << 
248                 r2 = add(r2,#-32)              << 
249         }:endloop0 /* start=.L46 */            << 
250 .L14:                                          << 
251         {                                      << 
252                 p0 = cmp.gtu(r2,#7)            << 
253                 if (!p0.new) jump:nt .L28      << 
254                 r8 = lsr(r2,#3)                << 
255         }                                      << 
256                 loop0(.L44,r8)                 << 
257         .falign                                << 
258 .L44:                                          << 
259         {                                      << 
260                 memd(r6++#8) = r5:4            << 
261                 r2 = add(r2,#-8)               << 
262         }:endloop0 /* start=.L44 */            << 
263 .L28:                                          << 
264         {                                      << 
265                 p0 = tstbit(r2,#2)             << 
266                 if (!p0.new) jump:nt .L33      << 
267         }                                      << 
268         {                                      << 
269                 r2 = add(r2,#-4)               << 
270                 memw(r6++#4) = r7              << 
271         }                                      << 
272 .L33:                                          << 
273         {                                      << 
274                 p0 = tstbit(r2,#1)             << 
275                 if (!p0.new) jump:nt .L35      << 
276         }                                      << 
277         {                                      << 
278                 r2 = add(r2,#-2)               << 
279                 memh(r6++#2) = r7              << 
280         }                                      << 
281 .L35:                                          << 
282                 p0 = cmp.eq(r2,#1)             << 
283                 if (p0) memb(r6) = r1          << 
284 .L1:                                           << 
285                 jumpr r31                      << 
286 .L18:                                          << 
287                 loop0(.L45,r3)                 << 
288         .falign                                << 
289 .L45:                                          << 
290                 dczeroa(r6)                    << 
291         {                                      << 
292                 memd(r6++#8) = r5:4            << 
293                 r2 = add(r2,#-32)              << 
294         }                                      << 
295                 memd(r6++#8) = r5:4            << 
296                 memd(r6++#8) = r5:4            << 
297         {                                      << 
298                 memd(r6++#8) = r5:4            << 
299         }:endloop0 /* start=.L45  */           << 
300                 jump .L14                      << 
301 HEXAGON_OPT_FUNC_FINISH memset                 << 
302 #endif                                         << 
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php