Commit fd76ed5c authored by Tomoaki Teshima's avatar Tomoaki Teshima

fix to support wider compiler

  * check compiler more strictly
  * use gcc version of fp16 conversion if it's possible (gcc 4.7 and later)
  * use current SW implementation in other cases
parent 6f6eebbc
...@@ -4356,7 +4356,7 @@ struct Cvt_SIMD<float, int> ...@@ -4356,7 +4356,7 @@ struct Cvt_SIMD<float, int>
#endif #endif
#if !(defined (__arm__) || defined (__aarch64__)) #if !( ( defined (__arm__) || defined (__aarch64__) ) && ( defined (__GNUC__) && ( ( ( 4 <= __GNUC__ ) && ( 7 <= __GNUC__ ) ) || ( 5 <= __GNUC__ ) ) ) )
// const numbers for floating points format // const numbers for floating points format
const unsigned int kShiftSignificand = 13; const unsigned int kShiftSignificand = 13;
const unsigned int kMaskFp16Significand = 0x3ff; const unsigned int kMaskFp16Significand = 0x3ff;
...@@ -4379,7 +4379,7 @@ union fp32Int32 ...@@ -4379,7 +4379,7 @@ union fp32Int32
union fp16Int16 union fp16Int16
{ {
short i; short i;
#if defined (__arm__) || defined (__aarch64__) #if ( defined (__arm__) || defined (__aarch64__) ) && ( defined (__GNUC__) && ( ( ( 4 <= __GNUC__ ) && ( 7 <= __GNUC__ ) ) || ( 5 <= __GNUC__ ) ) )
__fp16 h; __fp16 h;
#endif #endif
struct _fp16Format struct _fp16Format
...@@ -4390,7 +4390,7 @@ union fp16Int16 ...@@ -4390,7 +4390,7 @@ union fp16Int16
} fmt; } fmt;
}; };
#if defined (__arm__) || defined (__aarch64__) #if ( defined (__arm__) || defined (__aarch64__) ) && ( defined (__GNUC__) && ( ( ( 4 <= __GNUC__ ) && ( 7 <= __GNUC__ ) ) || ( 5 <= __GNUC__ ) ) )
static float convertFp16SW(short fp16) static float convertFp16SW(short fp16)
{ {
// Fp16 -> Fp32 // Fp16 -> Fp32
...@@ -4452,7 +4452,7 @@ static float convertFp16SW(short fp16) ...@@ -4452,7 +4452,7 @@ static float convertFp16SW(short fp16)
} }
#endif #endif
#if defined (__arm__) || defined (__aarch64__) #if ( defined (__arm__) || defined (__aarch64__) ) && ( defined (__GNUC__) && ( ( ( 4 <= __GNUC__ ) && ( 7 <= __GNUC__ ) ) || ( 5 <= __GNUC__ ) ) )
static short convertFp16SW(float fp32) static short convertFp16SW(float fp32)
{ {
// Fp32 -> Fp16 // Fp32 -> Fp16
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment