2
* Copyright (C) 2008 The Android Open Source Project
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
8
* * Redistributions of source code must retain the above copyright
9
* notice, this list of conditions and the following disclaimer.
10
* * Redistributions in binary form must reproduce the above copyright
11
* notice, this list of conditions and the following disclaimer in
12
* the documentation and/or other materials provided with the
15
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35
.type memset, %function
38
/* a prefetch distance of 4 cache-lines works best experimentally */
39
#define CACHE_LINE_SIZE 64
40
#define PREFETCH_DISTANCE (CACHE_LINE_SIZE*4)
53
/* do we have at least 16-bytes to copy (needed for alignment below) */
57
/* align destination to half cache-line for the write-buffer */
62
/* copy up to 15-bytes (count in r3) */
71
// copies 4 bytes, destination 32-bits aligned
72
vst4.8 {d0[0], d1[0], d2[0], d3[0]}, [r0]!
74
// copies 8 bytes, destination 64-bits aligned
75
vst1.8 {d0}, [r0, :64]!
79
/* make sure we have at least 64 bytes to copy */
83
1: /* The main loop copies 64 bytes at a time */
85
vst1.8 {d0 - d3}, [r0, :128]!
86
vst1.8 {d0 - d3}, [r0, :128]!
89
2: /* fix-up the remaining count and make sure we have >= 32 bytes left */
94
3: /* 32 bytes at a time. These cache lines were already preloaded */
96
vst1.8 {d0 - d3}, [r0, :128]!
99
4: /* less than 32 left */
103
// copies 16 bytes, 128-bits aligned
104
vst1.8 {d0, d1}, [r0, :128]!
106
5: /* copy up to 15-bytes (count in r2) */
111
vst4.8 {d0[0], d1[0], d2[0], d3[0]}, [r0]!
112
2: movs ip, r2, lsl #31