This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
question about __builtin_prefetch for gcc 3.1
- From: Ravikiran G Thirumalai <kiran at in dot ibm dot com>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 23 Jul 2002 14:25:54 +0530
- Subject: question about __builtin_prefetch for gcc 3.1
Tried the foll query at gcc-help with no avail :(.
Hope somebody here can throw some light on this.
TIA
Kiran
----- Forwarded message from Ravikiran G Thirumalai <kiran@in.ibm.com> -----
> Date: Wed, 17 Jul 2002 15:55:09 +0530
> From: Ravikiran G Thirumalai <kiran@in.ibm.com>
> To: gcc-help@gcc.gnu.org
> Subject: question about __builtin_prefetch for gcc 3.1,
> User-Agent: Mutt/1.2.5i
>
> Hi,
> I was trying out the "__builtin_prefetch" feature in gcc3.1 (gcc-3.1-7.i386.rpm
> - Rawhide) i just installed.
>
> I used the foll code snippet to see if "prefetch" insn was being generated --
> <snippet>
>
>
> #define prefetchw(x) __builtin_prefetch(x, 1, 0)
>
> int main()
> {
> element_t *temp;
> create_list(LIST_NOS);
>
> temp = head;
> while( temp != NULL) {
> int burn;
> prefetchw(temp->next);
> burn = test_rand()* test_rand();
> temp->member_int *= burn;
> temp = temp->next;
> }
>
> destroy_list();
> return 0;
> }
>
> </snippet>
>
> Surprisingly, the objdump disassembly does not show "prefetch" insn at all.
> Am I doing something stupid here??? or is the builtin broken??
>
> Here is some more arch info:
>
> Procesor:
> ---------
> processor : 0
> vendor_id : GenuineIntel
> cpu family : 6
> model : 8
> model name : Pentium III (Coppermine)
> stepping : 10
> cpu MHz : 996.797
> cache size : 256 KB
> fdiv_bug : no
> hlt_bug : no
> f00f_bug : no
> coma_bug : no
> fpu : yes
> fpu_exception : yes
> cpuid level : 2
> wp : yes
> flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr sse
> bogomips : 1985.74
>
> Command used for compilaion:
> ----------------------------
> gcc -O2 prefetch.c -o prefetch -Wall -march=i686
>
> objdump output:
> ---------------
> 08048410 <main>:
> 8048410: 55 push %ebp
> 8048411: 89 e5 mov %esp,%ebp
> 8048413: 83 ec 08 sub $0x8,%esp
> 8048416: 83 e4 f0 and $0xfffffff0,%esp
> 8048419: c7 04 24 64 00 00 00 movl $0x64,(%esp,1)
> 8048420: e8 6b ff ff ff call 8048390 <create_list>
> 8048425: 8b 0d d8 94 04 08 mov 0x80494d8,%ecx
> 804842b: 85 c9 test %ecx,%ecx
> 804842d: 74 47 je 8048476 <main+0x66>
> 804842f: 90 nop
> 8048430: a1 dc 94 04 08 mov 0x80494dc,%eax
> 8048435: 69 c0 6d 4e c6 41 imul $0x41c64e6d,%eax,%eax
> 804843b: 05 39 30 00 00 add $0x3039,%eax
> 8048440: 89 c2 mov %eax,%edx
> 8048442: 69 c0 6d 4e c6 41 imul $0x41c64e6d,%eax,%eax
> 8048448: c1 fa 10 sar $0x10,%edx
> 804844b: 81 e2 ff 7f 00 00 and $0x7fff,%edx
> 8048451: 05 39 30 00 00 add $0x3039,%eax
> 8048456: a3 dc 94 04 08 mov %eax,0x80494dc
> 804845b: c1 f8 10 sar $0x10,%eax
> 804845e: 25 ff 7f 00 00 and $0x7fff,%eax
> 8048463: 0f af d0 imul %eax,%edx
> 8048466: 8b 41 14 mov 0x14(%ecx),%eax
> 8048469: 0f af d0 imul %eax,%edx
> 804846c: 89 51 14 mov %edx,0x14(%ecx)
> 804846f: 8b 49 18 mov 0x18(%ecx),%ecx
> 8048472: 85 c9 test %ecx,%ecx
> 8048474: 75 ba jne 8048430 <main+0x20>
> 8048476: e8 65 ff ff ff call 80483e0 <destroy_list>
> 804847b: c9 leave
> 804847c: 31 c0 xor %eax,%eax
> 804847e: c3 ret
> 804847f: 90 nop
>
>
> TIA
> -Kiran
----- End forwarded message -----