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
12 #include <asm/asmmacro.h>
16 # define L3_LINE_SIZE 64 // Itanium L3 line size
17 # define PREFETCH_LINES 9 // magic number
19 # define L3_LINE_SIZE 128 // McKinley L3 line size
20 # define PREFETCH_LINES 12 // magic number
32 GLOBAL_ENTRY(clear_page)
35 mov r16 = PAGE_SIZE/L3_LINE_SIZE-1 // main loop count, -1=repeat/until
40 mov ar.lc = (PREFETCH_LINES - 1)
45 .fetch: stf.spill.nta [dst_fetch] = f0, L3_LINE_SIZE
46 adds dst3 = 48, in0 // executing this multiple times is harmless
47 br.cloop.sptk.few .fetch
49 addl dst_last = (PAGE_SIZE - PREFETCH_LINES*L3_LINE_SIZE), dst_fetch
50 mov ar.lc = r16 // one L3 line per iteration
54 // Optimized for Itanium
55 1: stf.spill.nta [dst1] = f0, 64
56 stf.spill.nta [dst2] = f0, 64
57 cmp.lt p8,p0=dst_fetch, dst_last
60 // Optimized for McKinley
61 1: stf.spill.nta [dst1] = f0, 64
62 stf.spill.nta [dst2] = f0, 64
63 stf.spill.nta [dst3] = f0, 64
64 stf.spill.nta [dst4] = f0, 128
65 cmp.lt p8,p0=dst_fetch, dst_last
67 stf.spill.nta [dst1] = f0, 64
68 stf.spill.nta [dst2] = f0, 64
70 stf.spill.nta [dst3] = f0, 64
71 (p8) stf.spill.nta [dst_fetch] = f0, L3_LINE_SIZE
74 mov ar.lc = saved_lc // restore lc