~ [ 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-4.15.18)


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