Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Hui Zhu <teawater@gmail.com>
To: paawan oza <paawan1982@yahoo.com>
Cc: Michael Snyder <msnyder@vmware.com>,
	 	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: final i386.floating.record.patch
Date: Tue, 04 Aug 2009 03:20:00 -0000	[thread overview]
Message-ID: <daef60380908032019p6d103d1aq93df5db4098a15da@mail.gmail.com> (raw)
In-Reply-To: <897101.12299.qm@web112519.mail.gq1.yahoo.com>

Hi Paawan,

Thanks for your work.

I do a some test works with the test code that you sent in before.
I get the values of fp reg with command "info all-registers".

It looks like some fp reg's values not right in replay mode.

In record mode they are:
fctrl          0x37f	895
fstat          0x0	0
ftag           0xffff	65535
fiseg          0x0	0
fioff          0x0	0
---Type <return> to continue, or q <return> to quit---
foseg          0x0	0
fooff          0x0	0
fop            0x0	0

In replay mode they are:
fctrl          0x37f	895
fstat          0x6069	24681
ftag           0x557f	21887
fiseg          0x73	115
fioff          0x8048bfd	134515709
---Type <return> to continue, or q <return> to quit---
foseg          0x7b	123
fooff          0x0	0
fop            0x2e9	745



Thanks,
Hui


#include <stdio.h>
#include <math.h>
#include <stdlib.h>

/* the test intends to test following insns.
flds faddp fstps fstpl fldl fxch fabs fdivrp fmulp fsubrp fucomp fnstsw fsqrt
fchs f2xm1 fyl2x fxtract fprem1 fld fdecstp fld1 fldl2t fldl2e FLDPI
FLDLG2 FLDLN2
FLDZ fincstp ffree fptan fpatan fincstp fsincos frndint fscale fsin fcos fcmovb
fcmovbe fcmove fcmovu fcmovnb fcmovnbe fsave frstor fstsw
*/

float no1,no2,no3,no4,no5,no6,no7;
double x = 100.345, y = 25.7789;
long double ldx = 88888888888888888888.88, ldy = 9999999999999999999.99;
float result,resultd,resultld;
float *float_memory;

/* initialization of floats */
void init_floats()
{
 no1 = 10.45;
 no2 = 20.77;
 no3 = 156.89874646;
 no4 = 14.56;
 no5 = 11.11;
 no6 = 66.77;
 no7 = 88.88;
 float_memory = malloc(sizeof(float) * 4);
 *float_memory = 256.256;
 *(float_memory + 1) = 356.356;
 *(float_memory + 2) = 456.456;
 *(float_memory + 3) = 556.556;
}

/* marks FPU stack as empty */
void empty_fpu_stack()
{
 asm ("ffree %st(1) \n\t"
      "ffree %st(2) \n\t"
      "ffree %st(3) \n\t"
      "ffree %st(4) \n\t"
      "ffree %st(5) \n\t"
      "ffree %st(6) \n\t"
      "ffree %st(7)");
}

/* tests floating point arithmatic */
void test_arith_floats()
{
 result = no1 + no2 + no3 + no4 + no5 + no6 + no7;
 printf("result is %f\n",result);

 result = fmodf(no2,no1);
 printf("result is %f\n",result);

 resultd = fmod(x,y);
 printf("result is %f\n",resultd);

 resultld = fmodl(ldy,ldy);
 printf("result is %f\n",resultld);

 result = fabsf(no1);
 printf("result is %f\n",result);

 result = no3 / no4;
 printf("result is %f\n",result);

 result = no1 * no2 * no3 * no4;
 printf("result is %f\n",result);

 result = no1 - no2 - no3 - no4;
 printf("result is %f\n",result);


 asm ("fld %0" : :"m"(*float_memory));
 asm ("fchs");

 /* test for f2xm1 */
 asm ("fld %0" : :"m"(*float_memory));
 asm ("f2xm1");

 asm ("fyl2x");

 asm ("fld %0" : :"m"(*float_memory));
 asm ("fxtract");

 asm ("fld %0" : :"m"(*float_memory));
 asm ("fprem1");

 /* decrement fpu stack pointer only status register should get affected */
 asm ("fld %0" : :"m"(*float_memory));

 empty_fpu_stack();

 asm ("fld1");
 asm ("fldl2t");
 asm ("fldl2e");
 asm ("fldpi");
 asm ("fldlg2");
 asm ("fldln2");
 asm ("fldz");

 empty_fpu_stack();
 /* finishing emptying the stack */

 result = sqrt(no3);
 printf("result is %f\n",result);
}

