author | michaelm |
Thu, 22 Aug 2019 14:36:10 +0100 | |
changeset 57838 | 78844dceede6 |
parent 53244 | 9807daeb47c4 |
permissions | -rw-r--r-- |
29182 | 1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
48951
diff
changeset
|
2 |
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. |
29182 | 3 |
* Copyright (c) 2014, Red Hat Inc. All rights reserved. |
4 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
5 |
* |
|
6 |
* This code is free software; you can redistribute it and/or modify it |
|
7 |
* under the terms of the GNU General Public License version 2 only, as |
|
8 |
* published by the Free Software Foundation. |
|
9 |
* |
|
10 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
11 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
14 |
* accompanied this code). |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License version |
|
17 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
18 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
19 |
* |
|
20 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
21 |
* or visit www.oracle.com if you need additional information or have any |
|
22 |
* questions. |
|
23 |
* |
|
24 |
*/ |
|
25 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
48951
diff
changeset
|
26 |
#ifndef OS_CPU_LINUX_AARCH64_COPY_LINUX_AARCH64_INLINE_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
48951
diff
changeset
|
27 |
#define OS_CPU_LINUX_AARCH64_COPY_LINUX_AARCH64_INLINE_HPP |
29182 | 28 |
|
36595
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
29 |
#define COPY_SMALL(from, to, count) \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
30 |
{ \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
31 |
long tmp0, tmp1, tmp2, tmp3; \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
32 |
long tmp4, tmp5, tmp6, tmp7; \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
33 |
__asm volatile( \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
34 |
" adr %[t0], 0f;" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
35 |
" add %[t0], %[t0], %[cnt], lsl #5;" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
36 |
" br %[t0];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
37 |
" .align 5;" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
38 |
"0:" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
39 |
" b 1f;" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
40 |
" .align 5;" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
41 |
" ldr %[t0], [%[s], #0];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
42 |
" str %[t0], [%[d], #0];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
43 |
" b 1f;" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
44 |
" .align 5;" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
45 |
" ldp %[t0], %[t1], [%[s], #0];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
46 |
" stp %[t0], %[t1], [%[d], #0];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
47 |
" b 1f;" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
48 |
" .align 5;" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
49 |
" ldp %[t0], %[t1], [%[s], #0];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
50 |
" ldr %[t2], [%[s], #16];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
51 |
" stp %[t0], %[t1], [%[d], #0];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
52 |
" str %[t2], [%[d], #16];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
53 |
" b 1f;" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
54 |
" .align 5;" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
55 |
" ldp %[t0], %[t1], [%[s], #0];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
56 |
" ldp %[t2], %[t3], [%[s], #16];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
57 |
" stp %[t0], %[t1], [%[d], #0];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
58 |
" stp %[t2], %[t3], [%[d], #16];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
59 |
" b 1f;" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
60 |
" .align 5;" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
61 |
" ldp %[t0], %[t1], [%[s], #0];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
62 |
" ldp %[t2], %[t3], [%[s], #16];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
63 |
" ldr %[t4], [%[s], #32];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
64 |
" stp %[t0], %[t1], [%[d], #0];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
65 |
" stp %[t2], %[t3], [%[d], #16];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
66 |
" str %[t4], [%[d], #32];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
67 |
" b 1f;" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
68 |
" .align 5;" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
69 |
" ldp %[t0], %[t1], [%[s], #0];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
70 |
" ldp %[t2], %[t3], [%[s], #16];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
71 |
" ldp %[t4], %[t5], [%[s], #32];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
72 |
"2:" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
73 |
" stp %[t0], %[t1], [%[d], #0];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
74 |
" stp %[t2], %[t3], [%[d], #16];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
75 |
" stp %[t4], %[t5], [%[d], #32];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
76 |
" b 1f;" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
77 |
" .align 5;" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
78 |
" ldr %[t6], [%[s], #0];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
79 |
" ldp %[t0], %[t1], [%[s], #8];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
80 |
" ldp %[t2], %[t3], [%[s], #24];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
81 |
" ldp %[t4], %[t5], [%[s], #40];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
82 |
" str %[t6], [%[d]], #8;" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
83 |
" b 2b;" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
84 |
" .align 5;" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
85 |
" ldp %[t0], %[t1], [%[s], #0];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
86 |
" ldp %[t2], %[t3], [%[s], #16];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
87 |
" ldp %[t4], %[t5], [%[s], #32];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
88 |
" ldp %[t6], %[t7], [%[s], #48];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
89 |
" stp %[t0], %[t1], [%[d], #0];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
90 |
" stp %[t2], %[t3], [%[d], #16];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
91 |
" stp %[t4], %[t5], [%[d], #32];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
92 |
" stp %[t6], %[t7], [%[d], #48];" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
93 |
"1:" \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
94 |
\ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
95 |
: [s]"+r"(from), [d]"+r"(to), [cnt]"+r"(count), \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
96 |
[t0]"=&r"(tmp0), [t1]"=&r"(tmp1), [t2]"=&r"(tmp2), [t3]"=&r"(tmp3), \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
97 |
[t4]"=&r"(tmp4), [t5]"=&r"(tmp5), [t6]"=&r"(tmp6), [t7]"=&r"(tmp7) \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
98 |
: \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
99 |
: "memory", "cc"); \ |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
100 |
} |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
101 |
|
48951 | 102 |
static void pd_conjoint_words(const HeapWord* from, HeapWord* to, size_t count) { |
36595
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
103 |
__asm volatile( "prfm pldl1strm, [%[s], #0];" :: [s]"r"(from) : "memory"); |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
104 |
if (__builtin_expect(count <= 8, 1)) { |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
105 |
COPY_SMALL(from, to, count); |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
106 |
return; |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
107 |
} |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
108 |
_Copy_conjoint_words(from, to, count); |
29182 | 109 |
} |
110 |
||
48951 | 111 |
static void pd_disjoint_words(const HeapWord* from, HeapWord* to, size_t count) { |
36595
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
112 |
if (__builtin_constant_p(count)) { |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
113 |
memcpy(to, from, count * sizeof(HeapWord)); |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
114 |
return; |
29182 | 115 |
} |
36595
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
116 |
__asm volatile( "prfm pldl1strm, [%[s], #0];" :: [s]"r"(from) : "memory"); |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
117 |
if (__builtin_expect(count <= 8, 1)) { |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
118 |
COPY_SMALL(from, to, count); |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
119 |
return; |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
120 |
} |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
121 |
_Copy_disjoint_words(from, to, count); |
29182 | 122 |
} |
123 |
||
48951 | 124 |
static void pd_disjoint_words_atomic(const HeapWord* from, HeapWord* to, size_t count) { |
36595
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
125 |
__asm volatile( "prfm pldl1strm, [%[s], #0];" :: [s]"r"(from) : "memory"); |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
126 |
if (__builtin_expect(count <= 8, 1)) { |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
127 |
COPY_SMALL(from, to, count); |
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
128 |
return; |
29182 | 129 |
} |
36595
3322a76f3a00
8151502: optimize pd_disjoint_words and pd_conjoint_words
enevill
parents:
29182
diff
changeset
|
130 |
_Copy_disjoint_words(from, to, count); |
29182 | 131 |
} |
132 |
||
48951 | 133 |
static void pd_aligned_conjoint_words(const HeapWord* from, HeapWord* to, size_t count) { |
29182 | 134 |
pd_conjoint_words(from, to, count); |
135 |
} |
|
136 |
||
48951 | 137 |
static void pd_aligned_disjoint_words(const HeapWord* from, HeapWord* to, size_t count) { |
29182 | 138 |
pd_disjoint_words(from, to, count); |
139 |
} |
|
140 |
||
48951 | 141 |
static void pd_conjoint_bytes(const void* from, void* to, size_t count) { |
29182 | 142 |
(void)memmove(to, from, count); |
143 |
} |
|
144 |
||
48951 | 145 |
static void pd_conjoint_bytes_atomic(const void* from, void* to, size_t count) { |
29182 | 146 |
pd_conjoint_bytes(from, to, count); |
147 |
} |
|
148 |
||
48951 | 149 |
static void pd_conjoint_jshorts_atomic(const jshort* from, jshort* to, size_t count) { |
29182 | 150 |
_Copy_conjoint_jshorts_atomic(from, to, count); |
151 |
} |
|
152 |
||
48951 | 153 |
static void pd_conjoint_jints_atomic(const jint* from, jint* to, size_t count) { |
29182 | 154 |
_Copy_conjoint_jints_atomic(from, to, count); |
155 |
} |
|
156 |
||
48951 | 157 |
static void pd_conjoint_jlongs_atomic(const jlong* from, jlong* to, size_t count) { |
29182 | 158 |
_Copy_conjoint_jlongs_atomic(from, to, count); |
159 |
} |
|
160 |
||
48951 | 161 |
static void pd_conjoint_oops_atomic(const oop* from, oop* to, size_t count) { |
29182 | 162 |
assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size"); |
48951 | 163 |
_Copy_conjoint_jlongs_atomic((const jlong*)from, (jlong*)to, count); |
29182 | 164 |
} |
165 |
||
48951 | 166 |
static void pd_arrayof_conjoint_bytes(const HeapWord* from, HeapWord* to, size_t count) { |
29182 | 167 |
_Copy_arrayof_conjoint_bytes(from, to, count); |
168 |
} |
|
169 |
||
48951 | 170 |
static void pd_arrayof_conjoint_jshorts(const HeapWord* from, HeapWord* to, size_t count) { |
29182 | 171 |
_Copy_arrayof_conjoint_jshorts(from, to, count); |
172 |
} |
|
173 |
||
48951 | 174 |
static void pd_arrayof_conjoint_jints(const HeapWord* from, HeapWord* to, size_t count) { |
29182 | 175 |
_Copy_arrayof_conjoint_jints(from, to, count); |
176 |
} |
|
177 |
||
48951 | 178 |
static void pd_arrayof_conjoint_jlongs(const HeapWord* from, HeapWord* to, size_t count) { |
29182 | 179 |
_Copy_arrayof_conjoint_jlongs(from, to, count); |
180 |
} |
|
181 |
||
48951 | 182 |
static void pd_arrayof_conjoint_oops(const HeapWord* from, HeapWord* to, size_t count) { |
29182 | 183 |
assert(!UseCompressedOops, "foo!"); |
184 |
assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size"); |
|
185 |
_Copy_arrayof_conjoint_jlongs(from, to, count); |
|
186 |
} |
|
187 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
48951
diff
changeset
|
188 |
#endif // OS_CPU_LINUX_AARCH64_COPY_LINUX_AARCH64_INLINE_HPP |