Path: blob/master/src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.S
40930 views
/*1* Copyright (c) 2016, Linaro Ltd. All rights reserved.2* Copyright (c) 2021, Azul Systems, Inc. All rights reserved.3* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.4*5* This code is free software; you can redistribute it and/or modify it6* under the terms of the GNU General Public License version 2 only, as7* published by the Free Software Foundation.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 2 along with this work; if not, write to the Free Software Foundation,17* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18*19* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*23*/2425#define CFUNC(x) _##x2627.global CFUNC(_Copy_conjoint_words)28.global CFUNC(_Copy_disjoint_words)2930s .req x031d .req x132count .req x233t0 .req x334t1 .req x435t2 .req x536t3 .req x637t4 .req x738t5 .req x839t6 .req x940t7 .req x104142.align 643CFUNC(_Copy_disjoint_words):44// Ensure 2 word aligned45tbz s, #3, fwd_copy_aligned46ldr t0, [s], #847str t0, [d], #848sub count, count, #14950fwd_copy_aligned:51// Bias s & d so we only pre index on the last copy52sub s, s, #1653sub d, d, #165455ldp t0, t1, [s, #16]56ldp t2, t3, [s, #32]57ldp t4, t5, [s, #48]58ldp t6, t7, [s, #64]!5960subs count, count, #1661blo fwd_copy_drain6263fwd_copy_again:64prfm pldl1keep, [s, #256]65stp t0, t1, [d, #16]66ldp t0, t1, [s, #16]67stp t2, t3, [d, #32]68ldp t2, t3, [s, #32]69stp t4, t5, [d, #48]70ldp t4, t5, [s, #48]71stp t6, t7, [d, #64]!72ldp t6, t7, [s, #64]!73subs count, count, #874bhs fwd_copy_again7576fwd_copy_drain:77stp t0, t1, [d, #16]78stp t2, t3, [d, #32]79stp t4, t5, [d, #48]80stp t6, t7, [d, #64]!8182// count is now -8..-1 for 0..7 words to copy83adr t0, 0f84add t0, t0, count, lsl #585br t08687.align 588ret // -8 == 0 words89.align 590ldr t0, [s, #16] // -7 == 1 word91str t0, [d, #16]92ret93.align 594ldp t0, t1, [s, #16] // -6 = 2 words95stp t0, t1, [d, #16]96ret97.align 598ldp t0, t1, [s, #16] // -5 = 3 words99ldr t2, [s, #32]100stp t0, t1, [d, #16]101str t2, [d, #32]102ret103.align 5104ldp t0, t1, [s, #16] // -4 = 4 words105ldp t2, t3, [s, #32]106stp t0, t1, [d, #16]107stp t2, t3, [d, #32]108ret109.align 5110ldp t0, t1, [s, #16] // -3 = 5 words111ldp t2, t3, [s, #32]112ldr t4, [s, #48]113stp t0, t1, [d, #16]114stp t2, t3, [d, #32]115str t4, [d, #48]116ret117.align 5118ldp t0, t1, [s, #16] // -2 = 6 words119ldp t2, t3, [s, #32]120ldp t4, t5, [s, #48]121stp t0, t1, [d, #16]122stp t2, t3, [d, #32]123stp t4, t5, [d, #48]124ret125.align 5126ldp t0, t1, [s, #16] // -1 = 7 words127ldp t2, t3, [s, #32]128ldp t4, t5, [s, #48]129ldr t6, [s, #64]130stp t0, t1, [d, #16]131stp t2, t3, [d, #32]132stp t4, t5, [d, #48]133str t6, [d, #64]134// Is always aligned here, code for 7 words is one instruction135// too large so it just falls through.136.align 51370:138ret139140.align 6141CFUNC(_Copy_conjoint_words):142sub t0, d, s143cmp t0, count, lsl #3144bhs CFUNC(_Copy_disjoint_words)145146add s, s, count, lsl #3147add d, d, count, lsl #3148149// Ensure 2 word aligned150tbz s, #3, bwd_copy_aligned151ldr t0, [s, #-8]!152str t0, [d, #-8]!153sub count, count, #1154155bwd_copy_aligned:156ldp t0, t1, [s, #-16]157ldp t2, t3, [s, #-32]158ldp t4, t5, [s, #-48]159ldp t6, t7, [s, #-64]!160161subs count, count, #16162blo bwd_copy_drain163164bwd_copy_again:165prfum pldl1keep, [s, #-256]166stp t0, t1, [d, #-16]167ldp t0, t1, [s, #-16]168stp t2, t3, [d, #-32]169ldp t2, t3, [s, #-32]170stp t4, t5, [d, #-48]171ldp t4, t5, [s, #-48]172stp t6, t7, [d, #-64]!173ldp t6, t7, [s, #-64]!174subs count, count, #8175bhs bwd_copy_again176177bwd_copy_drain:178stp t0, t1, [d, #-16]179stp t2, t3, [d, #-32]180stp t4, t5, [d, #-48]181stp t6, t7, [d, #-64]!182183// count is now -8..-1 for 0..7 words to copy184adr t0, 0f185add t0, t0, count, lsl #5186br t0187188.align 5189ret // -8 == 0 words190.align 5191ldr t0, [s, #-8] // -7 == 1 word192str t0, [d, #-8]193ret194.align 5195ldp t0, t1, [s, #-16] // -6 = 2 words196stp t0, t1, [d, #-16]197ret198.align 5199ldp t0, t1, [s, #-16] // -5 = 3 words200ldr t2, [s, #-24]201stp t0, t1, [d, #-16]202str t2, [d, #-24]203ret204.align 5205ldp t0, t1, [s, #-16] // -4 = 4 words206ldp t2, t3, [s, #-32]207stp t0, t1, [d, #-16]208stp t2, t3, [d, #-32]209ret210.align 5211ldp t0, t1, [s, #-16] // -3 = 5 words212ldp t2, t3, [s, #-32]213ldr t4, [s, #-40]214stp t0, t1, [d, #-16]215stp t2, t3, [d, #-32]216str t4, [d, #-40]217ret218.align 5219ldp t0, t1, [s, #-16] // -2 = 6 words220ldp t2, t3, [s, #-32]221ldp t4, t5, [s, #-48]222stp t0, t1, [d, #-16]223stp t2, t3, [d, #-32]224stp t4, t5, [d, #-48]225ret226.align 5227ldp t0, t1, [s, #-16] // -1 = 7 words228ldp t2, t3, [s, #-32]229ldp t4, t5, [s, #-48]230ldr t6, [s, #-56]231stp t0, t1, [d, #-16]232stp t2, t3, [d, #-32]233stp t4, t5, [d, #-48]234str t6, [d, #-56]235// Is always aligned here, code for 7 words is one instruction236// too large so it just falls through.237.align 52380:239ret240241242