1 /* SPDX-License-Identifier: GPL-2.0 */
4 * Optimized version of the standard copy_page() function
7 * in0: address of target page
8 * in1: address of source page
12 * Copyright (C) 1999, 2001 Hewlett-Packard Co
13 * Stephane Eranian <eranian@hpl.hp.com>
14 * David Mosberger <davidm@hpl.hp.com>
16 * 4/06/01 davidm Tuned to make it perform well both for cached and uncached copies.
18 #include <asm/asmmacro.h>
20 #include <asm/export.h>
23 #define EPI p[PIPE_DEPTH-1]
37 #define Nrot ((8*PIPE_DEPTH+7)&~7)
39 GLOBAL_ENTRY(copy_page)
41 .save ar.pfs, saved_pfs
42 alloc saved_pfs=ar.pfs,3,Nrot-3,0,Nrot
44 .rotr t1[PIPE_DEPTH], t2[PIPE_DEPTH], t3[PIPE_DEPTH], t4[PIPE_DEPTH], \
45 t5[PIPE_DEPTH], t6[PIPE_DEPTH], t7[PIPE_DEPTH], t8[PIPE_DEPTH]
52 mov lcount=PAGE_SIZE/64-1
61 mov tgt_last = PAGE_SIZE
68 add tgt_last = tgt_last, in0
71 (p[0]) ld8 t1[0]=[src1],16
72 (EPI) st8 [tgt1]=t1[PIPE_DEPTH-1],16
73 (p[0]) ld8 t2[0]=[src2],16
74 (EPI) st8 [tgt2]=t2[PIPE_DEPTH-1],16
75 cmp.ltu p6,p0 = tgtf, tgt_last
77 (p[0]) ld8 t3[0]=[src1],16
78 (EPI) st8 [tgt1]=t3[PIPE_DEPTH-1],16
79 (p[0]) ld8 t4[0]=[src2],16
80 (EPI) st8 [tgt2]=t4[PIPE_DEPTH-1],16
82 (p[0]) ld8 t5[0]=[src1],16
83 (EPI) st8 [tgt1]=t5[PIPE_DEPTH-1],16
84 (p[0]) ld8 t6[0]=[src2],16
85 (EPI) st8 [tgt2]=t6[PIPE_DEPTH-1],16
87 (p[0]) ld8 t7[0]=[src1],16
88 (EPI) st8 [tgt1]=t7[PIPE_DEPTH-1],16
89 (p[0]) ld8 t8[0]=[src2],16
90 (EPI) st8 [tgt2]=t8[PIPE_DEPTH-1],16
92 (p6) lfetch [srcf], 64
93 (p6) lfetch [tgtf], 64
96 mov pr=saved_pr,0xffffffffffff0000 // restore predicates
101 EXPORT_SYMBOL(copy_page)