Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] OCaml on G4
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: David Brown <caml-list@d...>
Subject: Re: [Caml-list] OCaml on G4
On Tue, Jun 22, 2004 at 11:03:21PM -0700, David McClain wrote:

> 	let vdot v1 v2 =
> 	  let rec iter sum n =
> 	    if n < 0 then sum
> 	    else
> 	      iter (sum +. Array.unsafe_get v1 n *.
> 		      Array.unsafe_get v2 n)
> 		(n-1)
> 	  in
> 	    iter 0.0 (pred len1)
> 
> generate results consistent with the use of the Fused MAC on the PPC G4 
> on the Mac OS X Panther.
> 
> Given the loose structure of this code, as written, I might have 
> expected the storage of intermediate sums to memory. But that does not 

It does store the intermediate sums to memory.  However, the single
computation of the MAC is compiled into a single fmadd instruction.  But
the value for 'sum' is stored and retrieved each iteration of the loop.

Dave

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners