Is arm_neon.h missing all float16_t types?
I'm using NEON SIMD instruction to write a part of an Android app, targ开发者_如何学编程eting Cortex A8 processors. According to this reference manual, NEON supports 16-bit and 32-bit floats, that is float16_t
and float32_t
. When I tried using float16_t
and all of its associated vector types, I got an error saying that this type is undeclared. When looking through contents of arm_neon.h
, I found that this type is indeed undeclared.
Is there a reason for this? ARM's Advanced SIMD obviously supports such data types and instructions. Has anyone encountered / resolved this? Is it documented anywhere?
Cortex-A8 processors do not support 16-bit floats in hardware.
Cortex-A9 processors do have instructions to convert between 16- and 32-bit floating-point, but that's all you get (and that's all that should be provided on an IEEE-754 system -- float16 is not intended for arithmetic, only for compact storage). The usage model is to load float16 data, convert it to float32 to do your arithmetic, and then convert back to float16 before storing.
Can you specify an example section in the document you linked where these 16 bit float operations are called out? I see quite a few 16 bit integer operations defined. Are you using ARM's compiler or gcc? And are you talking about SIMD or NEON?
"NEON™ technology builds on the concept of SIMD with a dedicated module to provide 128-bit wide vector operations, compared to the 32bit wide SIMD in the ARMv6 architecture."
EDIT:
I tried this with no compiler complaints:
int myfun ( int a)
{
__fp16 b;
b=a+1;
return(b+1);
}
using this command line:
arm-none-linux-gnueabi-gcc -S -mcpu=mpcore -mfp16-format=ieee -mfpu=neon-fp16 simd.c
Using codesourcery lite 2011.03
arm-none-linux-gnueabi-gcc --version
arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2011.03-41) 4.5.2
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Hmm, not too familiar with SIMD instructions. The document you posted does not mention float16_t, but instead uses the number of lanes as well (e.g. float16x4_t)
Also, did you try "Float16_t" instead of "float16_t" ?
This is my home laptop, so I don't have access to the ARM compiler, but I'll try and recheck this tomorrow in the office
精彩评论