Arm
gccで渡せるArmのFPUオプション†
- crypto-neon-fp-armv8
- fp-armv8
- fpv4-sp-d16
- neon
- neon-fp-armv8
- neon-fp16
- neon-vfpv4
- vfp
- vfp3
- vfpv3
- vfpv3-d16
- vfpv3-d16-fp16
- vfpv3-fp16
- vfpv3xd
- vfpv3xd-fp16
- vfpv4
- vfpv4-d16
各FPU指定時の違い†
- predefined macroに見る、挙動の違い
fpu option | __ARM_FEATURE_CRYPTO | __ARM_FP | __ARM_NEON_FP | __ARM_NEON __ARM_NEON__ | __ARM_FEATURE_FMA __FP_FAST_FMAF | __FP_FAST_FMA __FP_FAST_FMAL |
crypto-neon-fp-armv8 | 1 | 14 | 6 | 1 | 1 | 1 |
neon | | 12 | 4 | 1 | | |
neon-fp16 | | 14 | 6 | 1 | | |
neon-vfpv4,neon-fp-armv8 | | 14 | 6 | 1 | 1 | 1 |
vfpv4, vfpv4-d16, fp-armv8 | | 14 | 6 | | 1 | 1 |
fpv4-sp-d16 | | 4 | 4 | | 1 | |
vfpv3xd,vfpv3xd-fp16 | | 4 | 4 | | | |
vfpv3-d16-fp16, vfpv3-fp16 | | 14 | 6 | | | |
vfp, vfp3, vfpv3, vfpv3-d16,"no fpu"(指定無し) | | 12 | 4 | | | |
- __ARM_FPと__ARM_NEON_FPのvalueはdecimal
gcc version†
$ gcc --version
gcc-4.8.real (Ubuntu/Linaro 4.8.4-2ubuntu1~14.04.1) 4.8.4
Copyright (C) 2013 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.
各predefined macro と arm_neon.h を比較して分かる違い†
__ARM_FP†
- 0x2 の bit が立っていれば、以下のFP 16bitを扱う命令が使える
- vcvt_f16_f32
- vcvt_f32_f16
__ARM_FEATURE_FMA†
- define されていれば、以下の4命令が使える
- vfma_f32
- vfmaq_f32
- vfms_f32
- vfmsq_f32
- VFMAはvector fused multiply accumulate、VFMSはvector fused multiply subtractの略。
- ただの乗算と加減算の場合、乗算の後でレジスタに保存するタイミングで丸め込みが発生するが、
- Fusedの場合は、丸め込まれる前に加算され、そののちに、丸め込まれる
- なので、通常の乗算と加算より、精度が保持される
__ARM_FEATURE_CRYPTO†
- defineされていれば、以下の104命令が使える
- poly64関連の命令を使うためには必須
- vsri_n_p64
- vsriq_n_p64
- vsli_n_p64
- vsliq_n_p64
- vcreate_p64
- vdup_n_p64
- vdupq_n_p64
- vdup_lane_p64
- vdupq_lane_p64
- vcombine_p64
- vget_high_p64
- vget_low_p64
- vext_p64
- vextq_p64
- vbsl_p64
- vbslq_p64
- vld1_p64
- vld1q_p64
- vld1_lane_p64
- vld1q_lane_p64
- vld1_dup_p64
- vld1q_dup_p64
- vst1_p64
- vst1q_p64
- vst1_lane_p64
- vst1q_lane_p64
- vld2_p64
- vld2_dup_p64
- vst2_p64
- vld3_p64
- vld3_dup_p64
- vst3_p64
- vld4_p64
- vld4_dup_p64
- vst4_p64
- vreinterpret_p8_p64
- vreinterpret_p16_p64
- vreinterpret_f32_p64
- vreinterpret_p64_p8
- vreinterpret_p64_p16
- vreinterpret_p64_f32
- vreinterpret_p64_s64
- vreinterpret_p64_u64
- vreinterpret_p64_s8
- vreinterpret_p64_s16
- vreinterpret_p64_s32
- vreinterpret_p64_u8
- vreinterpret_p64_u16
- vreinterpret_p64_u32
- vreinterpret_s64_p64
- vreinterpret_u64_p64
- vreinterpret_s8_p64
- vreinterpret_s16_p64
- vreinterpret_s32_p64
- vreinterpret_u8_p64
- vreinterpret_u16_p64
- vreinterpret_u32_p64
- vreinterpretq_p8_p64
- vreinterpretq_p8_p128
- vreinterpretq_p16_p64
- vreinterpretq_p16_p128
- vreinterpretq_f32_p64
- vreinterpretq_f32_p128
- vreinterpretq_p64_p8
- vreinterpretq_p64_p16
- vreinterpretq_p64_f32
- vreinterpretq_p64_p128
- vreinterpretq_p64_s64
- vreinterpretq_p64_u64
- vreinterpretq_p64_s8
- vreinterpretq_p64_s16
- vreinterpretq_p64_s32
- vreinterpretq_p64_u8
- vreinterpretq_p64_u16
- vreinterpretq_p64_u32
- vreinterpretq_p128_p8
- vreinterpretq_p128_p16
- vreinterpretq_p128_f32
- vreinterpretq_p128_p64
- vreinterpretq_p128_s64
- vreinterpretq_p128_u64
- vreinterpretq_p128_s8
- vreinterpretq_p128_s16
- vreinterpretq_p128_s32
- vreinterpretq_p128_u8
- vreinterpretq_p128_u16
- vreinterpretq_p128_u32
- vreinterpretq_s64_p64
- vreinterpretq_s64_p128
- vreinterpretq_u64_p64
- vreinterpretq_u64_p128
- vreinterpretq_s8_p64
- vreinterpretq_s8_p128
- vreinterpretq_s16_p64
- vreinterpretq_s16_p128
- vreinterpretq_s32_p64
- vreinterpretq_s32_p128
- vreinterpretq_u8_p64
- vreinterpretq_u8_p128
- vreinterpretq_u16_p64
- vreinterpretq_u16_p128
- vreinterpretq_u32_p64
- vreinterpretq_u32_p128
- vldrq_p128
__ARM_NEON__†
- defineされていれば、arm_neon.hに記述されてるSIMD命令が使える
__ARM_NEON_FP,__ARM_NEON,__FP_FAST_FMAF,__FP_FAST_FMA,__FP_FAST_FMAL†
- __ARM_NEON_FPの0x2、0x4のbitは__ARM_FPの対応するbitと共通。__ARM_FPの0x8のbitはdouble がsupportされていることを表す¬e{arm-c-language-extensions-officiial:ARM C Language Extensions, Release 1.1, 2013-11-19 更新, 2016-04-14閲覧};
- __ARM_NEONは__ARM_NEON__と共通(alias)。
- __FP_FAST_FMAFは__ARM_FEATURE_FMAのalias。C99の仕様としてFP_FAST_FMAFかFP_FAST_FMAがdefineされてることが推奨されてるので、それとの互換性のため。¬e{arm-c-language-extensions-officiial};
- __FP_FAST_FMALと__FP_FAST_FMAは共通。
命令と必要なFPU†
FP 16bit 関連のSIMD†
- crypto-neon-fp-armv8,neon-fp16,neon-vfpv4,neon-fp-armv8vfpv4,vfpv4-d16,fp-armv8,vfpv3-d16-fp16,vfpv3-fp16
Fused Mulitply関連のSIMD命令†
- crypto-neon-fp-armv8,neon-vfpv4,neon-fp-armv8,vfpv4,vfpv4-d16,fp-armv8,fpv4-sp-d16
その他のSIMD命令†
- crypto-neon-fp-armv8,neon,neon-fp16,neon-vfpv4,neon-fp-armv8