From: "jiaqi zhang" Date: Wed, 22 Aug 2007 00:01:19 +0000 Subject: Problems of PREFETCH instruction on UltraSparc T1 Message-Id: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: sparclinux@vger.kernel.org Hi, everyone, I don't really know if it is proper to post this topic here. In order to accelerate our applications, I adopted the PREFETCH instruction of UltraSparc. However, the results are not expected: the one with prefetch works even a little bit slower. The whole program is listed below. I read the Ultrasparc specification and found that "when executed in nonprivileged or privileged mode, PREFETCH has the same observable effect as a NOP". I don't know how to understand this sentence. What are the nonprivileged, privileged, and hyperprivileged modes in Linux? Could that be user mode and kernel mode? I mean, does it mean I can only make use of that instruction in kernel mode? Thanks a lot! testprefetch.c: #include #include #include #define MEGA 1024*1024 #define TIMES 1 #define LASTITEM 100*MEGA-1 int main(){ struct timeval begin,end; register int i,j; int foo, bar; int *data=3D(int *)malloc(100*sizeof(int)*MEGA); //400MB in order to avoid being cached in L2 cache, which is 3M register int *buf, *lastone; lastone=3D&data[LASTITEM]; gettimeofday(&begin,NULL); for(i=3D0;i