Changeset e45a3b9 in mainline
- Timestamp:
- 2009-02-17T22:42:57Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d6b8e9d8
- Parents:
- edd7aa6d
- Location:
- kernel
- Files:
-
- 1 added
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
kernel/Makefile
redd7aa6d re45a3b9 280 280 TEST_FPU1 = y 281 281 TEST_SSE1 = y 282 GENERIC_SOURCES += test/fpu/fpu1_x86.c 282 283 endif 283 284 … … 285 286 TEST_FPU1 = y 286 287 TEST_SSE1 = y 288 GENERIC_SOURCES += test/fpu/fpu1_x86.c 287 289 endif 288 290 289 291 ifeq ($(KARCH),ia64) 290 292 TEST_FPU1 = y 293 GENERIC_SOURCES += test/fpu/fpu1_ia64.c 291 294 endif 292 295 … … 296 299 endif 297 300 298 ifeq ($(TEST_FPU1),y) 299 GENERIC_SOURCES += test/fpu/fpu1.c 300 else 301 ifneq ($(TEST_FPU1),y) 301 302 GENERIC_SOURCES += test/fpu/fpu1_skip.c 302 303 endif -
kernel/test/fpu/fpu1_ia64.c
redd7aa6d re45a3b9 39 39 40 40 41 #define THREADS 42 #define ATTEMPTS 41 #define THREADS 150 42 #define ATTEMPTS 100 43 43 44 #define E_10e8 45 #define PI_10e8 31415926544 #define E_10e8 271828182 45 #define PI_10e8 3141592 46 46 47 48 #ifdef KERN_ia32_ARCH_H_ 49 static inline double sqrt(double x) 47 static inline long double sqrt(long double a) 50 48 { 51 double v;52 53 asm (54 "fsqrt\n"55 : "=t" (v)56 : "0" (x)57 );58 59 return v;60 }61 #endif62 63 #ifdef KERN_amd64_ARCH_H_64 static inline double sqrt(double x)65 {66 double v;67 68 asm (69 "fsqrt\n"70 : "=t" (v)71 : "0" (x)72 );73 74 return v;75 }76 #endif77 78 #ifdef KERN_ia64_ARCH_H_79 80 #undef PI_10e881 #define PI_10e8 314159282 83 static inline long double sqrt(long double a)84 {85 49 long double x = 1; 86 50 long double lx = 0; 87 51 88 52 if (a < 0.00000000000000001) 89 53 return 0; 90 54 91 while (x != lx) {55 while (x != lx) { 92 56 lx = x; 93 57 x = (x + (a / x)) / 2; 94 58 } 95 59 96 return x; 60 return x; 97 61 } 98 #endif99 100 62 101 63 static atomic_t threads_ok; … … 108 70 int i; 109 71 double e, d, le, f; 110 72 111 73 thread_detach(THREAD); 112 74 113 75 waitq_sleep(&can_start); 114 76 115 77 for (i = 0; i<ATTEMPTS; i++) { 116 78 le = -1; 117 79 e = 0; 118 80 f = 1; 119 81 120 82 for (d = 1; e != le; d *= f, f += 1) { 121 83 le = e; 122 84 e = e + 1 / d; 123 85 } 124 86 125 87 if ((int) (100000000 * e) != E_10e8) { 126 88 if (!sh_quiet) … … 140 102 141 103 thread_detach(THREAD); 142 104 143 105 waitq_sleep(&can_start); 144 106 145 107 for (i = 0; i < ATTEMPTS; i++) { 146 108 lpi = -1; 147 109 pi = 0; 148 110 149 111 for (n = 2, ab = sqrt(2); lpi != pi; n *= 2, ab = ad) { 150 112 double sc, cd; 151 113 152 114 sc = sqrt(1 - (ab * ab / 4)); 153 115 cd = 1 - sc; … … 156 118 pi = 2 * n * ad; 157 119 } 158 159 #ifdef KERN_ia64_ARCH_H_ 120 160 121 if ((int) (1000000 * pi) != PI_10e8) { 161 122 if (!sh_quiet) … … 164 125 break; 165 126 } 166 #else167 if ((int) (100000000 * pi) != PI_10e8) {168 if (!sh_quiet)169 printf("tid%" PRIu64 ": pi*10e8=%zd should be %" PRIun "\n", THREAD->tid, (unative_t) (100000000 * pi), (unative_t) PI_10e8);170 atomic_inc(&threads_fault);171 break;172 }173 #endif174 127 } 175 128 atomic_inc(&threads_ok); … … 180 133 unsigned int i, total = 0; 181 134 sh_quiet = quiet; 182 135 183 136 waitq_initialize(&can_start); 184 137 atomic_set(&threads_ok, 0); … … 187 140 if (!quiet) 188 141 printf("Creating %u threads... ", 2 * THREADS); 189 142 190 143 for (i = 0; i < THREADS; i++) { 191 144 thread_t *t;
Note:
See TracChangeset
for help on using the changeset viewer.