This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch -- Floating point conversions


Hi,

The following patch adds floating point conversions between
single and double precision to the cgen-fpu code.

Ok to commit?

Dave
2000-03-23  Dave Brolley  <brolley@redhat.com>

	* cgen-fpu.h: Rename extsfdf to fextsfdf. Rename truncdfsf to
	ftruncdfsf.
	* cgen-accfp.c (fextsfdf): New function.
	(ftruncdfsf): New function.
	(cgen_init_accurate_fpu): Initialize fextsfdf and ftruncdfsf.

Index: cgen-accfp.c
===================================================================
RCS file: /cvs/src/src/sim/common/cgen-accfp.c,v
retrieving revision 1.1.1.4
diff -c -p -r1.1.1.4 cgen-accfp.c
*** cgen-accfp.c	1999/12/07 03:56:36	1.1.1.4
--- cgen-accfp.c	2000/03/23 23:12:36
*************** gesf (CGEN_FPU* fpu, SF x, SF y)
*** 284,289 ****
--- 284,313 ----
    return sim_fpu_is_ge (&op1, &op2);
  }
  
+ static DF
+ fextsfdf (CGEN_FPU* fpu, SF x)
+ {
+   sim_fpu op1;
+   unsigned64 res;
+ 
+   sim_fpu_32to (&op1, x);
+   sim_fpu_to64 (&res, &op1);
+ 
+   return res;
+ }
+ 
+ static SF
+ ftruncdfsf (CGEN_FPU* fpu, DF x)
+ {
+   sim_fpu op1;
+   unsigned32 res;
+ 
+   sim_fpu_64to (&op1, x);
+   sim_fpu_to32 (&res, &op1);
+ 
+   return res;
+ }
+ 
  static SF
  floatsisf (CGEN_FPU* fpu, SI x)
  {
*************** cgen_init_accurate_fpu (SIM_CPU* cpu, CG
*** 671,676 ****
--- 695,702 ----
    o->ledf = ledf;
    o->gtdf = gtdf;
    o->gedf = gedf;
+   o->fextsfdf = fextsfdf;
+   o->ftruncdfsf = ftruncdfsf;
    o->floatsisf = floatsisf;
    o->floatsidf = floatsidf;
    o->ufloatsisf = ufloatsisf;
Index: cgen-fpu.h
===================================================================
RCS file: /cvs/src/src/sim/common/cgen-fpu.h,v
retrieving revision 1.1.1.1
diff -c -p -r1.1.1.1 cgen-fpu.h
*** cgen-fpu.h	1999/07/06 00:58:41	1.1.1.1
--- cgen-fpu.h	2000/03/23 23:12:36
*************** struct cgen_fp_ops {
*** 100,107 ****
  
    /* SF/DF conversion ops */
  
!   DF (*extsfdf) (CGEN_FPU*, SF);
!   SF (*truncdfsf) (CGEN_FPU*, DF);
  
    SF (*floatsisf) (CGEN_FPU*, SI);
    SF (*floatdisf) (CGEN_FPU*, DI);
--- 100,107 ----
  
    /* SF/DF conversion ops */
  
!   DF (*fextsfdf) (CGEN_FPU*, SF);
!   SF (*ftruncdfsf) (CGEN_FPU*, DF);
  
    SF (*floatsisf) (CGEN_FPU*, SI);
    SF (*floatdisf) (CGEN_FPU*, DI);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]