void test_log_exp_floats()
{
 result = log10(no3);
 printf("result is %f\n",result);

 result = log(no3);
 printf("result is %f\n",result);

 result = exp10(no3);
 printf("result is %f\n",result);

 result = exp(no3);
 printf("result is %f\n",result);
}

void test_trigo_floats()
{
 result = sin(30);
 printf("result is %f\n",result);

 result = cos(30);
 printf("result is %f\n",result);

 result = tan(30);
 printf("result is %f\n",result);

 result = atan(30);
 printf("result is %f\n",result);

 asm ("fld %0" : :"m"(*float_memory));
 asm ("fptan");

 /* changes st1 and popping register stack */
 asm ("fpatan");

 asm("fincstp");
 asm ("fld %0" : :"m"(float_memory));
 asm ("fsincos");

 asm ("fld %0" : :"m"(*float_memory));
 asm ("frndint");

 asm ("fld %0" : :"m"(*float_memory));
 asm ("fld %0" : :"m"(*(float_memory+1)));
 asm ("fscale");

 empty_fpu_stack();

 asm ("fld %0" : :"m"(*float_memory));
 asm ("fsin");
 asm ("fcos");

 /* currently we assume condition likely and always record the registers
 code could be optimized only if the flag is set then record */
 asm ("fld %0" : :"m"(*float_memory));
 asm ("fld %0" : :"m"(*(float_memory+1)));
 asm ("fcmovb %st(1), %st");
 asm ("fcmovbe %st(1), %st");
 asm ("fcmove %st(1), %st");
 asm ("fcmovu %st(1), %st");
 asm ("fcmovnb %st(1), %st");
 asm ("fcmovnbe %st(1), %st");

 empty_fpu_stack();
 /* finished emtyping the stack */
}

void test_compare_floats()
{
   ldy = 88888888888888888888.88;
   if (ldx == ldy)
     ldy = 7777777777777777777777777777.777;
   else
     ldy = 666666666666666666666666666.666;
}

/* test loading and saving of FPU environment */
void test_fpu_env()
{
 asm ("fsave %0" : "=m"(*float_memory) : );
 asm ("frstor %0" : : "m"(*float_memory));
 asm ("fstsw %ax");
}

int main()
{
   init_floats();
   test_arith_floats();
   test_log_exp_floats();
   test_trigo_floats();
   test_compare_floats();
   test_fpu_env();
}




