/[qemu]/qemu/tests/test-i386.c
ViewVC logotype

Diff of /qemu/tests/test-i386.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.19 by bellard, Thu May 29 20:06:57 2003 UTC revision 1.20 by bellard, Sun Jun 15 19:36:33 2003 UTC
# Line 527  void test_fcvt(double a) Line 527  void test_fcvt(double a)
527  {  {
528      float fa;      float fa;
529      long double la;      long double la;
530        int16_t fpuc;
531        int i;
532        int64_t lla;
533        int ia;
534        int16_t wa;
535        double ra;
536    
537      fa = a;      fa = a;
538      la = a;      la = a;
# Line 535  void test_fcvt(double a) Line 541  void test_fcvt(double a)
541      printf("a=%016Lx\n", *(long long *)&a);      printf("a=%016Lx\n", *(long long *)&a);
542      printf("la=%016Lx %04x\n", *(long long *)&la,      printf("la=%016Lx %04x\n", *(long long *)&la,
543             *(unsigned short *)((char *)(&la) + 8));             *(unsigned short *)((char *)(&la) + 8));
544      printf("a=%f floor(a)=%f\n", a, floor(a));  
545      printf("a=%f ceil(a)=%f\n", a, ceil(a));      /* test all roundings */
546      printf("a=%f rint(a)=%f\n", a, rint(a));      asm volatile ("fstcw %0" : "=m" (fpuc));
547        for(i=0;i<4;i++) {
548            asm volatile ("fldcw %0" : : "m" ((fpuc & ~0x0c00) | (i << 10)));
549            asm volatile ("fist %0" : "=m" (wa) : "t" (a));
550            asm volatile ("fistl %0" : "=m" (ia) : "t" (a));
551            asm volatile ("fistpll %0" : "=m" (lla) : "t" (a) : "st");
552            asm volatile ("frndint ; fstl %0" : "=m" (ra) : "t" (a));
553            asm volatile ("fldcw %0" : : "m" (fpuc));
554            printf("(short)a = %d\n", wa);
555            printf("(int)a = %d\n", ia);
556            printf("(int64_t)a = %Ld\n", lla);
557            printf("rint(a) = %f\n", ra);
558        }
559  }  }
560    
561  #define TEST(N) \  #define TEST(N) \
# Line 625  void test_floats(void) Line 643  void test_floats(void)
643      test_fcmp(2, -1);      test_fcmp(2, -1);
644      test_fcmp(2, 2);      test_fcmp(2, 2);
645      test_fcmp(2, 3);      test_fcmp(2, 3);
646        test_fcvt(0.5);
647        test_fcvt(-0.5);
648      test_fcvt(1.0/7.0);      test_fcvt(1.0/7.0);
649      test_fcvt(-1.0/9.0);      test_fcvt(-1.0/9.0);
650      test_fcvt(1e30);      test_fcvt(32768);
651        test_fcvt(-1e20);
652      test_fconst();      test_fconst();
653      test_fbcd(1234567890123456);      test_fbcd(1234567890123456);
654      test_fbcd(-123451234567890);      test_fbcd(-123451234567890);

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26