1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/bench/t_t64fnc.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,537 @@
1.4 +// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// e32test\bench\t_t64fnc.cpp
1.18 +//
1.19 +//
1.20 +
1.21 +#include <e32std.h>
1.22 +#include <e32std_private.h>
1.23 +
1.24 +GLREF_D volatile TInt64 count;
1.25 +GLREF_D volatile TInt64 a, b, c;
1.26 +
1.27 +TInt TInt64Addition(TAny*)
1.28 + {
1.29 +
1.30 + TInt64 al = a;
1.31 + const TInt64 bl = b;
1.32 + const TInt64 x = 1;
1.33 + for(;;)
1.34 + {
1.35 + al +=bl;
1.36 + al +=bl;
1.37 + al +=bl;
1.38 + al +=bl;
1.39 + al +=bl;
1.40 + al +=bl;
1.41 + al +=bl;
1.42 + al +=bl;
1.43 + al +=bl;
1.44 + al +=bl;
1.45 +
1.46 + al +=bl;
1.47 + al +=bl;
1.48 + al +=bl;
1.49 + al +=bl;
1.50 + al +=bl;
1.51 + al +=bl;
1.52 + al +=bl;
1.53 + al +=bl;
1.54 + al +=bl;
1.55 + al +=bl;
1.56 +
1.57 + al +=bl;
1.58 + al +=bl;
1.59 + al +=bl;
1.60 + al +=bl;
1.61 + al +=bl;
1.62 + al +=bl;
1.63 + al +=bl;
1.64 + al +=bl;
1.65 + al +=bl;
1.66 + al +=bl;
1.67 +
1.68 + al +=bl;
1.69 + al +=bl;
1.70 + al +=bl;
1.71 + al +=bl;
1.72 + al +=bl;
1.73 + al +=bl;
1.74 + al +=bl;
1.75 + al +=bl;
1.76 + al +=bl;
1.77 + al +=bl;
1.78 +
1.79 + al +=bl;
1.80 + al +=bl;
1.81 + al +=bl;
1.82 + al +=bl;
1.83 + al +=bl;
1.84 + al +=bl;
1.85 + al +=bl;
1.86 + al +=bl;
1.87 + al +=bl;
1.88 + al +=bl;
1.89 +
1.90 + al +=bl;
1.91 + al +=bl;
1.92 + al +=bl;
1.93 + al +=bl;
1.94 + al +=bl;
1.95 + al +=bl;
1.96 + al +=bl;
1.97 + al +=bl;
1.98 + al +=bl;
1.99 + al +=bl;
1.100 +
1.101 + al +=bl;
1.102 + al +=bl;
1.103 + al +=bl;
1.104 + al +=bl;
1.105 + al +=bl;
1.106 + al +=bl;
1.107 + al +=bl;
1.108 + al +=bl;
1.109 + al +=bl;
1.110 + al +=bl;
1.111 +
1.112 + al +=bl;
1.113 + al +=bl;
1.114 + al +=bl;
1.115 + al +=bl;
1.116 + al +=bl;
1.117 + al +=bl;
1.118 + al +=bl;
1.119 + al +=bl;
1.120 + al +=bl;
1.121 + al +=bl;
1.122 +
1.123 + al +=bl;
1.124 + al +=bl;
1.125 + al +=bl;
1.126 + al +=bl;
1.127 + al +=bl;
1.128 + al +=bl;
1.129 + al +=bl;
1.130 + al +=bl;
1.131 + al +=bl;
1.132 + al +=bl;
1.133 +
1.134 + al +=bl;
1.135 + al +=bl;
1.136 + al +=bl;
1.137 + al +=bl;
1.138 + al +=bl;
1.139 + al +=bl;
1.140 + al +=bl;
1.141 + al +=bl;
1.142 + al +=bl;
1.143 + al +=bl;
1.144 +
1.145 + a = al;
1.146 + count += x;
1.147 + if (!count)
1.148 + break;
1.149 + }
1.150 + return (TInt)count;
1.151 + }
1.152 +
1.153 +TInt TInt64Subtraction(TAny*)
1.154 + {
1.155 +
1.156 + a = MAKE_TINT64(0x31514531,0x93471672u);
1.157 + b = MAKE_TINT64(0x51514531,0x33847162);
1.158 +
1.159 + TInt64 al = a;
1.160 + const TInt64 bl = b;
1.161 + const TInt64 x = 1;
1.162 + for(;;)
1.163 + {
1.164 + al -=bl;
1.165 + al -=bl;
1.166 + al -=bl;
1.167 + al -=bl;
1.168 + al -=bl;
1.169 + al -=bl;
1.170 + al -=bl;
1.171 + al -=bl;
1.172 + al -=bl;
1.173 + al -=bl;
1.174 +
1.175 + al -=bl;
1.176 + al -=bl;
1.177 + al -=bl;
1.178 + al -=bl;
1.179 + al -=bl;
1.180 + al -=bl;
1.181 + al -=bl;
1.182 + al -=bl;
1.183 + al -=bl;
1.184 + al -=bl;
1.185 +
1.186 + al -=bl;
1.187 + al -=bl;
1.188 + al -=bl;
1.189 + al -=bl;
1.190 + al -=bl;
1.191 + al -=bl;
1.192 + al -=bl;
1.193 + al -=bl;
1.194 + al -=bl;
1.195 + al -=bl;
1.196 +
1.197 + al -=bl;
1.198 + al -=bl;
1.199 + al -=bl;
1.200 + al -=bl;
1.201 + al -=bl;
1.202 + al -=bl;
1.203 + al -=bl;
1.204 + al -=bl;
1.205 + al -=bl;
1.206 + al -=bl;
1.207 +
1.208 + al -=bl;
1.209 + al -=bl;
1.210 + al -=bl;
1.211 + al -=bl;
1.212 + al -=bl;
1.213 + al -=bl;
1.214 + al -=bl;
1.215 + al -=bl;
1.216 + al -=bl;
1.217 + al -=bl;
1.218 +
1.219 + al -=bl;
1.220 + al -=bl;
1.221 + al -=bl;
1.222 + al -=bl;
1.223 + al -=bl;
1.224 + al -=bl;
1.225 + al -=bl;
1.226 + al -=bl;
1.227 + al -=bl;
1.228 + al -=bl;
1.229 +
1.230 + al -=bl;
1.231 + al -=bl;
1.232 + al -=bl;
1.233 + al -=bl;
1.234 + al -=bl;
1.235 + al -=bl;
1.236 + al -=bl;
1.237 + al -=bl;
1.238 + al -=bl;
1.239 + al -=bl;
1.240 +
1.241 + al -=bl;
1.242 + al -=bl;
1.243 + al -=bl;
1.244 + al -=bl;
1.245 + al -=bl;
1.246 + al -=bl;
1.247 + al -=bl;
1.248 + al -=bl;
1.249 + al -=bl;
1.250 + al -=bl;
1.251 +
1.252 + al -=bl;
1.253 + al -=bl;
1.254 + al -=bl;
1.255 + al -=bl;
1.256 + al -=bl;
1.257 + al -=bl;
1.258 + al -=bl;
1.259 + al -=bl;
1.260 + al -=bl;
1.261 + al -=bl;
1.262 +
1.263 + al -=bl;
1.264 + al -=bl;
1.265 + al -=bl;
1.266 + al -=bl;
1.267 + al -=bl;
1.268 + al -=bl;
1.269 + al -=bl;
1.270 + al -=bl;
1.271 + al -=bl;
1.272 + al -=bl;
1.273 +
1.274 + a = al;
1.275 + count += x;
1.276 + if (!count)
1.277 + break;
1.278 + }
1.279 + return (TInt)count;
1.280 + }
1.281 +
1.282 +
1.283 +TInt TInt64Multiplication(TAny*)
1.284 + {
1.285 + a = MAKE_TINT64(0xffffffff,0xfa0a1f00u);
1.286 + b = MAKE_TINT64(0x0,0xfa0a1f00u);
1.287 +
1.288 + TInt64 al = a;
1.289 + const TInt64 bl = b;
1.290 + const TInt64 x = 1;
1.291 +
1.292 + for(;;)
1.293 + {
1.294 + al *=bl;
1.295 + al *=bl;
1.296 + al *=bl;
1.297 + al *=bl;
1.298 + al *=bl;
1.299 + al *=bl;
1.300 + al *=bl;
1.301 + al *=bl;
1.302 + al *=bl;
1.303 + al *=bl;
1.304 +
1.305 + al *=bl;
1.306 + al *=bl;
1.307 + al *=bl;
1.308 + al *=bl;
1.309 + al *=bl;
1.310 + al *=bl;
1.311 + al *=bl;
1.312 + al *=bl;
1.313 + al *=bl;
1.314 + al *=bl;
1.315 +
1.316 + al *=bl;
1.317 + al *=bl;
1.318 + al *=bl;
1.319 + al *=bl;
1.320 + al *=bl;
1.321 + al *=bl;
1.322 + al *=bl;
1.323 + al *=bl;
1.324 + al *=bl;
1.325 + al *=bl;
1.326 +
1.327 + al *=bl;
1.328 + al *=bl;
1.329 + al *=bl;
1.330 + al *=bl;
1.331 + al *=bl;
1.332 + al *=bl;
1.333 + al *=bl;
1.334 + al *=bl;
1.335 + al *=bl;
1.336 + al *=bl;
1.337 +
1.338 + al *=bl;
1.339 + al *=bl;
1.340 + al *=bl;
1.341 + al *=bl;
1.342 + al *=bl;
1.343 + al *=bl;
1.344 + al *=bl;
1.345 + al *=bl;
1.346 + al *=bl;
1.347 + al *=bl;
1.348 +
1.349 + al *=bl;
1.350 + al *=bl;
1.351 + al *=bl;
1.352 + al *=bl;
1.353 + al *=bl;
1.354 + al *=bl;
1.355 + al *=bl;
1.356 + al *=bl;
1.357 + al *=bl;
1.358 + al *=bl;
1.359 +
1.360 + al *=bl;
1.361 + al *=bl;
1.362 + al *=bl;
1.363 + al *=bl;
1.364 + al *=bl;
1.365 + al *=bl;
1.366 + al *=bl;
1.367 + al *=bl;
1.368 + al *=bl;
1.369 + al *=bl;
1.370 +
1.371 + al *=bl;
1.372 + al *=bl;
1.373 + al *=bl;
1.374 + al *=bl;
1.375 + al *=bl;
1.376 + al *=bl;
1.377 + al *=bl;
1.378 + al *=bl;
1.379 + al *=bl;
1.380 + al *=bl;
1.381 +
1.382 + al *=bl;
1.383 + al *=bl;
1.384 + al *=bl;
1.385 + al *=bl;
1.386 + al *=bl;
1.387 + al *=bl;
1.388 + al *=bl;
1.389 + al *=bl;
1.390 + al *=bl;
1.391 + al *=bl;
1.392 +
1.393 + al *=bl;
1.394 + al *=bl;
1.395 + al *=bl;
1.396 + al *=bl;
1.397 + al *=bl;
1.398 + al *=bl;
1.399 + al *=bl;
1.400 + al *=bl;
1.401 + al *=bl;
1.402 + al *=bl;
1.403 +
1.404 + a = al;
1.405 + count += x;
1.406 + if (!count)
1.407 + break;
1.408 + }
1.409 + return (TInt)count;
1.410 + }
1.411 +
1.412 +TInt TInt64Division(TAny*)
1.413 + {
1.414 +
1.415 + a = MAKE_TINT64(0x31514531,0x93471672u);
1.416 + b = MAKE_TINT64(0x0,0x05F5E100);
1.417 +
1.418 + TInt64 al = a;
1.419 + const TInt64 bl = b;
1.420 + const TInt64 x = 1;
1.421 +
1.422 + for(;;)
1.423 + {
1.424 + al /=bl;
1.425 + al /=bl;
1.426 + al /=bl;
1.427 + al /=bl;
1.428 + al /=bl;
1.429 + al /=bl;
1.430 + al /=bl;
1.431 + al /=bl;
1.432 + al /=bl;
1.433 + al /=bl;
1.434 +
1.435 + al /=bl;
1.436 + al /=bl;
1.437 + al /=bl;
1.438 + al /=bl;
1.439 + al /=bl;
1.440 + al /=bl;
1.441 + al /=bl;
1.442 + al /=bl;
1.443 + al /=bl;
1.444 + al /=bl;
1.445 +
1.446 + al /=bl;
1.447 + al /=bl;
1.448 + al /=bl;
1.449 + al /=bl;
1.450 + al /=bl;
1.451 + al /=bl;
1.452 + al /=bl;
1.453 + al /=bl;
1.454 + al /=bl;
1.455 + al /=bl;
1.456 +
1.457 + al /=bl;
1.458 + al /=bl;
1.459 + al /=bl;
1.460 + al /=bl;
1.461 + al /=bl;
1.462 + al /=bl;
1.463 + al /=bl;
1.464 + al /=bl;
1.465 + al /=bl;
1.466 + al /=bl;
1.467 +
1.468 + al /=bl;
1.469 + al /=bl;
1.470 + al /=bl;
1.471 + al /=bl;
1.472 + al /=bl;
1.473 + al /=bl;
1.474 + al /=bl;
1.475 + al /=bl;
1.476 + al /=bl;
1.477 + al /=bl;
1.478 +
1.479 + al /=bl;
1.480 + al /=bl;
1.481 + al /=bl;
1.482 + al /=bl;
1.483 + al /=bl;
1.484 + al /=bl;
1.485 + al /=bl;
1.486 + al /=bl;
1.487 + al /=bl;
1.488 + al /=bl;
1.489 +
1.490 + al /=bl;
1.491 + al /=bl;
1.492 + al /=bl;
1.493 + al /=bl;
1.494 + al /=bl;
1.495 + al /=bl;
1.496 + al /=bl;
1.497 + al /=bl;
1.498 + al /=bl;
1.499 + al /=bl;
1.500 +
1.501 + al /=bl;
1.502 + al /=bl;
1.503 + al /=bl;
1.504 + al /=bl;
1.505 + al /=bl;
1.506 + al /=bl;
1.507 + al /=bl;
1.508 + al /=bl;
1.509 + al /=bl;
1.510 + al /=bl;
1.511 +
1.512 + al /=bl;
1.513 + al /=bl;
1.514 + al /=bl;
1.515 + al /=bl;
1.516 + al /=bl;
1.517 + al /=bl;
1.518 + al /=bl;
1.519 + al /=bl;
1.520 + al /=bl;
1.521 + al /=bl;
1.522 +
1.523 + al /=bl;
1.524 + al /=bl;
1.525 + al /=bl;
1.526 + al /=bl;
1.527 + al /=bl;
1.528 + al /=bl;
1.529 + al /=bl;
1.530 + al /=bl;
1.531 + al /=bl;
1.532 + al /=bl;
1.533 +
1.534 + a = al;
1.535 + count += x;
1.536 + if (!count)
1.537 + break;
1.538 + }
1.539 + return (TInt)count; }
1.540 +