Skip to content

Commit

Permalink
Allow for extended precision in codelets
Browse files Browse the repository at this point in the history
  • Loading branch information
matteo-frigo committed Aug 2, 2002
1 parent 2eee789 commit dfa0ebd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
7 changes: 4 additions & 3 deletions genfft/c.ml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*)
(* $Id: c.ml,v 1.11 2002-07-15 20:46:35 athena Exp $ *)
(* $Id: c.ml,v 1.12 2002-08-02 19:26:37 athena Exp $ *)

(*
* This module contains the definition of a C-like abstract
Expand All @@ -32,6 +32,7 @@ open List

let realtype = "R"
let realtypep = realtype ^ " *"
let extended_realtype = "E"
let constrealtype = "const " ^ realtype
let constrealtypep = constrealtype ^ " *"

Expand Down Expand Up @@ -134,7 +135,7 @@ and unparse_annotated force_bracket =
if (List.length l <= s) then
match l with
[] -> ""
| _ -> realtype ^ " " ^ (uvar l)
| _ -> extended_realtype ^ " " ^ (uvar l)
else
(vvar (Util.take s l)) ^ (vvar (Util.drop s l))
in vvar (List.filter Variable.is_temporary l)
Expand Down Expand Up @@ -239,7 +240,7 @@ let extract_constants f =
in let use_const () =
map
(fun n ->
Idecl (("const " ^ realtype), (Number.to_konst n),
Idecl (("const " ^ extended_realtype), (Number.to_konst n),
"K(" ^ (Number.to_string n) ^ ")"))
u
and use_compact () =
Expand Down
16 changes: 9 additions & 7 deletions kernel/ifftw.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

/* $Id: ifftw.h,v 1.66 2002-08-01 12:03:46 athena Exp $ */
/* $Id: ifftw.h,v 1.67 2002-08-02 19:26:37 athena Exp $ */

/* FFTW internal header file */
#ifndef __IFFTW_H__
Expand Down Expand Up @@ -571,27 +571,29 @@ uint X(alignment_of)(R *p);
/*-----------------------------------------------------------------------*/
/* macros used in codelets to reduce source code size */

typedef R E; /* internal precision of codelets. */

#ifdef FFTW_LDOUBLE
# define K(x) ((R) x##L)
# define K(x) ((E) x##L)
#else
# define K(x) ((R) x)
# define K(x) ((E) x)
#endif
#define DK(name, value) const R name = K(value)
#define DK(name, value) const E name = K(value)

/* FMA macros */

#if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
static __inline__ R FMA(R a, R b, R c)
static __inline__ E FMA(E a, E b, E c)
{
return a * b + c;
}

static __inline__ R FMS(R a, R b, R c)
static __inline__ E FMS(E a, E b, E c)
{
return a * b - c;
}

static __inline__ R FNMS(R a, R b, R c)
static __inline__ E FNMS(E a, E b, E c)
{
return -(a * b - c);
}
Expand Down

0 comments on commit dfa0ebd

Please sign in to comment.