From 9a594ad6ef76d46da25ef7820451fff7907d50bf Mon Sep 17 00:00:00 2001 From: Jiong Wang Date: Mon, 25 Jul 2016 16:13:22 +0000 Subject: [PATCH] [AArch64][9/10] ARMv8.2-A FP16 three operands scalar intrinsics gcc/ * config/aarch64/aarch64-simd-builtins.def: Register new builtins. * config/aarch64/aarch64.md (fma, fnma): Support HF. * config/aarch64/arm_fp16.h (vfmah_f16, vfmsh_f16): New. From-SVN: r238724 --- gcc/ChangeLog | 6 ++++++ gcc/config/aarch64/aarch64-simd-builtins.def | 2 ++ gcc/config/aarch64/aarch64.md | 21 ++++++++++---------- gcc/config/aarch64/arm_fp16.h | 14 +++++++++++++ 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3bef6f026f6..c1da62a26fe 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-07-25 Jiong Wang + + * config/aarch64/aarch64-simd-builtins.def: Register new builtins. + * config/aarch64/aarch64.md (fma, fnma): Support HF. + * config/aarch64/arm_fp16.h (vfmah_f16, vfmsh_f16): New. + 2016-07-25 Jiong Wang * config/aarch64/aarch64-simd-builtins.def: Register new builtins. diff --git a/gcc/config/aarch64/aarch64-simd-builtins.def b/gcc/config/aarch64/aarch64-simd-builtins.def index 31abc077859..c7fe08bb21a 100644 --- a/gcc/config/aarch64/aarch64-simd-builtins.def +++ b/gcc/config/aarch64/aarch64-simd-builtins.def @@ -422,8 +422,10 @@ /* Implemented by fma4. */ BUILTIN_VHSDF (TERNOP, fma, 4) + VAR1 (TERNOP, fma, 4, hf) /* Implemented by fnma4. */ BUILTIN_VHSDF (TERNOP, fnma, 4) + VAR1 (TERNOP, fnma, 4, hf) /* Implemented by aarch64_simd_bsl. */ BUILTIN_VDQQH (BSL_P, simd_bsl, 0) diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 6d0a9dcf90c..7d8b3943100 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -4492,23 +4492,24 @@ ;; fma - no throw (define_insn "fma4" - [(set (match_operand:GPF 0 "register_operand" "=w") - (fma:GPF (match_operand:GPF 1 "register_operand" "w") - (match_operand:GPF 2 "register_operand" "w") - (match_operand:GPF 3 "register_operand" "w")))] + [(set (match_operand:GPF_F16 0 "register_operand" "=w") + (fma:GPF_F16 (match_operand:GPF_F16 1 "register_operand" "w") + (match_operand:GPF_F16 2 "register_operand" "w") + (match_operand:GPF_F16 3 "register_operand" "w")))] "TARGET_FLOAT" "fmadd\\t%0, %1, %2, %3" - [(set_attr "type" "fmac")] + [(set_attr "type" "fmac")] ) (define_insn "fnma4" - [(set (match_operand:GPF 0 "register_operand" "=w") - (fma:GPF (neg:GPF (match_operand:GPF 1 "register_operand" "w")) - (match_operand:GPF 2 "register_operand" "w") - (match_operand:GPF 3 "register_operand" "w")))] + [(set (match_operand:GPF_F16 0 "register_operand" "=w") + (fma:GPF_F16 + (neg:GPF_F16 (match_operand:GPF_F16 1 "register_operand" "w")) + (match_operand:GPF_F16 2 "register_operand" "w") + (match_operand:GPF_F16 3 "register_operand" "w")))] "TARGET_FLOAT" "fmsub\\t%0, %1, %2, %3" - [(set_attr "type" "fmac")] + [(set_attr "type" "fmac")] ) (define_insn "fms4" diff --git a/gcc/config/aarch64/arm_fp16.h b/gcc/config/aarch64/arm_fp16.h index 21edc656953..4b7c2dd3bcc 100644 --- a/gcc/config/aarch64/arm_fp16.h +++ b/gcc/config/aarch64/arm_fp16.h @@ -560,6 +560,20 @@ vsubh_f16 (float16_t __a, float16_t __b) return __a - __b; } +/* ARMv8.2-A FP16 three operands scalar intrinsics. */ + +__extension__ static __inline float16_t __attribute__ ((__always_inline__)) +vfmah_f16 (float16_t __a, float16_t __b, float16_t __c) +{ + return __builtin_aarch64_fmahf (__b, __c, __a); +} + +__extension__ static __inline float16_t __attribute__ ((__always_inline__)) +vfmsh_f16 (float16_t __a, float16_t __b, float16_t __c) +{ + return __builtin_aarch64_fnmahf (__b, __c, __a); +} + #pragma GCC pop_options #endif -- 2.30.2