Path: blob/master/src/hotspot/os_cpu/linux_aarch64/copy_linux_aarch64.S
41145 views
/*1* Copyright (c) 2016, Linaro Ltd. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/23.global _Copy_conjoint_words24.global _Copy_disjoint_words2526s .req x027d .req x128count .req x229t0 .req x330t1 .req x431t2 .req x532t3 .req x633t4 .req x734t5 .req x835t6 .req x936t7 .req x103738.align 639_Copy_disjoint_words:40// Ensure 2 word aligned41tbz s, #3, fwd_copy_aligned42ldr t0, [s], #843str t0, [d], #844sub count, count, #14546fwd_copy_aligned:47// Bias s & d so we only pre index on the last copy48sub s, s, #1649sub d, d, #165051ldp t0, t1, [s, #16]52ldp t2, t3, [s, #32]53ldp t4, t5, [s, #48]54ldp t6, t7, [s, #64]!5556subs count, count, #1657blo fwd_copy_drain5859fwd_copy_again:60prfm pldl1keep, [s, #256]61stp t0, t1, [d, #16]62ldp t0, t1, [s, #16]63stp t2, t3, [d, #32]64ldp t2, t3, [s, #32]65stp t4, t5, [d, #48]66ldp t4, t5, [s, #48]67stp t6, t7, [d, #64]!68ldp t6, t7, [s, #64]!69subs count, count, #870bhs fwd_copy_again7172fwd_copy_drain:73stp t0, t1, [d, #16]74stp t2, t3, [d, #32]75stp t4, t5, [d, #48]76stp t6, t7, [d, #64]!7778// count is now -8..-1 for 0..7 words to copy79adr t0, 0f80add t0, t0, count, lsl #581br t08283.align 584ret // -8 == 0 words85.align 586ldr t0, [s, #16] // -7 == 1 word87str t0, [d, #16]88ret89.align 590ldp t0, t1, [s, #16] // -6 = 2 words91stp t0, t1, [d, #16]92ret93.align 594ldp t0, t1, [s, #16] // -5 = 3 words95ldr t2, [s, #32]96stp t0, t1, [d, #16]97str t2, [d, #32]98ret99.align 5100ldp t0, t1, [s, #16] // -4 = 4 words101ldp t2, t3, [s, #32]102stp t0, t1, [d, #16]103stp t2, t3, [d, #32]104ret105.align 5106ldp t0, t1, [s, #16] // -3 = 5 words107ldp t2, t3, [s, #32]108ldr t4, [s, #48]109stp t0, t1, [d, #16]110stp t2, t3, [d, #32]111str t4, [d, #48]112ret113.align 5114ldp t0, t1, [s, #16] // -2 = 6 words115ldp t2, t3, [s, #32]116ldp t4, t5, [s, #48]117stp t0, t1, [d, #16]118stp t2, t3, [d, #32]119stp t4, t5, [d, #48]120ret121.align 5122ldp t0, t1, [s, #16] // -1 = 7 words123ldp t2, t3, [s, #32]124ldp t4, t5, [s, #48]125ldr t6, [s, #64]126stp t0, t1, [d, #16]127stp t2, t3, [d, #32]128stp t4, t5, [d, #48]129str t6, [d, #64]130// Is always aligned here, code for 7 words is one instruction131// too large so it just falls through.132.align 51330:134ret135136.align 6137_Copy_conjoint_words:138sub t0, d, s139cmp t0, count, lsl #3140bhs _Copy_disjoint_words141142add s, s, count, lsl #3143add d, d, count, lsl #3144145// Ensure 2 word aligned146tbz s, #3, bwd_copy_aligned147ldr t0, [s, #-8]!148str t0, [d, #-8]!149sub count, count, #1150151bwd_copy_aligned:152ldp t0, t1, [s, #-16]153ldp t2, t3, [s, #-32]154ldp t4, t5, [s, #-48]155ldp t6, t7, [s, #-64]!156157subs count, count, #16158blo bwd_copy_drain159160bwd_copy_again:161prfum pldl1keep, [s, #-256]162stp t0, t1, [d, #-16]163ldp t0, t1, [s, #-16]164stp t2, t3, [d, #-32]165ldp t2, t3, [s, #-32]166stp t4, t5, [d, #-48]167ldp t4, t5, [s, #-48]168stp t6, t7, [d, #-64]!169ldp t6, t7, [s, #-64]!170subs count, count, #8171bhs bwd_copy_again172173bwd_copy_drain:174stp t0, t1, [d, #-16]175stp t2, t3, [d, #-32]176stp t4, t5, [d, #-48]177stp t6, t7, [d, #-64]!178179// count is now -8..-1 for 0..7 words to copy180adr t0, 0f181add t0, t0, count, lsl #5182br t0183184.align 5185ret // -8 == 0 words186.align 5187ldr t0, [s, #-8] // -7 == 1 word188str t0, [d, #-8]189ret190.align 5191ldp t0, t1, [s, #-16] // -6 = 2 words192stp t0, t1, [d, #-16]193ret194.align 5195ldp t0, t1, [s, #-16] // -5 = 3 words196ldr t2, [s, #-24]197stp t0, t1, [d, #-16]198str t2, [d, #-24]199ret200.align 5201ldp t0, t1, [s, #-16] // -4 = 4 words202ldp t2, t3, [s, #-32]203stp t0, t1, [d, #-16]204stp t2, t3, [d, #-32]205ret206.align 5207ldp t0, t1, [s, #-16] // -3 = 5 words208ldp t2, t3, [s, #-32]209ldr t4, [s, #-40]210stp t0, t1, [d, #-16]211stp t2, t3, [d, #-32]212str t4, [d, #-40]213ret214.align 5215ldp t0, t1, [s, #-16] // -2 = 6 words216ldp t2, t3, [s, #-32]217ldp t4, t5, [s, #-48]218stp t0, t1, [d, #-16]219stp t2, t3, [d, #-32]220stp t4, t5, [d, #-48]221ret222.align 5223ldp t0, t1, [s, #-16] // -1 = 7 words224ldp t2, t3, [s, #-32]225ldp t4, t5, [s, #-48]226ldr t6, [s, #-56]227stp t0, t1, [d, #-16]228stp t2, t3, [d, #-32]229stp t4, t5, [d, #-48]230str t6, [d, #-56]231// Is always aligned here, code for 7 words is one instruction232// too large so it just falls through.233.align 52340:235ret236237238