Hi,

I am working on Windows Mobile Pocket PC 5.0 Emulator.I am working
on Visual Studio 2005 .

We are converting inline assembly to separate assembly functions and
meanwhile we encountered an exception at SMULWB instruction.

I got information from internet that WindowsCE doesnt support ARMv5
instructions only ARMv4.Is this true ?

I found that there are ARM DSP-enhanced Intrinsic Functions like
_SmulAddWLo_SW_SL are available.

1) But when i use the function in .c files,its building fine but
while running in emulator throwing the following error

Undefined Instruction: Thread=97529938 Proc=814c6e30 'mp3_encoder.exe'
AKY=00002001 PC=00056800(mp3_encoder.exe+0x00046800)
RA=00056860(mp3_encoder.exe+0x00046860) BVA=1c17f6fc FSR=00000405
Unhandled exception at 0x00056800 in mp3_encoder.exe: 0xC000001D:
Illegal Instruction.
The program '[57b4bc2a] mp3_encoder.exe' has exited with code 1067
(0x42b).

2) But when i use the function in .asm or .s files,its throwing
linker error like " Unresolved external Symbol"
what might be the problem ?


3) But when CLZ (which is a ARMv5 instruction) is replaced with
_CountLeadingZeros intrinsic in assembly file(.s and .asm ),its
building and running fine.

i havenot seen anywhere any discussion regarding the topic in the
internet. Hope experts can help me ?

If nobody has faced the situation,hope Microsoft guys will look into
this topic as the subject hasnot been addressed till now.

Thanking you

Re: ARM DSP Instructions in Windows Mobile 5.0 by Silver

Silver
Wed Mar 12 18:38:02 CDT 2008

> I got information from internet that WindowsCE doesnt support ARMv5
> instructions only ARMv4.Is this true ?
No. In the C/C++ properties for your project on the advanced tab simply
select Armv5.

Illegal instruction exception is thrown by the CPU - the CPU does not
support the instruction that you gave it. In this case the emulator does not
support the instruction. The OS behaves correctly and halts the execution.

In intrinsic function means that the functionality has some special
optimisation in the compiler - often utilizing underlying hardware. The
compiler will not genereate these special cases if it does not know about
the hardware, such as a DSP co-proc. However, CLZ should be used if it is
available (and supported). For example, if you set the ARMv5 arch then CLZ
will be used when you call the _CountLeadingZeros intrinsic.


Unresolved external symbol means the the compiler cannot find the symbol -
fairly straightforward really. Ensure you link correctly and that the
declaration is correct, e.g. extern "C" might be needed.


Geoff
--



Re: ARM DSP Instructions in Windows Mobile 5.0 by sonuthomas

sonuthomas
Wed Mar 12 22:40:49 CDT 2008

On Mar 13, 4:38=A0am, "Silver" <moc.liamtoh@gnirrevliseht> wrote:
> > =A0I got information from internet that WindowsCE doesnt support ARMv5
> > instructions only ARMv4.Is this true ?
>
> No. In the C/C++ properties for your project on the advanced tab simply
> select Armv5.
>
> Illegal instruction exception is thrown by the CPU - the CPU does not
> support the instruction that you gave it. In this case the emulator does n=
ot
> support the instruction. The OS behaves correctly and halts the execution.=

>
> In intrinsic function means that the functionality has some special
> optimisation in the compiler - often utilizing underlying hardware. The
> compiler will not genereate these special cases if it does not know about
> the hardware, such as a DSP co-proc. However, CLZ should be used if it is
> available (and supported). =A0For example, if you set the ARMv5 arch then =
CLZ
> will be used when you call the _CountLeadingZeros intrinsic.
>
> Unresolved external symbol means the the compiler cannot find the symbol -=

> fairly straightforward really. Ensure you link correctly and that the
> declaration is correct, e.g. extern "C" might be needed.
>
> Geoff
> --

Thanks for your quick reply...

But i selected ARMv5 in the C/C++ properties but still its
throwing the same exception in the emulator.Is it something with the
emulator ?

Unresolved external symbol error is coming when i am using the
intrinsic in the assembly function,in assembly how can i specify
extern "C" ?
I am using IMPORT functionname.

If WindowsCE doesnt support ARMv5 instruction,CLZ and all
_SmulAddWLo_SW_SL functions belong to ARMv5.Then how can these
intrinsics work ?


Re: ARM DSP Instructions in Windows Mobile 5.0 by Silver

Silver
Thu Mar 13 12:09:24 CDT 2008

The toolchain does support ARMv5 instructions, select ARMv5 - they will be
generated.

The *EMULATOR* does not support the instruction CLZ, hence it throws an
exception. You are using an ARMv4 emulator.

Intrinsics work by either using the CPU help directly, or by inserting code
that does the same thing.
so for these
http://msdn2.microsoft.com/en-us/library/ms253986.aspx
if they are present on the CPU then the CPU instruction will be used,
otherwise they will be functionas.

Why are you trying to use an intrinsic in assembler? You already have full
control.

Geoff
--




Re: ARM DSP Instructions in Windows Mobile 5.0 by James

James
Sun Mar 23 21:14:40 CDT 2008

As silver said, for an intrinsic the compiler has 2 options:
1) Expand the intrinsic to instrucitons inline.

or

2) Do a function call (if available)

In general there's really no need to use intrinsics from an asm file.

"Silver" <moc.liamtoh@gnirrevliseht> wrote in message
news:eQ5PE0ShIHA.4196@TK2MSFTNGP04.phx.gbl...
> The toolchain does support ARMv5 instructions, select ARMv5 - they will be
> generated.
>
> The *EMULATOR* does not support the instruction CLZ, hence it throws an
> exception. You are using an ARMv4 emulator.
>
> Intrinsics work by either using the CPU help directly, or by inserting
> code that does the same thing.
> so for these
> http://msdn2.microsoft.com/en-us/library/ms253986.aspx
> if they are present on the CPU then the CPU instruction will be used,
> otherwise they will be functionas.
>
> Why are you trying to use an intrinsic in assembler? You already have full
> control.
>
> Geoff
> --
>
>
>