os/kernelhwsrv/kerneltest/e32test/math/t_vfp.cia
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // e32test\math\t_vfp.cia
    15 // 
    16 //
    17 
    18 #include "t_vfp.h"
    19 #include <u32std.h>
    20 
    21 #define __TEST_VFPV3
    22 
    23 #define _DIE(x)	asm(".word %a0" : : "i" ((TInt)( 0xe7f000f0|((x)&0x0f)|(((x)&0xfff0)<<4) )));
    24 #define DIE		_DIE(__LINE__);
    25 
    26 /******************************************************************************
    27  * Control registers
    28  ******************************************************************************/
    29 __NAKED__ TUint32 Vfp::Fpscr()
    30 	{
    31 	VFP_FMRX(,0,VFP_XREG_FPSCR);
    32 	__JUMP(,lr);
    33 	}
    34 
    35 __NAKED__ void Vfp::SetFpscr(TUint32 /*aVal*/)
    36 	{
    37 	VFP_FMXR(,VFP_XREG_FPSCR,0);
    38 	__JUMP(,lr);
    39 	}
    40 
    41 /******************************************************************************
    42  * Single precision operations
    43  ******************************************************************************/
    44 __NAKED__ TInt32 Vfp::SRegInt(TInt /*aReg*/)
    45 	{
    46 	// fall through
    47 	}
    48 
    49 __NAKED__ TReal32 Vfp::SReg(TInt /*aReg*/)
    50 	{
    51 	asm("cmp r0, #31 ");
    52 	asm("addls pc, pc, r0, lsl #3 ");
    53 	DIE;
    54 	VFP_FMRS(CC_AL,0,0);
    55 	__JUMP(,lr);
    56 	VFP_FMRS(CC_AL,0,1);
    57 	__JUMP(,lr);
    58 	VFP_FMRS(CC_AL,0,2);
    59 	__JUMP(,lr);
    60 	VFP_FMRS(CC_AL,0,3);
    61 	__JUMP(,lr);
    62 	VFP_FMRS(CC_AL,0,4);
    63 	__JUMP(,lr);
    64 	VFP_FMRS(CC_AL,0,5);
    65 	__JUMP(,lr);
    66 	VFP_FMRS(CC_AL,0,6);
    67 	__JUMP(,lr);
    68 	VFP_FMRS(CC_AL,0,7);
    69 	__JUMP(,lr);
    70 	VFP_FMRS(CC_AL,0,8);
    71 	__JUMP(,lr);
    72 	VFP_FMRS(CC_AL,0,9);
    73 	__JUMP(,lr);
    74 	VFP_FMRS(CC_AL,0,10);
    75 	__JUMP(,lr);
    76 	VFP_FMRS(CC_AL,0,11);
    77 	__JUMP(,lr);
    78 	VFP_FMRS(CC_AL,0,12);
    79 	__JUMP(,lr);
    80 	VFP_FMRS(CC_AL,0,13);
    81 	__JUMP(,lr);
    82 	VFP_FMRS(CC_AL,0,14);
    83 	__JUMP(,lr);
    84 	VFP_FMRS(CC_AL,0,15);
    85 	__JUMP(,lr);
    86 	VFP_FMRS(CC_AL,0,16);
    87 	__JUMP(,lr);
    88 	VFP_FMRS(CC_AL,0,17);
    89 	__JUMP(,lr);
    90 	VFP_FMRS(CC_AL,0,18);
    91 	__JUMP(,lr);
    92 	VFP_FMRS(CC_AL,0,19);
    93 	__JUMP(,lr);
    94 	VFP_FMRS(CC_AL,0,20);
    95 	__JUMP(,lr);
    96 	VFP_FMRS(CC_AL,0,21);
    97 	__JUMP(,lr);
    98 	VFP_FMRS(CC_AL,0,22);
    99 	__JUMP(,lr);
   100 	VFP_FMRS(CC_AL,0,23);
   101 	__JUMP(,lr);
   102 	VFP_FMRS(CC_AL,0,24);
   103 	__JUMP(,lr);
   104 	VFP_FMRS(CC_AL,0,25);
   105 	__JUMP(,lr);
   106 	VFP_FMRS(CC_AL,0,26);
   107 	__JUMP(,lr);
   108 	VFP_FMRS(CC_AL,0,27);
   109 	__JUMP(,lr);
   110 	VFP_FMRS(CC_AL,0,28);
   111 	__JUMP(,lr);
   112 	VFP_FMRS(CC_AL,0,29);
   113 	__JUMP(,lr);
   114 	VFP_FMRS(CC_AL,0,30);
   115 	__JUMP(,lr);
   116 	VFP_FMRS(CC_AL,0,31);
   117 	__JUMP(,lr);
   118 	}
   119 
   120 __NAKED__ void Vfp::SetSReg(TInt32 /*aVal*/, TInt /*aReg*/)
   121 	{
   122 	// fall through
   123 	}
   124 
   125 __NAKED__ void Vfp::SetSReg(TReal32 /*aVal*/, TInt /*aReg*/)
   126 	{
   127 	asm("cmp r1, #31 ");
   128 	asm("addls pc, pc, r1, lsl #3 ");
   129 	DIE;
   130 	VFP_FMSR(CC_AL,0,0);
   131 	__JUMP(,lr);
   132 	VFP_FMSR(CC_AL,1,0);
   133 	__JUMP(,lr);
   134 	VFP_FMSR(CC_AL,2,0);
   135 	__JUMP(,lr);
   136 	VFP_FMSR(CC_AL,3,0);
   137 	__JUMP(,lr);
   138 	VFP_FMSR(CC_AL,4,0);
   139 	__JUMP(,lr);
   140 	VFP_FMSR(CC_AL,5,0);
   141 	__JUMP(,lr);
   142 	VFP_FMSR(CC_AL,6,0);
   143 	__JUMP(,lr);
   144 	VFP_FMSR(CC_AL,7,0);
   145 	__JUMP(,lr);
   146 	VFP_FMSR(CC_AL,8,0);
   147 	__JUMP(,lr);
   148 	VFP_FMSR(CC_AL,9,0);
   149 	__JUMP(,lr);
   150 	VFP_FMSR(CC_AL,10,0);
   151 	__JUMP(,lr);
   152 	VFP_FMSR(CC_AL,11,0);
   153 	__JUMP(,lr);
   154 	VFP_FMSR(CC_AL,12,0);
   155 	__JUMP(,lr);
   156 	VFP_FMSR(CC_AL,13,0);
   157 	__JUMP(,lr);
   158 	VFP_FMSR(CC_AL,14,0);
   159 	__JUMP(,lr);
   160 	VFP_FMSR(CC_AL,15,0);
   161 	__JUMP(,lr);
   162 	VFP_FMSR(CC_AL,16,0);
   163 	__JUMP(,lr);
   164 	VFP_FMSR(CC_AL,17,0);
   165 	__JUMP(,lr);
   166 	VFP_FMSR(CC_AL,18,0);
   167 	__JUMP(,lr);
   168 	VFP_FMSR(CC_AL,19,0);
   169 	__JUMP(,lr);
   170 	VFP_FMSR(CC_AL,20,0);
   171 	__JUMP(,lr);
   172 	VFP_FMSR(CC_AL,21,0);
   173 	__JUMP(,lr);
   174 	VFP_FMSR(CC_AL,22,0);
   175 	__JUMP(,lr);
   176 	VFP_FMSR(CC_AL,23,0);
   177 	__JUMP(,lr);
   178 	VFP_FMSR(CC_AL,24,0);
   179 	__JUMP(,lr);
   180 	VFP_FMSR(CC_AL,25,0);
   181 	__JUMP(,lr);
   182 	VFP_FMSR(CC_AL,26,0);
   183 	__JUMP(,lr);
   184 	VFP_FMSR(CC_AL,27,0);
   185 	__JUMP(,lr);
   186 	VFP_FMSR(CC_AL,28,0);
   187 	__JUMP(,lr);
   188 	VFP_FMSR(CC_AL,29,0);
   189 	__JUMP(,lr);
   190 	VFP_FMSR(CC_AL,30,0);
   191 	__JUMP(,lr);
   192 	VFP_FMSR(CC_AL,31,0);
   193 	__JUMP(,lr);
   194 	}
   195 
   196 __NAKED__ void Vfp::AbsS()
   197 	{
   198 	asm("nop ");			// so that RVCT doesn't complain about branches to non-code symbols
   199 	VFP_FABSS(CC_AL,0,1);
   200 	__JUMP(,lr);
   201 	}
   202 
   203 __NAKED__ void Vfp::AddS()
   204 	{
   205 	asm("nop ");			// so that RVCT doesn't complain about branches to non-code symbols
   206 	VFP_FADDS(CC_AL,0,1,2);
   207 	__JUMP(,lr);
   208 	}
   209 
   210 __NAKED__ void Vfp::CmpS()
   211 	{
   212 	VFP_FCMPS(CC_AL,0,1);
   213 	__JUMP(,lr);
   214 	}
   215 
   216 __NAKED__ void Vfp::CmpES()
   217 	{
   218 	VFP_FCMPES(CC_AL,0,1);
   219 	__JUMP(,lr);
   220 	}
   221 
   222 __NAKED__ void Vfp::CmpEZS()
   223 	{
   224 	VFP_FCMPEZS(CC_AL,0);
   225 	__JUMP(,lr);
   226 	}
   227 
   228 __NAKED__ void Vfp::CmpZS()
   229 	{
   230 	VFP_FCMPZS(CC_AL,0);
   231 	__JUMP(,lr);
   232 	}
   233 
   234 __NAKED__ void Vfp::Cpy0S(TInt /*aReg*/)
   235 	{
   236 	asm("cmp r0, #31 ");
   237 	asm("addls pc, pc, r0, lsl #3 ");
   238 	DIE;
   239 	VFP_FCPYS(CC_AL,0,0);
   240 	__JUMP(,lr);
   241 	VFP_FCPYS(CC_AL,0,1);
   242 	__JUMP(,lr);
   243 	VFP_FCPYS(CC_AL,0,2);
   244 	__JUMP(,lr);
   245 	VFP_FCPYS(CC_AL,0,3);
   246 	__JUMP(,lr);
   247 	VFP_FCPYS(CC_AL,0,4);
   248 	__JUMP(,lr);
   249 	VFP_FCPYS(CC_AL,0,5);
   250 	__JUMP(,lr);
   251 	VFP_FCPYS(CC_AL,0,6);
   252 	__JUMP(,lr);
   253 	VFP_FCPYS(CC_AL,0,7);
   254 	__JUMP(,lr);
   255 	VFP_FCPYS(CC_AL,0,8);
   256 	__JUMP(,lr);
   257 	VFP_FCPYS(CC_AL,0,9);
   258 	__JUMP(,lr);
   259 	VFP_FCPYS(CC_AL,0,10);
   260 	__JUMP(,lr);
   261 	VFP_FCPYS(CC_AL,0,11);
   262 	__JUMP(,lr);
   263 	VFP_FCPYS(CC_AL,0,12);
   264 	__JUMP(,lr);
   265 	VFP_FCPYS(CC_AL,0,13);
   266 	__JUMP(,lr);
   267 	VFP_FCPYS(CC_AL,0,14);
   268 	__JUMP(,lr);
   269 	VFP_FCPYS(CC_AL,0,15);
   270 	__JUMP(,lr);
   271 	VFP_FCPYS(CC_AL,0,16);
   272 	__JUMP(,lr);
   273 	VFP_FCPYS(CC_AL,0,17);
   274 	__JUMP(,lr);
   275 	VFP_FCPYS(CC_AL,0,18);
   276 	__JUMP(,lr);
   277 	VFP_FCPYS(CC_AL,0,19);
   278 	__JUMP(,lr);
   279 	VFP_FCPYS(CC_AL,0,20);
   280 	__JUMP(,lr);
   281 	VFP_FCPYS(CC_AL,0,21);
   282 	__JUMP(,lr);
   283 	VFP_FCPYS(CC_AL,0,22);
   284 	__JUMP(,lr);
   285 	VFP_FCPYS(CC_AL,0,23);
   286 	__JUMP(,lr);
   287 	VFP_FCPYS(CC_AL,0,24);
   288 	__JUMP(,lr);
   289 	VFP_FCPYS(CC_AL,0,25);
   290 	__JUMP(,lr);
   291 	VFP_FCPYS(CC_AL,0,26);
   292 	__JUMP(,lr);
   293 	VFP_FCPYS(CC_AL,0,27);
   294 	__JUMP(,lr);
   295 	VFP_FCPYS(CC_AL,0,28);
   296 	__JUMP(,lr);
   297 	VFP_FCPYS(CC_AL,0,29);
   298 	__JUMP(,lr);
   299 	VFP_FCPYS(CC_AL,0,30);
   300 	__JUMP(,lr);
   301 	VFP_FCPYS(CC_AL,0,31);
   302 	__JUMP(,lr);
   303 	}
   304 
   305 __NAKED__ void Vfp::CpyS0(TInt /*aReg*/)
   306 	{
   307 	asm("cmp r0, #31 ");
   308 	asm("addls pc, pc, r0, lsl #3 ");
   309 	DIE;
   310 	VFP_FCPYS(CC_AL,0,0);
   311 	__JUMP(,lr);
   312 	VFP_FCPYS(CC_AL,1,0);
   313 	__JUMP(,lr);
   314 	VFP_FCPYS(CC_AL,2,0);
   315 	__JUMP(,lr);
   316 	VFP_FCPYS(CC_AL,3,0);
   317 	__JUMP(,lr);
   318 	VFP_FCPYS(CC_AL,4,0);
   319 	__JUMP(,lr);
   320 	VFP_FCPYS(CC_AL,5,0);
   321 	__JUMP(,lr);
   322 	VFP_FCPYS(CC_AL,6,0);
   323 	__JUMP(,lr);
   324 	VFP_FCPYS(CC_AL,7,0);
   325 	__JUMP(,lr);
   326 	VFP_FCPYS(CC_AL,8,0);
   327 	__JUMP(,lr);
   328 	VFP_FCPYS(CC_AL,9,0);
   329 	__JUMP(,lr);
   330 	VFP_FCPYS(CC_AL,10,0);
   331 	__JUMP(,lr);
   332 	VFP_FCPYS(CC_AL,11,0);
   333 	__JUMP(,lr);
   334 	VFP_FCPYS(CC_AL,12,0);
   335 	__JUMP(,lr);
   336 	VFP_FCPYS(CC_AL,13,0);
   337 	__JUMP(,lr);
   338 	VFP_FCPYS(CC_AL,14,0);
   339 	__JUMP(,lr);
   340 	VFP_FCPYS(CC_AL,15,0);
   341 	__JUMP(,lr);
   342 	VFP_FCPYS(CC_AL,16,0);
   343 	__JUMP(,lr);
   344 	VFP_FCPYS(CC_AL,17,0);
   345 	__JUMP(,lr);
   346 	VFP_FCPYS(CC_AL,18,0);
   347 	__JUMP(,lr);
   348 	VFP_FCPYS(CC_AL,19,0);
   349 	__JUMP(,lr);
   350 	VFP_FCPYS(CC_AL,20,0);
   351 	__JUMP(,lr);
   352 	VFP_FCPYS(CC_AL,21,0);
   353 	__JUMP(,lr);
   354 	VFP_FCPYS(CC_AL,22,0);
   355 	__JUMP(,lr);
   356 	VFP_FCPYS(CC_AL,23,0);
   357 	__JUMP(,lr);
   358 	VFP_FCPYS(CC_AL,24,0);
   359 	__JUMP(,lr);
   360 	VFP_FCPYS(CC_AL,25,0);
   361 	__JUMP(,lr);
   362 	VFP_FCPYS(CC_AL,26,0);
   363 	__JUMP(,lr);
   364 	VFP_FCPYS(CC_AL,27,0);
   365 	__JUMP(,lr);
   366 	VFP_FCPYS(CC_AL,28,0);
   367 	__JUMP(,lr);
   368 	VFP_FCPYS(CC_AL,29,0);
   369 	__JUMP(,lr);
   370 	VFP_FCPYS(CC_AL,30,0);
   371 	__JUMP(,lr);
   372 	VFP_FCPYS(CC_AL,31,0);
   373 	__JUMP(,lr);
   374 	}
   375 
   376 __NAKED__ void Vfp::DivS()
   377 	{
   378 	asm("nop ");			// so that RVCT doesn't complain about branches to non-code symbols
   379 	VFP_FDIVS(CC_AL,0,1,2);
   380 	__JUMP(,lr);
   381 	}
   382 
   383 __NAKED__ void Vfp::MacS()
   384 	{
   385 	asm("nop ");			// so that RVCT doesn't complain about branches to non-code symbols
   386 	VFP_FMACS(CC_AL,0,1,2);
   387 	__JUMP(,lr);
   388 	}
   389 
   390 __NAKED__ void Vfp::MscS()
   391 	{
   392 	asm("nop ");			// so that RVCT doesn't complain about branches to non-code symbols
   393 	VFP_FMSCS(CC_AL,0,1,2);
   394 	__JUMP(,lr);
   395 	}
   396 
   397 __NAKED__ void Vfp::MulS()
   398 	{
   399 	asm("nop ");			// so that RVCT doesn't complain about branches to non-code symbols
   400 	VFP_FMULS(CC_AL,0,1,2);
   401 	__JUMP(,lr);
   402 	}
   403 
   404 __NAKED__ void Vfp::NegS()
   405 	{
   406 	asm("nop ");			// so that RVCT doesn't complain about branches to non-code symbols
   407 	VFP_FNEGS(CC_AL,0,1);
   408 	__JUMP(,lr);
   409 	}
   410 
   411 __NAKED__ void Vfp::NMacS()
   412 	{
   413 	asm("nop ");			// so that RVCT doesn't complain about branches to non-code symbols
   414 	VFP_FNMACS(CC_AL,0,1,2);
   415 	__JUMP(,lr);
   416 	}
   417 
   418 __NAKED__ void Vfp::NMscS()
   419 	{
   420 	asm("nop ");			// so that RVCT doesn't complain about branches to non-code symbols
   421 	VFP_FNMSCS(CC_AL,0,1,2);
   422 	__JUMP(,lr);
   423 	}
   424 
   425 __NAKED__ void Vfp::NMulS()
   426 	{
   427 	asm("nop ");			// so that RVCT doesn't complain about branches to non-code symbols
   428 	VFP_FNMULS(CC_AL,0,1,2);
   429 	__JUMP(,lr);
   430 	}
   431 
   432 __NAKED__ void Vfp::SqrtS()
   433 	{
   434 	asm("nop ");			// so that RVCT doesn't complain about branches to non-code symbols
   435 	VFP_FSQRTS(CC_AL,0,1);
   436 	__JUMP(,lr);
   437 	}
   438 
   439 __NAKED__ void Vfp::SubS()
   440 	{
   441 	asm("nop ");			// so that RVCT doesn't complain about branches to non-code symbols
   442 	VFP_FSUBS(CC_AL,0,1,2);
   443 	__JUMP(,lr);
   444 	}
   445 
   446 
   447 
   448 
   449 /******************************************************************************
   450  * Double precision operations
   451  ******************************************************************************/
   452 __NAKED__ TInt64 Vfp::DRegInt(TInt /*aReg*/)
   453 	{
   454 	// fall through
   455 	}
   456 
   457 __NAKED__ TReal64 Vfp::DReg(TInt /*aReg*/)
   458 	{
   459 #ifdef __TEST_VFPV3
   460 	asm("cmp r0, #31 ");
   461 #else 
   462 	asm("cmp r0, #15 ");
   463 #endif 
   464 	asm("addls r0, r0, r0, lsl #1 ");
   465 	asm("addls pc, pc, r0, lsl #2 ");
   466 	DIE;
   467 
   468 	// test 
   469 	// VFP_FLDD(CC_AL,4,5,0); 
   470 
   471 	VFP_FMRDL(CC_AL,0,0);
   472 	VFP_FMRDH(CC_AL,1,0);
   473 	asm("b 0f ");
   474 	VFP_FMRDL(CC_AL,0,1);
   475 	VFP_FMRDH(CC_AL,1,1);
   476 	asm("b 0f ");
   477 	VFP_FMRDL(CC_AL,0,2);
   478 	VFP_FMRDH(CC_AL,1,2);
   479 	asm("b 0f ");
   480 	VFP_FMRDL(CC_AL,0,3);
   481 	VFP_FMRDH(CC_AL,1,3);
   482 	asm("b 0f ");
   483 	VFP_FMRDL(CC_AL,0,4);
   484 	VFP_FMRDH(CC_AL,1,4);
   485 	asm("b 0f ");
   486 	VFP_FMRDL(CC_AL,0,5);
   487 	VFP_FMRDH(CC_AL,1,5);
   488 	asm("b 0f ");
   489 	VFP_FMRDL(CC_AL,0,6);
   490 	VFP_FMRDH(CC_AL,1,6);
   491 	asm("b 0f ");
   492 	VFP_FMRDL(CC_AL,0,7);
   493 	VFP_FMRDH(CC_AL,1,7);
   494 	asm("b 0f ");
   495 	VFP_FMRDL(CC_AL,0,8);
   496 	VFP_FMRDH(CC_AL,1,8);
   497 	asm("b 0f ");
   498 	VFP_FMRDL(CC_AL,0,9);
   499 	VFP_FMRDH(CC_AL,1,9);
   500 	asm("b 0f ");
   501 	VFP_FMRDL(CC_AL,0,10);
   502 	VFP_FMRDH(CC_AL,1,10);
   503 	asm("b 0f ");
   504 	VFP_FMRDL(CC_AL,0,11);
   505 	VFP_FMRDH(CC_AL,1,11);
   506 	asm("b 0f ");
   507 	VFP_FMRDL(CC_AL,0,12);
   508 	VFP_FMRDH(CC_AL,1,12);
   509 	asm("b 0f ");
   510 	VFP_FMRDL(CC_AL,0,13);
   511 	VFP_FMRDH(CC_AL,1,13);
   512 	asm("b 0f ");
   513 	VFP_FMRDL(CC_AL,0,14);
   514 	VFP_FMRDH(CC_AL,1,14);
   515 	asm("b 0f ");
   516 	VFP_FMRDL(CC_AL,0,15);
   517 	VFP_FMRDH(CC_AL,1,15);
   518 	asm("b 0f ");
   519 
   520 #ifdef __TEST_VFPV3
   521 	VFP_FMRDL(CC_AL,0,16);
   522 	VFP_FMRDH(CC_AL,1,16);
   523 	asm("b 0f ");
   524 	VFP_FMRDL(CC_AL,0,17);
   525 	VFP_FMRDH(CC_AL,1,17);
   526 	asm("b 0f ");
   527 	VFP_FMRDL(CC_AL,0,18);
   528 	VFP_FMRDH(CC_AL,1,18);
   529 	asm("b 0f ");
   530 	VFP_FMRDL(CC_AL,0,19);
   531 	VFP_FMRDH(CC_AL,1,19);
   532 	asm("b 0f ");
   533 	VFP_FMRDL(CC_AL,0,20);
   534 	VFP_FMRDH(CC_AL,1,20);
   535 	asm("b 0f ");
   536 	VFP_FMRDL(CC_AL,0,21);
   537 	VFP_FMRDH(CC_AL,1,21);
   538 	asm("b 0f ");
   539 	VFP_FMRDL(CC_AL,0,22);
   540 	VFP_FMRDH(CC_AL,1,22);
   541 	asm("b 0f ");
   542 	VFP_FMRDL(CC_AL,0,23);
   543 	VFP_FMRDH(CC_AL,1,23);
   544 	asm("b 0f ");
   545 	VFP_FMRDL(CC_AL,0,24);
   546 	VFP_FMRDH(CC_AL,1,24);
   547 	asm("b 0f ");
   548 	VFP_FMRDL(CC_AL,0,25);
   549 	VFP_FMRDH(CC_AL,1,25);
   550 	asm("b 0f ");
   551 	VFP_FMRDL(CC_AL,0,26);
   552 	VFP_FMRDH(CC_AL,1,26);
   553 	asm("b 0f ");
   554 	VFP_FMRDL(CC_AL,0,27);
   555 	VFP_FMRDH(CC_AL,1,27);
   556 	asm("b 0f ");
   557 	VFP_FMRDL(CC_AL,0,28);
   558 	VFP_FMRDH(CC_AL,1,28);
   559 	asm("b 0f ");
   560 	VFP_FMRDL(CC_AL,0,29);
   561 	VFP_FMRDH(CC_AL,1,29);
   562 	asm("b 0f ");
   563 	VFP_FMRDL(CC_AL,0,30);
   564 	VFP_FMRDH(CC_AL,1,30);
   565 	asm("b 0f ");
   566 	VFP_FMRDL(CC_AL,0,31);
   567 	VFP_FMRDH(CC_AL,1,31);
   568 #endif // __TEST_VFPV3
   569 
   570 	asm("0: ");
   571 #ifdef __DOUBLE_WORDS_SWAPPED__
   572 	asm("mov r2, r0 ");
   573 	asm("mov r0, r1 ");
   574 	asm("mov r1, r2 ");
   575 #endif
   576 	__JUMP(,lr);
   577 	}
   578 
   579 __NAKED__ void Vfp::SetDReg(TInt64 /*aVal*/, TInt /*aReg*/)
   580 	{
   581 	// fall through
   582 	}
   583 
   584 __NAKED__ void Vfp::SetDReg(TReal64 /*aVal*/, TInt /*aReg*/)
   585 	{
   586 #ifdef __DOUBLE_WORDS_SWAPPED__
   587 	asm("mov r3, r0 ");
   588 	asm("mov r0, r1 ");
   589 	asm("mov r1, r3 ");
   590 #endif
   591 #ifdef __TEST_VFPV3
   592 	asm("cmp r2, #31 ");
   593 #else 
   594 	asm("cmp r2, #15 ");
   595 #endif 
   596 	asm("addls r2, r2, r2, lsl #1 ");
   597 	asm("addls pc, pc, r2, lsl #2 ");
   598 	DIE;
   599 	VFP_FMDLR(CC_AL,0,0);
   600 	VFP_FMDHR(CC_AL,0,1);
   601 	__JUMP(,lr);
   602 	VFP_FMDLR(CC_AL,1,0);
   603 	VFP_FMDHR(CC_AL,1,1);
   604 	__JUMP(,lr);
   605 	VFP_FMDLR(CC_AL,2,0);
   606 	VFP_FMDHR(CC_AL,2,1);
   607 	__JUMP(,lr);
   608 	VFP_FMDLR(CC_AL,3,0);
   609 	VFP_FMDHR(CC_AL,3,1);
   610 	__JUMP(,lr);
   611 	VFP_FMDLR(CC_AL,4,0);
   612 	VFP_FMDHR(CC_AL,4,1);
   613 	__JUMP(,lr);
   614 	VFP_FMDLR(CC_AL,5,0);
   615 	VFP_FMDHR(CC_AL,5,1);
   616 	__JUMP(,lr);
   617 	VFP_FMDLR(CC_AL,6,0);
   618 	VFP_FMDHR(CC_AL,6,1);
   619 	__JUMP(,lr);
   620 	VFP_FMDLR(CC_AL,7,0);
   621 	VFP_FMDHR(CC_AL,7,1);
   622 	__JUMP(,lr);
   623 	VFP_FMDLR(CC_AL,8,0);
   624 	VFP_FMDHR(CC_AL,8,1);
   625 	__JUMP(,lr);
   626 	VFP_FMDLR(CC_AL,9,0);
   627 	VFP_FMDHR(CC_AL,9,1);
   628 	__JUMP(,lr);
   629 	VFP_FMDLR(CC_AL,10,0);
   630 	VFP_FMDHR(CC_AL,10,1);
   631 	__JUMP(,lr);
   632 	VFP_FMDLR(CC_AL,11,0);
   633 	VFP_FMDHR(CC_AL,11,1);
   634 	__JUMP(,lr);
   635 	VFP_FMDLR(CC_AL,12,0);
   636 	VFP_FMDHR(CC_AL,12,1);
   637 	__JUMP(,lr);
   638 	VFP_FMDLR(CC_AL,13,0);
   639 	VFP_FMDHR(CC_AL,13,1);
   640 	__JUMP(,lr);
   641 	VFP_FMDLR(CC_AL,14,0);
   642 	VFP_FMDHR(CC_AL,14,1);
   643 	__JUMP(,lr);
   644 	VFP_FMDLR(CC_AL,15,0);
   645 	VFP_FMDHR(CC_AL,15,1);
   646 	__JUMP(,lr);
   647 #ifdef __TEST_VFPV3
   648 	VFP_FMDLR(CC_AL,16,0);
   649 	VFP_FMDHR(CC_AL,16,1);
   650 	__JUMP(,lr);
   651 	VFP_FMDLR(CC_AL,17,0);
   652 	VFP_FMDHR(CC_AL,17,1);
   653 	__JUMP(,lr);
   654 	VFP_FMDLR(CC_AL,18,0);
   655 	VFP_FMDHR(CC_AL,18,1);
   656 	__JUMP(,lr);
   657 	VFP_FMDLR(CC_AL,19,0);
   658 	VFP_FMDHR(CC_AL,19,1);
   659 	__JUMP(,lr);
   660 	VFP_FMDLR(CC_AL,20,0);
   661 	VFP_FMDHR(CC_AL,20,1);
   662 	__JUMP(,lr);
   663 	VFP_FMDLR(CC_AL,21,0);
   664 	VFP_FMDHR(CC_AL,21,1);
   665 	__JUMP(,lr);
   666 	VFP_FMDLR(CC_AL,22,0);
   667 	VFP_FMDHR(CC_AL,22,1);
   668 	__JUMP(,lr);
   669 	VFP_FMDLR(CC_AL,23,0);
   670 	VFP_FMDHR(CC_AL,23,1);
   671 	__JUMP(,lr);
   672 	VFP_FMDLR(CC_AL,24,0);
   673 	VFP_FMDHR(CC_AL,24,1);
   674 	__JUMP(,lr);
   675 	VFP_FMDLR(CC_AL,25,0);
   676 	VFP_FMDHR(CC_AL,25,1);
   677 	__JUMP(,lr);
   678 	VFP_FMDLR(CC_AL,26,0);
   679 	VFP_FMDHR(CC_AL,26,1);
   680 	__JUMP(,lr);
   681 	VFP_FMDLR(CC_AL,27,0);
   682 	VFP_FMDHR(CC_AL,27,1);
   683 	__JUMP(,lr);
   684 	VFP_FMDLR(CC_AL,28,0);
   685 	VFP_FMDHR(CC_AL,28,1);
   686 	__JUMP(,lr);
   687 	VFP_FMDLR(CC_AL,29,0);
   688 	VFP_FMDHR(CC_AL,29,1);
   689 	__JUMP(,lr);
   690 	VFP_FMDLR(CC_AL,30,0);
   691 	VFP_FMDHR(CC_AL,30,1);
   692 	__JUMP(,lr);
   693 	VFP_FMDLR(CC_AL,31,0);
   694 	VFP_FMDHR(CC_AL,31,1);
   695 	__JUMP(,lr);
   696 #endif // __TEST_VFPV3
   697 	}
   698 
   699 __NAKED__ void Vfp::AbsD()
   700 	{
   701 	VFP_FABSD(,0,1);
   702 	__JUMP(,lr);
   703 	}
   704 
   705 __NAKED__ void Vfp::AddD()
   706 	{
   707 	VFP_FADDD(,0,1,2);
   708 	__JUMP(,lr);
   709 	}
   710 
   711 __NAKED__ void Vfp::CmpD()
   712 	{
   713 	VFP_FCMPD(,0,1);
   714 	__JUMP(,lr);
   715 	}
   716 
   717 __NAKED__ void Vfp::CmpED()
   718 	{
   719 	VFP_FCMPED(,0,1);
   720 	__JUMP(,lr);
   721 	}
   722 
   723 __NAKED__ void Vfp::CmpEZD()
   724 	{
   725 	VFP_FCMPEZD(,0);
   726 	__JUMP(,lr);
   727 	}
   728 
   729 __NAKED__ void Vfp::CmpZD()
   730 	{
   731 	VFP_FCMPZD(,0);
   732 	__JUMP(,lr);
   733 	}
   734 
   735 __NAKED__ void Vfp::Cpy0D(TInt /*aReg*/)
   736 	{
   737 	asm("cmp r0, #15 ");
   738 	asm("addls pc, pc, r0, lsl #3 ");
   739 	DIE;
   740 	VFP_FCPYD(,0,0);
   741 	__JUMP(,lr);
   742 	VFP_FCPYD(,0,1);
   743 	__JUMP(,lr);
   744 	VFP_FCPYD(,0,2);
   745 	__JUMP(,lr);
   746 	VFP_FCPYD(,0,3);
   747 	__JUMP(,lr);
   748 	VFP_FCPYD(,0,4);
   749 	__JUMP(,lr);
   750 	VFP_FCPYD(,0,5);
   751 	__JUMP(,lr);
   752 	VFP_FCPYD(,0,6);
   753 	__JUMP(,lr);
   754 	VFP_FCPYD(,0,7);
   755 	__JUMP(,lr);
   756 	VFP_FCPYD(,0,8);
   757 	__JUMP(,lr);
   758 	VFP_FCPYD(,0,9);
   759 	__JUMP(,lr);
   760 	VFP_FCPYD(,0,10);
   761 	__JUMP(,lr);
   762 	VFP_FCPYD(,0,11);
   763 	__JUMP(,lr);
   764 	VFP_FCPYD(,0,12);
   765 	__JUMP(,lr);
   766 	VFP_FCPYD(,0,13);
   767 	__JUMP(,lr);
   768 	VFP_FCPYD(,0,14);
   769 	__JUMP(,lr);
   770 	VFP_FCPYD(,0,15);
   771 	__JUMP(,lr);
   772 	}
   773 
   774 __NAKED__ void Vfp::CpyD0(TInt /*aReg*/)
   775 	{
   776 	asm("cmp r0, #15 ");
   777 	asm("addls pc, pc, r0, lsl #3 ");
   778 	DIE;
   779 	VFP_FCPYD(,0,0);
   780 	__JUMP(,lr);
   781 	VFP_FCPYD(,1,0);
   782 	__JUMP(,lr);
   783 	VFP_FCPYD(,2,0);
   784 	__JUMP(,lr);
   785 	VFP_FCPYD(,3,0);
   786 	__JUMP(,lr);
   787 	VFP_FCPYD(,4,0);
   788 	__JUMP(,lr);
   789 	VFP_FCPYD(,5,0);
   790 	__JUMP(,lr);
   791 	VFP_FCPYD(,6,0);
   792 	__JUMP(,lr);
   793 	VFP_FCPYD(,7,0);
   794 	__JUMP(,lr);
   795 	VFP_FCPYD(,8,0);
   796 	__JUMP(,lr);
   797 	VFP_FCPYD(,9,0);
   798 	__JUMP(,lr);
   799 	VFP_FCPYD(,10,0);
   800 	__JUMP(,lr);
   801 	VFP_FCPYD(,11,0);
   802 	__JUMP(,lr);
   803 	VFP_FCPYD(,12,0);
   804 	__JUMP(,lr);
   805 	VFP_FCPYD(,13,0);
   806 	__JUMP(,lr);
   807 	VFP_FCPYD(,14,0);
   808 	__JUMP(,lr);
   809 	VFP_FCPYD(,15,0);
   810 	__JUMP(,lr);
   811 	}
   812 
   813 __NAKED__ void Vfp::DivD()
   814 	{
   815 	VFP_FDIVD(,0,1,2);
   816 	__JUMP(,lr);
   817 	}
   818 
   819 __NAKED__ void Vfp::MacD()
   820 	{
   821 	VFP_FMACD(,0,1,2);
   822 	__JUMP(,lr);
   823 	}
   824 
   825 __NAKED__ void Vfp::MscD()
   826 	{
   827 	VFP_FMSCD(,0,1,2);
   828 	__JUMP(,lr);
   829 	}
   830 
   831 __NAKED__ void Vfp::MulD()
   832 	{
   833 	VFP_FMULD(,0,1,2);
   834 	__JUMP(,lr);
   835 	}
   836 
   837 __NAKED__ void Vfp::NegD()
   838 	{
   839 	VFP_FNEGD(,0,1);
   840 	__JUMP(,lr);
   841 	}
   842 
   843 __NAKED__ void Vfp::NMacD()
   844 	{
   845 	VFP_FNMACD(,0,1,2);
   846 	__JUMP(,lr);
   847 	}
   848 
   849 __NAKED__ void Vfp::NMscD()
   850 	{
   851 	VFP_FNMSCD(,0,1,2);
   852 	__JUMP(,lr);
   853 	}
   854 
   855 __NAKED__ void Vfp::NMulD()
   856 	{
   857 	VFP_FNMULD(,0,1,2);
   858 	__JUMP(,lr);
   859 	}
   860 
   861 __NAKED__ void Vfp::SqrtD()
   862 	{
   863 	VFP_FSQRTD(,0,1);
   864 	__JUMP(,lr);
   865 	}
   866 
   867 __NAKED__ void Vfp::SubD()
   868 	{
   869 	VFP_FSUBD(,0,1,2);
   870 	__JUMP(,lr);
   871 	}
   872 
   873 
   874 /******************************************************************************
   875  * Conversion operations
   876  ******************************************************************************/
   877 __NAKED__ void Vfp::CvtDS()
   878 	{
   879 	VFP_FCVTDS(CC_AL,0,2);
   880 	__JUMP(,lr);
   881 	}
   882 
   883 __NAKED__ void Vfp::CvtSD()
   884 	{
   885 	VFP_FCVTSD(CC_AL,0,1);
   886 	__JUMP(,lr);
   887 	}
   888 
   889 __NAKED__ void Vfp::SitoD()
   890 	{
   891 	VFP_FSITOD(CC_AL,0,2);
   892 	__JUMP(,lr);
   893 	}
   894 
   895 __NAKED__ void Vfp::SitoS()
   896 	{
   897 	VFP_FSITOS(CC_AL,0,2);
   898 	__JUMP(,lr);
   899 	}
   900 
   901 __NAKED__ void Vfp::TosiD()
   902 	{
   903 	VFP_FTOSID(CC_AL,0,1);
   904 	__JUMP(,lr);
   905 	}
   906 
   907 __NAKED__ void Vfp::TosiZD()
   908 	{
   909 	VFP_FTOSIZD(CC_AL,0,1);
   910 	__JUMP(,lr);
   911 	}
   912 
   913 __NAKED__ void Vfp::TosiS()
   914 	{
   915 	VFP_FTOSIS(CC_AL,0,2);
   916 	__JUMP(,lr);
   917 	}
   918 
   919 __NAKED__ void Vfp::TosiZS()
   920 	{
   921 	VFP_FTOSIZS(CC_AL,0,2);
   922 	__JUMP(,lr);
   923 	}
   924 
   925 __NAKED__ void Vfp::UitoD()
   926 	{
   927 	VFP_FUITOD(CC_AL,0,2);
   928 	__JUMP(,lr);
   929 	}
   930 
   931 __NAKED__ void Vfp::UitoS()
   932 	{
   933 	VFP_FUITOS(CC_AL,0,2);
   934 	__JUMP(,lr);
   935 	}
   936 
   937 __NAKED__ void Vfp::TouiD()
   938 	{
   939 	VFP_FTOUID(CC_AL,0,1);
   940 	__JUMP(,lr);
   941 	}
   942 
   943 __NAKED__ void Vfp::TouiZD()
   944 	{
   945 	VFP_FTOUIZD(CC_AL,0,1);
   946 	__JUMP(,lr);
   947 	}
   948 
   949 __NAKED__ void Vfp::TouiS()
   950 	{
   951 	VFP_FTOUIS(CC_AL,0,2);
   952 	__JUMP(,lr);
   953 	}
   954 
   955 __NAKED__ void Vfp::TouiZS()
   956 	{
   957 	VFP_FTOUIZS(CC_AL,0,2);
   958 	__JUMP(,lr);
   959 	}
   960 
   961 #ifdef __TEST_VFPV3
   962 __NAKED__ void Vfp::ToFixedS(TInt /*aBits*/)
   963 	{
   964 	asm("cmp r0, #15 ");
   965 	asm("addls pc, pc, r0, lsl #3 ");
   966 	DIE;
   967 	VFP_VCT_S32_F32(CC_AL,0,0);
   968 	__JUMP(,lr);
   969 	VFP_VCT_S32_F32(CC_AL,0,1);
   970 	__JUMP(,lr);
   971 	VFP_VCT_S32_F32(CC_AL,0,2);
   972 	__JUMP(,lr);
   973 	VFP_VCT_S32_F32(CC_AL,0,3);
   974 	__JUMP(,lr);
   975 	VFP_VCT_S32_F32(CC_AL,0,4);
   976 	__JUMP(,lr);
   977 	VFP_VCT_S32_F32(CC_AL,0,5);
   978 	__JUMP(,lr);
   979 	VFP_VCT_S32_F32(CC_AL,0,6);
   980 	__JUMP(,lr);
   981 	VFP_VCT_S32_F32(CC_AL,0,7);
   982 	__JUMP(,lr);
   983 	VFP_VCT_S32_F32(CC_AL,0,8);
   984 	__JUMP(,lr);
   985 	VFP_VCT_S32_F32(CC_AL,0,9);
   986 	__JUMP(,lr);
   987 	VFP_VCT_S32_F32(CC_AL,0,10);
   988 	__JUMP(,lr);
   989 	VFP_VCT_S32_F32(CC_AL,0,11);
   990 	__JUMP(,lr);
   991 	VFP_VCT_S32_F32(CC_AL,0,12);
   992 	__JUMP(,lr);
   993 	VFP_VCT_S32_F32(CC_AL,0,13);
   994 	__JUMP(,lr);
   995 	VFP_VCT_S32_F32(CC_AL,0,14);
   996 	__JUMP(,lr);
   997 	VFP_VCT_S32_F32(CC_AL,0,15);
   998 	__JUMP(,lr);
   999 	}
  1000 
  1001 __NAKED__ void Vfp::FromFixedS(TInt /*aBits*/)
  1002 	{
  1003 	asm("cmp r0, #15 ");
  1004 	asm("addls pc, pc, r0, lsl #3 ");
  1005 	DIE;
  1006 	VFP_VCT_F32_S32(CC_AL,0,0);
  1007 	__JUMP(,lr);
  1008 	VFP_VCT_F32_S32(CC_AL,0,1);
  1009 	__JUMP(,lr);
  1010 	VFP_VCT_F32_S32(CC_AL,0,2);
  1011 	__JUMP(,lr);
  1012 	VFP_VCT_F32_S32(CC_AL,0,3);
  1013 	__JUMP(,lr);
  1014 	VFP_VCT_F32_S32(CC_AL,0,4);
  1015 	__JUMP(,lr);
  1016 	VFP_VCT_F32_S32(CC_AL,0,5);
  1017 	__JUMP(,lr);
  1018 	VFP_VCT_F32_S32(CC_AL,0,6);
  1019 	__JUMP(,lr);
  1020 	VFP_VCT_F32_S32(CC_AL,0,7);
  1021 	__JUMP(,lr);
  1022 	VFP_VCT_F32_S32(CC_AL,0,8);
  1023 	__JUMP(,lr);
  1024 	VFP_VCT_F32_S32(CC_AL,0,9);
  1025 	__JUMP(,lr);
  1026 	VFP_VCT_F32_S32(CC_AL,0,10);
  1027 	__JUMP(,lr);
  1028 	VFP_VCT_F32_S32(CC_AL,0,11);
  1029 	__JUMP(,lr);
  1030 	VFP_VCT_F32_S32(CC_AL,0,12);
  1031 	__JUMP(,lr);
  1032 	VFP_VCT_F32_S32(CC_AL,0,13);
  1033 	__JUMP(,lr);
  1034 	VFP_VCT_F32_S32(CC_AL,0,14);
  1035 	__JUMP(,lr);
  1036 	VFP_VCT_F32_S32(CC_AL,0,15);
  1037 	__JUMP(,lr);
  1038 	}
  1039 
  1040 
  1041 // S0=2
  1042 __NAKED__ void Vfp::TconstS2()
  1043 	{
  1044 	asm("nop "); 
  1045 	VFP_VMOV_IMM(CC_AL,0,0,0);
  1046 	__JUMP(,lr);
  1047 	} 
  1048 
  1049 // D0=2
  1050 __NAKED__ void Vfp::TconstD2()
  1051 	{ 
  1052 	asm("nop ");
  1053 	VFP_VMOV_IMM(CC_AL,1,0,0);
  1054 	__JUMP(,lr);
  1055 	} 
  1056 
  1057 // S0=2.875
  1058 __NAKED__ void Vfp::TconstS2_8()
  1059 	{ 
  1060 	asm("nop ");
  1061 	VFP_VMOV_IMM(CC_AL,0,0,0x7);
  1062 	__JUMP(,lr);
  1063 	} 
  1064 
  1065 // D0=2.875
  1066 __NAKED__ void Vfp::TconstD2_8()
  1067 	{ 
  1068 	asm("nop ");
  1069 	VFP_VMOV_IMM(CC_AL,1,0,0x7);
  1070 	__JUMP(,lr);
  1071 	} 
  1072 
  1073 
  1074 
  1075 // Neon test instructions
  1076 
  1077 __NAKED__ TInt NeonWithF2(TAny*)
  1078 	{
  1079 	asm("nop ");
  1080 	// VEXT.8 D0, D1, D2, #3
  1081 	asm(".word 0xF2B10302 ");
  1082 	asm("mov r0, #0 ");
  1083 	__JUMP(,lr);
  1084 	}
  1085 
  1086 __NAKED__ TInt NeonWithF3(TAny*)
  1087 	{
  1088 	asm("nop ");
  1089 	// VDUP.8 D0, D1[2]
  1090 	asm(".word 0xF3B50C01 ");
  1091 	asm("mov r0, #0 ");
  1092 	__JUMP(,lr);
  1093 	}
  1094 
  1095 __NAKED__ TInt NeonWithF4x(TAny*)
  1096 	{
  1097 	asm("adr r2, 1f ");
  1098 	// VLD1.8 {D0[1]}, r2
  1099 	asm(".word 0xF4E2002F ");
  1100 	asm("mov r0, #0 ");
  1101 	__JUMP(,lr);
  1102 	asm("1: ");
  1103 	asm(".word 0x12345678" );
  1104 	}
  1105 
  1106 __NAKED__ TInt ThumbMode(TAny*)
  1107 	{
  1108 #if defined(__SUPPORT_THUMB_INTERWORKING)
  1109 	asm("adr r2, 1f "); // Store a test value address
  1110 
  1111 	asm("mov r1, #1 "); // r1 = 1
  1112 	asm("add r1, r0, lsl #3 "); // Add the arg * 8 to r1
  1113 
  1114 	asm("mov r0, #0 "); // Store a return value of KErrNone
  1115 
  1116 	asm("add r1, pc, r1 "); // Add pc to get jump destination
  1117 	asm("bx r1 "); // Switch to thumb mode
  1118 
  1119 	asm(".code 16 ");
  1120 	// Thumb mode so halfwords reversed
  1121 	asm(".word 0x0A10EC41 "); // VMOV S0, S1, r0, r1
  1122 	asm("bx lr ");
  1123 	asm("nop ");
  1124 	asm(".word 0x0B00ED12 "); // VLDR D0, [r2]
  1125 	asm("bx lr ");
  1126 	asm("nop ");
  1127 	asm(".word 0x8A00EE30 "); // VADD.32 S0, S0, S0
  1128 	asm("bx lr ");
  1129 	asm("nop ");
  1130 	asm(".word 0x0302EFB1 "); // VEXT.8 D0, D1, D2, #3
  1131 	asm("bx lr ");
  1132 	asm("nop ");
  1133 	asm(".word 0x002FF9E2 "); // VLD1.8 {D0[1]}, r2
  1134 	asm("bx lr ");
  1135 	asm("nop ");
  1136 	asm(".word 0x0C01FFB5 "); // VDUP.8 D0, D1[2]
  1137 	asm("bx lr ");
  1138 	asm("nop ");
  1139 #endif
  1140 	asm("mov r0, #1 "); // Change ret to "done"
  1141 	__JUMP(,lr);
  1142 
  1143 	asm(".code 32 ");
  1144 	asm("1: ");
  1145 	asm(".word 0x12345678" );
  1146 	}
  1147 
  1148 #endif // __TEST_VFPV3