2 * Copyright (C) 1999-2002 Hewlett-Packard Co
3 * Stephane Eranian <eranian@hpl.hp.com>
4 * David Mosberger-Tang <davidm@hpl.hp.com>
5 * Copyright (C) 2002 Ken Chen <kenneth.w.chen@intel.com>
7 * 1/06/01 davidm Tuned for Itanium.
8 * 2/12/02 kchen Tuned for both Itanium and McKinley
9 * 3/08/02 davidm Some more tweaking
11 #include <linux/config.h>
13 #include <asm/asmmacro.h>
17 # define L3_LINE_SIZE 64 // Itanium L3 line size
18 # define PREFETCH_LINES 9 // magic number
20 # define L3_LINE_SIZE 128 // McKinley L3 line size
21 # define PREFETCH_LINES 12 // magic number
33 GLOBAL_ENTRY(clear_page)
36 mov r16 = PAGE_SIZE/L3_LINE_SIZE-1 // main loop count, -1=repeat/until
41 mov ar.lc = (PREFETCH_LINES - 1)
46 .fetch: stf.spill.nta [dst_fetch] = f0, L3_LINE_SIZE
47 adds dst3 = 48, in0 // executing this multiple times is harmless
48 br.cloop.sptk.few .fetch
50 addl dst_last = (PAGE_SIZE - PREFETCH_LINES*L3_LINE_SIZE), dst_fetch
51 mov ar.lc = r16 // one L3 line per iteration
55 // Optimized for Itanium
56 1: stf.spill.nta [dst1] = f0, 64
57 stf.spill.nta [dst2] = f0, 64
58 cmp.lt p8,p0=dst_fetch, dst_last
61 // Optimized for McKinley
62 1: stf.spill.nta [dst1] = f0, 64
63 stf.spill.nta [dst2] = f0, 64
64 stf.spill.nta [dst3] = f0, 64
65 stf.spill.nta [dst4] = f0, 128
66 cmp.lt p8,p0=dst_fetch, dst_last
68 stf.spill.nta [dst1] = f0, 64
69 stf.spill.nta [dst2] = f0, 64
71 stf.spill.nta [dst3] = f0, 64
72 (p8) stf.spill.nta [dst_fetch] = f0, L3_LINE_SIZE
75 mov ar.lc = saved_lc // restore lc