On Mon, Aug 3, 2009 at 22:56, paawan oza<paawan1982@yahoo.com> wrote:
> Hi,
>
> please find the patch attached. I have attached as per your suggestion.
> I am attaching it from opera browser.
>
> Regards,
> Oza.
>
> --- On Thu, 7/30/09, Michael Snyder <msnyder@vmware.com> wrote:
>
>> From: Michael Snyder <msnyder@vmware.com>
>> Subject: Re: final   i386.floating.record.patch
>> To: "paawan oza" <paawan1982@yahoo.com>
>> Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
>> Date: Thursday, July 30, 2009, 11:31 PM
>> paawan oza wrote:
>> > Hi,
>> >
>> > please find my answers below.
>> >
>> >  1) Are you using a Windows machine to send your
>> >  emails?  If so,
>> >  is it possible that there is a Unix/Linux
>> machine you could
>> >  try
>> >  sending from?  Your attachments look OK for
>> me, but
>> >  some people
>> >  seem to have had problems with them.
>> >
>> > Oza : I used to send all from windows till now.
>> > but this patch I sent it from Linux...from opera.
>> >   2) And are you using cut-and-paste to
>> insert the patches
>> >  into the
>> >  body of your email?  That would certainly
>> cause
>> >  problems, because
>> >  tabs might be changed into spaces (which is
>> exactly what
>> >  was
>> >  causing patch to fail for me today).
>> >  Oza: yes I am using copy-paste....I dont know
>> any-other way.
>> > because attachmenet are not welcome, so I am not sure
>> how I could proceed with this.
>>
>> It's not that attachments are not welcome.
>> There are various binary encodings for attachments, and
>> some of those binary encodings are not welcome.  I
>> think
>> because there's no open-source way of decoding them.
>>
>> If you look at the list, you'll see that attachments are
>> used a lot.
>>
>> Copy-and-paste, though, in general will not work, because
>> it
>> usually changes tabs into spaces, which ruins a patch.
>>
>>
>> > I will send you updated patch.....may be I might have
>> mistaken of old gdb file. sorry for incovenience.
>>
>> I think it was just the tabs-to-spaces issue.
>> Why don't you try sending an attachment from Opera?
>>
>>
>
>
>


  parent reply	other threads:[~2009-08-04  3:20 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-03 14:56 paawan oza
2009-08-03 20:04 ` Michael Snyder
2009-08-04  3:20 ` Hui Zhu [this message]
2009-08-04 13:03   ` paawan oza
  -- strict thread matches above, loose matches on Subject: below --
2009-08-21 16:59 paawan oza
2009-08-23  1:32 ` Hui Zhu
2009-08-23  3:00   ` Michael Snyder
2009-08-23  9:04     ` paawan oza
2009-08-23  9:29     ` paawan oza
2009-09-09  0:19 ` Michael Snyder
2009-09-10  1:13   ` paawan oza
2009-09-26  9:33   ` paawan oza
2009-12-10  7:55 ` Hui Zhu
2009-08-18 15:22 paawan oza
2009-08-19  2:17 ` Hui Zhu
2009-08-19  2:44   ` Hui Zhu
2009-08-07  7:25 paawan oza
2009-08-07 15:50 ` Hui Zhu
2009-08-16 21:41 ` Michael Snyder
2009-08-17  9:17   ` Hui Zhu
2009-08-17 16:16     ` paawan oza
2009-08-04 13:06 paawan oza
2009-08-04 13:58 ` Hui Zhu
2009-08-04 14:18   ` paawan oza
2009-08-04 14:26   ` paawan oza
2009-08-04 14:43     ` Hui Zhu
2009-08-04 17:59       ` paawan oza
2009-08-05  1:29         ` Hui Zhu
2009-08-05  1:34         ` Michael Snyder
2009-08-05 13:48           ` paawan oza
2009-07-29 18:34 paawan oza
2009-07-30  6:24 ` Michael Snyder
2009-07-30 18:09   ` paawan oza
2009-08-03 14:59   ` paawan oza
2009-08-03 20:07     ` Michael Snyder
2009-07-27  1:09 i386.record.floating.point.patch : with more testing and assurity Michael Snyder
2009-07-29 18:30 ` final i386.floating.record.patch paawan oza
2009-07-29 22:01   ` Michael Snyder
2009-07-30  0:44     ` Michael Snyder
2009-07-30 18:00       ` paawan oza
2009-07-30 21:13         ` Michael Snyder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=daef60380908032019p6d103d1aq93df5db4098a15da@mail.gmail.com \
    --to=teawater@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=msnyder@vmware.com \
    --cc=paawan1982@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox