https://gcc.gnu.org/g:6bf0cc78f6b4efdc098c3dfd0d826886cb575df5
commit 6bf0cc78f6b4efdc098c3dfd0d826886cb575df5 Author: Michael Meissner <[email protected]> Date: Thu Jun 18 22:45:42 2026 -0400 Revert changes Diff: --- gcc/config.gcc | 19 - gcc/config/rs6000/altivec.md | 34 +- gcc/config/rs6000/constraints.md | 5 - gcc/config/rs6000/float16.cc | 335 ------- gcc/config/rs6000/float16.md | 1289 ------------------------- gcc/config/rs6000/predicates.md | 154 --- gcc/config/rs6000/rs6000-builtin.cc | 21 - gcc/config/rs6000/rs6000-c.cc | 12 - gcc/config/rs6000/rs6000-call.cc | 40 - gcc/config/rs6000/rs6000-cpus.def | 13 +- gcc/config/rs6000/rs6000-modes.def | 9 - gcc/config/rs6000/rs6000-p8swap.cc | 14 +- gcc/config/rs6000/rs6000-protos.h | 16 - gcc/config/rs6000/rs6000.cc | 272 +----- gcc/config/rs6000/rs6000.h | 22 - gcc/config/rs6000/rs6000.md | 23 +- gcc/config/rs6000/rs6000.opt | 4 - gcc/config/rs6000/t-rs6000 | 4 - gcc/config/rs6000/vector.md | 37 +- gcc/config/rs6000/vsx.md | 163 ++-- gcc/doc/invoke.texi | 24 +- gcc/testsuite/gcc.target/powerpc/bfloat16-1.c | 34 - gcc/testsuite/gcc.target/powerpc/bfloat16-2.c | 72 -- gcc/testsuite/gcc.target/powerpc/float16-1.c | 34 - gcc/testsuite/gcc.target/powerpc/float16-2.c | 73 -- gcc/testsuite/lib/target-supports.exp | 138 --- libgcc/config.host | 4 - libgcc/config/rs6000/sfp-machine.h | 48 - libgcc/config/rs6000/t-float16 | 61 -- libgcc/configure | 23 - libgcc/configure.ac | 11 - 31 files changed, 110 insertions(+), 2898 deletions(-) diff --git a/gcc/config.gcc b/gcc/config.gcc index c20d7ba37caa..fabd5f75f965 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -541,7 +541,6 @@ powerpc*-*-*) extra_objs="rs6000-string.o rs6000-p8swap.o rs6000-logue.o" extra_objs="${extra_objs} rs6000-call.o rs6000-pcrel-opt.o" extra_objs="${extra_objs} rs6000-builtins.o rs6000-builtin.o" - extra_objs="${extra_objs} float16.o" extra_headers="ppc-asm.h altivec.h htmintrin.h htmxlintrin.h" extra_headers="${extra_headers} bmi2intrin.h bmiintrin.h" extra_headers="${extra_headers} xmmintrin.h mm_malloc.h emmintrin.h" @@ -5927,24 +5926,6 @@ case "${target}" in elif test x$with_long_double_format = xibm; then tm_defines="${tm_defines} TARGET_IEEEQUAD_DEFAULT=0" fi - - # Test if we should enable 16-bit floating point on the platforms - # where we can support __bfloat16 and _Float16. - if test x$with_powerpc_float16 = xyes; then - tm_defines="${tm_defines} POWERPC_FLOAT16_DEFAULT=1" - - elif test x$with_powerpc_16bit_floating_point = xyes; then - tm_defines="${tm_defines} POWERPC_FLOAT16_DEFAULT=0" - fi - - # Test if we should disable the warning about passing - # and returning 16-bit floating point values. - if test x$with_powerpc_float16_disable_warning = xyes; then - tm_defines="${tm_defines} POWERPC_FLOAT16_DISABLE_WARNING=1" - - elif test x$with_powerpc_float16_disable_warning = xno; then - tm_defines="${tm_defines} POWERPC_FLOAT16_DISABLE_WARNING=0" - fi ;; s390*-*-*) diff --git a/gcc/config/rs6000/altivec.md b/gcc/config/rs6000/altivec.md index 8b7dc7fd8243..129f56245cd0 100644 --- a/gcc/config/rs6000/altivec.md +++ b/gcc/config/rs6000/altivec.md @@ -191,8 +191,6 @@ ;; otherwise handled by altivec (v2df, v2di, ti) (define_mode_iterator VM [V4SI V8HI - V8BF - V8HF V16QI V4SF V2DF @@ -205,8 +203,6 @@ ;; Like VM, except don't do TImode (define_mode_iterator VM2 [V4SI V8HI - V8BF - V8HF V16QI V4SF V2DF @@ -226,38 +222,18 @@ V1TI TI]) -(define_mode_attr VI_char [(V2DI "d") - (V4SI "w") - (V8HI "h") - (V8BF "h") - (V8HF "h") - (V16QI "b")]) -(define_mode_attr VI_scalar [(V2DI "DI") - (V4SI "SI") - (V8HI "HI") - (V8BF "BF") - (V8HF "HF") - (V16QI "QI")]) +(define_mode_attr VI_char [(V2DI "d") (V4SI "w") (V8HI "h") (V16QI "b")]) +(define_mode_attr VI_scalar [(V2DI "DI") (V4SI "SI") (V8HI "HI") (V16QI "QI")]) (define_mode_attr VI_unit [(V16QI "VECTOR_UNIT_ALTIVEC_P (V16QImode)") (V8HI "VECTOR_UNIT_ALTIVEC_P (V8HImode)") - (V8BF "VECTOR_UNIT_ALTIVEC_P (V8BFmode)") - (V8HF "VECTOR_UNIT_ALTIVEC_P (V8HFmode)") (V4SI "VECTOR_UNIT_ALTIVEC_P (V4SImode)") (V2DI "VECTOR_UNIT_P8_VECTOR_P (V2DImode)")]) ;; Vector pack/unpack (define_mode_iterator VP [V2DI V4SI V8HI]) -(define_mode_attr VP_small [(V2DI "V4SI") - (V4SI "V8HI") - (V8HI "V16QI")]) -(define_mode_attr VP_small_lc [(V2DI "v4si") - (V4SI "v8hi") - (V8HI "v16qi")]) -(define_mode_attr VU_char [(V2DI "w") - (V4SI "h") - (V8HI "b") - (V8BF "b") - (V8HF "b")]) +(define_mode_attr VP_small [(V2DI "V4SI") (V4SI "V8HI") (V8HI "V16QI")]) +(define_mode_attr VP_small_lc [(V2DI "v4si") (V4SI "v8hi") (V8HI "v16qi")]) +(define_mode_attr VU_char [(V2DI "w") (V4SI "h") (V8HI "b")]) ;; Vector negate (define_mode_iterator VNEG [V4SI V2DI]) diff --git a/gcc/config/rs6000/constraints.md b/gcc/config/rs6000/constraints.md index 9b4f2c4ae16f..d0ed47faab84 100644 --- a/gcc/config/rs6000/constraints.md +++ b/gcc/config/rs6000/constraints.md @@ -219,11 +219,6 @@ "An IEEE 128-bit constant that can be loaded into VSX registers." (match_operand 0 "easy_vector_constant_ieee128")) -;; A negative 0 constant -(define_constraint "eZ" - "A floating point -0.0 constant." - (match_operand 0 "minus_zero_constant")) - ;; Floating-point constraints. These two are defined so that insn ;; length attributes can be calculated exactly. diff --git a/gcc/config/rs6000/float16.cc b/gcc/config/rs6000/float16.cc deleted file mode 100644 index 2c7b6278a16a..000000000000 --- a/gcc/config/rs6000/float16.cc +++ /dev/null @@ -1,335 +0,0 @@ -/* Subroutines for the C front end on the PowerPC architecture. - Copyright (C) 2002-2025 Free Software Foundation, Inc. - - Contributed by Zack Weinberg <[email protected]> - and Paolo Bonzini <[email protected]> - - This file is part of GCC. - - GCC is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. - - GCC is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with GCC; see the file COPYING3. If not see - <http://www.gnu.org/licenses/>. */ - -/* 16-bit floating point support. */ - -#include "config.h" -#include "system.h" -#include "coretypes.h" -#include "backend.h" -#include "rtl.h" -#include "tree.h" -#include "memmodel.h" -#include "tm_p.h" -#include "stringpool.h" -#include "expmed.h" -#include "optabs.h" -#include "regs.h" -#include "insn-attr.h" -#include "flags.h" -#include "attribs.h" -#include "explow.h" -#include "expr.h" -#include "common/common-target.h" -#include "rs6000-internal.h" - -/* Expand a 16-bit vector operation: - - ICODE: Operation to perform. - RESULT: Result of the operation. - OP1: Input operand1. - OP2: Input operand2. - OP3: Input operand3 or NULL_RTX. - SUBTYPE: Describe the operation. */ - -void -fp16_vectorization (enum rtx_code icode, - rtx result, - rtx op1, - rtx op2, - rtx op3, - enum fp16_operation subtype) -{ - gcc_assert (can_create_pseudo_p ()); - - machine_mode result_mode = GET_MODE (result); - rtx op_orig[3] = { op1, op2, op3 }; - rtx op_hi[3]; - rtx op_lo[3]; - rtx result_hi; - rtx result_lo; - size_t n_opts; - - switch (subtype) - { - case FP16_BINARY: - n_opts = 2; - break; - - case FP16_FMA: - case FP16_FMS: - case FP16_NFMA: - case FP16_NFMS: - n_opts = 3; - break; - - default: - gcc_unreachable (); - } - - /* Allocate 2 temporaries for the results and the input operands. */ - result_hi = gen_reg_rtx (V4SFmode); - result_lo = gen_reg_rtx (V4SFmode); - - for (size_t i = 0; i < n_opts; i++) - { - gcc_assert (op_orig[i] != NULL_RTX); - op_hi[i] = gen_reg_rtx (V4SFmode); /* high register. */ - op_lo[i] = gen_reg_rtx (V4SFmode); /* low register. */ - - rtx interleave_hi = gen_reg_rtx (result_mode); - rtx interleave_lo = gen_reg_rtx (result_mode); - rtx orig = op_orig[i]; - - rs6000_expand_interleave (interleave_hi, orig, orig, !BYTES_BIG_ENDIAN); - rs6000_expand_interleave (interleave_lo, orig, orig, BYTES_BIG_ENDIAN); - - if (result_mode == V8HFmode) - { - emit_insn (gen_xvcvhpsp_v8hf (op_hi[i], interleave_hi)); - emit_insn (gen_xvcvhpsp_v8hf (op_lo[i], interleave_lo)); - } - - else if (result_mode == V8BFmode) - { - emit_insn (gen_xvcvbf16spn_v8bf (op_hi[i], interleave_hi)); - emit_insn (gen_xvcvbf16spn_v8bf (op_lo[i], interleave_lo)); - } - - else - gcc_unreachable (); - } - - /* Do 2 sets of V4SFmode operations. */ - switch (subtype) - { - case FP16_BINARY: - emit_insn (gen_rtx_SET (result_hi, - gen_rtx_fmt_ee (icode, V4SFmode, - op_hi[0], - op_hi[1]))); - - emit_insn (gen_rtx_SET (result_lo, - gen_rtx_fmt_ee (icode, V4SFmode, - op_lo[0], - op_lo[1]))); - break; - - case FP16_FMA: - case FP16_FMS: - case FP16_NFMA: - case FP16_NFMS: - { - rtx op1_hi = op_hi[0]; - rtx op2_hi = op_hi[1]; - rtx op3_hi = op_hi[2]; - - rtx op1_lo = op_lo[0]; - rtx op2_lo = op_lo[1]; - rtx op3_lo = op_lo[2]; - - if (subtype == FP16_FMS || subtype == FP16_NFMS) - { - op3_hi = gen_rtx_NEG (V4SFmode, op3_hi); - op3_lo = gen_rtx_NEG (V4SFmode, op3_lo); - } - - rtx op_fma_hi = gen_rtx_FMA (V4SFmode, op1_hi, op2_hi, op3_hi); - rtx op_fma_lo = gen_rtx_FMA (V4SFmode, op1_lo, op2_lo, op3_lo); - - if (subtype == FP16_NFMA || subtype == FP16_NFMS) - { - op_fma_hi = gen_rtx_NEG (V4SFmode, op_fma_hi); - op_fma_lo = gen_rtx_NEG (V4SFmode, op_fma_lo); - } - - emit_insn (gen_rtx_SET (result_hi, op_fma_hi)); - emit_insn (gen_rtx_SET (result_lo, op_fma_lo)); - } - break; - - default: - gcc_unreachable (); - } - - /* Combine the 2 V4SFmode operations into one V8HFmode/V8BFmode vector. */ - if (result_mode == V8HFmode) - emit_insn (gen_vec_pack_trunc_v4sf_v8hf (result, result_hi, result_lo)); - - else if (result_mode == V8BFmode) - emit_insn (gen_vec_pack_trunc_v4sf_v8bf (result, result_hi, result_lo)); - - else - gcc_unreachable (); - - return; -} - -/* Expand a bfloat16 scalar floating point operation: - - ICODE: Operation to perform. - RESULT: Result of the operation. - OP1: Input operand1. - OP2: Input operand2. - OP3: Input operand3 or NULL_RTX. - SUBTYPE: Describe the operation. - - The operation is done as a V4SFmode vector operation. This is because - converting BFmode from a scalar BFmode to SFmode to do the operation and - back again takes quite a bit of time. GCC will only generate the native - operation if -Ofast is used. The float16.md code that calls this function - adds various combine operations to do the operation in V4SFmode instead of - SFmode. */ - -void -bfloat16_operation_as_v4sf (enum rtx_code icode, - rtx result, - rtx op1, - rtx op2, - rtx op3, - enum fp16_operation subtype) -{ - gcc_assert (can_create_pseudo_p ()); - - rtx result_v4sf = gen_reg_rtx (V4SFmode); - rtx ops_orig[3] = { op1, op2, op3 }; - rtx ops_v4sf[3]; - size_t n_opts; - - switch (subtype) - { - case FP16_BINARY: - n_opts = 2; - gcc_assert (op3 == NULL_RTX); - break; - - case FP16_FMA: - case FP16_FMS: - case FP16_NFMA: - case FP16_NFMS: - gcc_assert (icode == FMA); - n_opts = 3; - break; - - default: - gcc_unreachable (); - } - - for (size_t i = 0; i < n_opts; i++) - { - rtx op = ops_orig[i]; - rtx tmp = ops_v4sf[i] = gen_reg_rtx (V4SFmode); - - gcc_assert (op != NULL_RTX); - - /* Remove truncation/extend added. */ - if (GET_CODE (op) == FLOAT_EXTEND || GET_CODE (op) == FLOAT_TRUNCATE) - op = XEXP (op, 0); - - /* Convert operands to V4SFmode format. We use SPLAT for registers to - get the value into the upper 32-bits. We can use XXSPLTW to splat - words instead of VSPLTIH since the XVCVBF16SPN instruction ignores the - odd half-words, and XXSPLTW can operate on all VSX registers instead - of just the Altivec registers. Using SPLAT instead of a shift also - insure that other bits are not a signalling NaN. If we are using - XXSPLTIW or XXSPLTIB to load the constant the other bits are - duplicated. */ - - if (op == CONST0_RTX (SFmode) || op == CONST0_RTX (BFmode)) - emit_move_insn (tmp, CONST0_RTX (V4SFmode)); - - else if (GET_MODE (op) == BFmode) - { - emit_insn (gen_xxspltw_bf (tmp, force_reg (BFmode, op))); - emit_insn (gen_xvcvbf16spn_bf (tmp, tmp)); - } - - else if (GET_MODE (op) == SFmode) - { - if (GET_CODE (op) == CONST_DOUBLE) - { - rtvec v = rtvec_alloc (4); - - for (size_t i = 0; i < 4; i++) - RTVEC_ELT (v, i) = op; - - emit_insn (gen_rtx_SET (tmp, - gen_rtx_CONST_VECTOR (V4SFmode, v))); - } - - else - emit_insn (gen_vsx_splat_v4sf (tmp, - force_reg (SFmode, op))); - } - - else - gcc_unreachable (); - } - - /* Do the operation in V4SFmode. */ - switch (subtype) - { - case FP16_BINARY: - emit_insn (gen_rtx_SET (result_v4sf, - gen_rtx_fmt_ee (icode, V4SFmode, - ops_v4sf[0], - ops_v4sf[1]))); - break; - - case FP16_FMA: - case FP16_FMS: - case FP16_NFMA: - case FP16_NFMS: - { - rtx op1 = ops_v4sf[0]; - rtx op2 = ops_v4sf[1]; - rtx op3 = ops_v4sf[2]; - - if (subtype == FP16_FMS || subtype == FP16_NFMS) - op3 = gen_rtx_NEG (V4SFmode, op3); - - rtx op_fma = gen_rtx_FMA (V4SFmode, op1, op2, op3); - - if (subtype == FP16_NFMA || subtype == FP16_NFMS) - op_fma = gen_rtx_NEG (V4SFmode, op_fma); - - emit_insn (gen_rtx_SET (result_v4sf, op_fma)); - } - break; - - default: - gcc_unreachable (); - } - - /* Convert V4SF result back to scalar mode. */ - if (GET_MODE (result) == BFmode) - emit_insn (gen_xvcvspbf16_bf (result, result_v4sf)); - - else if (GET_MODE (result) == SFmode) - { - rtx element = GEN_INT (WORDS_BIG_ENDIAN ? 2 : 3); - emit_insn (gen_vsx_extract_v4sf (result, result_v4sf, element)); - } - - else - gcc_unreachable (); -} diff --git a/gcc/config/rs6000/float16.md b/gcc/config/rs6000/float16.md deleted file mode 100644 index 35495ae553fa..000000000000 --- a/gcc/config/rs6000/float16.md +++ /dev/null @@ -1,1289 +0,0 @@ -;; Machine description for IBM RISC System 6000 (POWER) for GNU C compiler -;; Copyright (C) 1990-2025 Free Software Foundation, Inc. -;; Contributed by Richard Kenner ([email protected]) - -;; This file is part of GCC. - -;; GCC is free software; you can redistribute it and/or modify it -;; under the terms of the GNU General Public License as published -;; by the Free Software Foundation; either version 3, or (at your -;; option) any later version. - -;; GCC is distributed in the hope that it will be useful, but WITHOUT -;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -;; License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GCC; see the file COPYING3. If not see -;; <http://www.gnu.org/licenses/>. - -;; Support for _Float16 (HFmode) and __bfloat16 (BFmode) - -;; Mode iterator for 16-bit floating point modes both as a scalar and -;; as a vector. -(define_mode_iterator FP16 [BF HF]) -(define_mode_iterator VS_FP16 [BF HF V8BF V8HF]) -(define_mode_iterator VFP16 [V8BF V8HF]) - -;; Mode iterator for 16-bit floating point modes on machines with -;; hardware support both as a scalar and as a vector. -(define_mode_iterator FP16_HW [(BF "TARGET_BFLOAT16_HW") - (HF "TARGET_FLOAT16_HW")]) - -(define_mode_iterator VFP16_HW [(V8BF "TARGET_BFLOAT16_HW") - (V8HF "TARGET_FLOAT16_HW")]) - -;; Mode iterator for floating point modes other than SF/DFmode that we -;; convert to/from _Float16 (HFmode) via DFmode. -(define_mode_iterator fp16_float_convert [TF KF IF SD DD TD]) - -;; Mode attribute giving the instruction to convert the even -;; V8HFmode or V8BFmode elements to V4SFmode -(define_mode_attr cvt_fp16_to_v4sf_insn [(BF "xvcvbf16spn") - (HF "xvcvhpsp") - (V8BF "xvcvbf16spn") - (V8HF "xvcvhpsp")]) - -;; Mode attribute giving the vector mode for a 16-bit floating point -;; scalar in both upper and lower case. -(define_mode_attr FP16_VECTOR8 [(BF "V8BF") - (HF "V8HF")]) - -(define_mode_attr fp16_vector8 [(BF "v8bf") - (HF "v8hf")]) - -;; Mode attribute giving the vector mode with 4 16-bit floating point -;; elements given a scalar or 8 element vector. -(define_mode_attr FP16_VECTOR4 [(BF "V4BF") - (HF "V4HF") - (V8BF "V4BF") - (V8HF "V4HF")]) - -;; Binary operators for bfloat16/float16 vectorization. -(define_code_iterator FP16_BINARY_OP [plus minus mult smax smin]) - -;; Standard names for the unary/binary/ternary operators -(define_code_attr fp16_names [(abs "abs") - (fma "fma") - (plus "add") - (minus "sub") - (mult "mul") - (neg "neg") - (smax "smax") - (smin "smin")]) - -;; UNSPEC constants -(define_c_enum "unspec" - [UNSPEC_BF_SHIFT_LEFT_16BIT - UNSPEC_XXSPLTW_FP16 - UNSPEC_XVCVSPBF16_BF - UNSPEC_XVCVSPHP_V8HF - UNSPEC_XVCVSPBF16_V8BF - UNSPEC_CVT_FP16_TO_V4SF]) - -;; _Float16 and __bfloat16 moves -(define_expand "mov<mode>" - [(set (match_operand:FP16 0 "nonimmediate_operand") - (match_operand:FP16 1 "any_operand"))] - "TARGET_FLOAT16" -{ - if (MEM_P (operands[0]) && !REG_P (operands[1])) - operands[1] = force_reg (<MODE>mode, operands[1]); -}) - -;; On power10, we can load up HFmode and BFmode constants with xxspltiw -;; or pli. -(define_insn "*mov<mode>_xxspltiw" - [(set (match_operand:FP16 0 "gpc_reg_operand" "=wa,wa,?r,?r") - (match_operand:FP16 1 "fp16_xxspltiw_constant" "j,eP,j, eP"))] - "TARGET_FLOAT16 - && (TARGET_PREFIXED || operands[1] == CONST0_RTX (<MODE>mode))" -{ - rtx op1 = operands[1]; - const REAL_VALUE_TYPE *rtype = CONST_DOUBLE_REAL_VALUE (op1); - long real_words[1]; - - if (op1 == CONST0_RTX (<MODE>mode)) - return (!vsx_register_operand (operands[0], <MODE>mode) - ? "li %0,0" - : "xxlxor %x0,%x0,%x0"); - - real_to_target (real_words, rtype, <MODE>mode); - operands[2] = GEN_INT (real_words[0]); - return (vsx_register_operand (operands[0], <MODE>mode) - ? "xxspltiw %x0,%2" - : "li %0,%2"); -} - [(set_attr "type" "veclogical, vecsimple, *, *") - (set_attr "prefixed" "no, yes, no, yes")]) - -;; Handle creating -0.0 if we don't have XXSPLTIW. For the scalar -;; modes, we can't do the gen_lowpart call until after register -;; allocation. -(define_split - [(set (match_operand:VS_FP16 0 "altivec_register_operand") - (match_operand:VS_FP16 1 "minus_zero_constant"))] - "TARGET_FLOAT16 && reload_completed" - [(const_int 0)] -{ - int dest_r = reg_or_subregno (operands[0]); - rtx dest = gen_rtx_REG (V8HImode, dest_r); - size_t nunits = GET_MODE_NUNITS (V8HFmode); - - rtvec v = rtvec_alloc (nunits); - for (size_t i = 0; i < nunits; i++) - RTVEC_ELT (v, i) = constm1_rtx; - - rs6000_expand_vector_init (dest, gen_rtx_PARALLEL (V8HImode, v)); - emit_insn (gen_rtx_SET (dest, gen_rtx_ASHIFT (V8HImode, dest, dest))); - DONE; -}) - - -(define_insn "*mov<mode>_internal" - [(set (match_operand:FP16 0 "nonimmediate_operand" - "=wa, wa, Z, r, r, - m, r, wa, wa, r, - v") - - (match_operand:FP16 1 "any_operand" - "wa, Z, wa, r, m, - r, wa, r, j, j, - eZ"))] - "TARGET_FLOAT16 - && (gpc_reg_operand (operands[0], <MODE>mode) - || gpc_reg_operand (operands[1], <MODE>mode))" - "@ - xxlor %x0,%x1,%x1 - lxsihzx %x0,%y1 - stxsihx %x1,%y0 - mr %0,%1 - lhz%U1%X1 %0,%1 - sth%U0%X0 %1,%0 - mfvsrwz %0,%x1 - mtvsrwz %x0,%1 - xxlxor %x0,%x0,%x0 - li %0,0 - #" - [(set_attr "type" "vecsimple, fpload, fpstore, *, load, - store, mtvsr, mfvsr, veclogical, *, - vecperm") - (set_attr "isa" "*, p9v, p9v, *, *, - *, p8v, p8v, p9v, *, - *") - (set_attr "length" "*, *, *, *, *, - *, *, *, *, *, - 8")]) - -;; Vector duplicate -(define_insn "*vecdup<mode>_reg" - [(set (match_operand:<FP16_VECTOR8> 0 "altivec_register_operand" "=v") - (vec_duplicate:<FP16_VECTOR8> - (match_operand:FP16 1 "altivec_register_operand" "v")))] - "TARGET_FLOAT16" - "vsplth %0,%1,3" - [(set_attr "type" "vecperm")]) - -(define_insn "*vecdup<mode>_const" - [(set (match_operand:<FP16_VECTOR8> 0 "vsx_register_operand" "=wa,wa") - (vec_duplicate:<FP16_VECTOR8> - (match_operand:FP16 1 "fp16_xxspltiw_constant" "j,eP")))] - "TARGET_FLOAT16 - && (TARGET_PREFIXED || operands[1] == CONST0_RTX (<MODE>mode))" -{ - rtx op1 = operands[1]; - if (op1 == CONST0_RTX (<MODE>mode)) - return "xxlxor %x0,%x0,%x0"; - - const REAL_VALUE_TYPE *rtype = CONST_DOUBLE_REAL_VALUE (op1); - long real_words[1]; - - real_to_target (real_words, rtype, <MODE>mode); - operands[2] = GEN_INT (real_words[0]); - return "xxspltiw %x0,2"; -} - [(set_attr "type" "veclogical,vecperm") - (set_attr "prefixed" "*,yes")]) - -;; Convert IEEE 16-bit floating point to/from other floating point modes. - -(define_insn "extendhf<mode>2" - [(set (match_operand:SFDF 0 "vsx_register_operand" "=wa") - (float_extend:SFDF - (match_operand:HF 1 "vsx_register_operand" "wa")))] - "TARGET_FLOAT16_HW" - "xscvhpdp %x0,%x1" - [(set_attr "type" "fpsimple")]) - -(define_insn "trunc<mode>hf2" - [(set (match_operand:HF 0 "vsx_register_operand" "=wa") - (float_truncate:HF - (match_operand:SFDF 1 "vsx_register_operand" "wa")))] - "TARGET_FLOAT16_HW" - "xscvdphp %x0,%x1" - [(set_attr "type" "fpsimple")]) - -;; Convert BFmode to SFmode/DFmode. -;; 3 instructions are generated: -;; XXSPLTW -- duplicate BFmode into all even elements -;; XVCVBF16SPN -- convert even BFmode elements to SFmode -;; XSCVSPNDP -- convert memory format of SFmode to DFmode. -(define_insn_and_split "extendbf<mode>2" - [(set (match_operand:SFDF 0 "vsx_register_operand" "=wa") - (float_extend:SFDF - (match_operand:BF 1 "vsx_register_operand" "v"))) - (clobber (match_scratch:V4SF 2 "=wa"))] - "TARGET_BFLOAT16_HW" - "#" - "&& 1" - [(pc)] -{ - rtx op0 = operands[0]; - rtx op1 = operands[1]; - rtx op2 = operands[2]; - - if (GET_CODE (op2) == SCRATCH) - op2 = gen_reg_rtx (V4SFmode); - - /* XXSPLTW -- duplicate BFmode element into all of the even elements. We - can use splat words because we won't be using the odd elements */ - emit_insn (gen_xxspltw_bf (op2, op1)); - - /* XVCVBF16SPN -- convert even V8BFmode elements to V4SFmode. */ - rtx op2_v8bf = gen_lowpart (V8BFmode, op2); - emit_insn (gen_cvt_fp16_to_v4sf_v8bf (op2, op2_v8bf)); - - /* XSCVSPNDP -- convert single V4SFmode element to DFmode. */ - emit_insn (GET_MODE (op0) == SFmode - ? gen_xscvspdpn_sf (op0, op2) - : gen_vsx_xscvspdpn (op0, op2)); - - DONE; -} - [(set_attr "type" "fpsimple") - (set_attr "length" "12")]) - -;; Convert a SFmode scalar represented as DFmode to elements 0 and 1 of -;; V4SFmode. -(define_insn "xscvdpspn_sf" - [(set (match_operand:V4SF 0 "vsx_register_operand" "=wa") - (unspec:V4SF [(match_operand:SF 1 "vsx_register_operand" "wa")] - UNSPEC_VSX_CVSPDP))] - "VECTOR_UNIT_VSX_P (SFmode)" - "xscvdpspn %x0,%x1" - [(set_attr "type" "fp")]) - -;; Convert element 0 of a V4SFmode to scalar SFmode (which on the -;; PowerPC uses the DFmode encoding). -(define_insn "xscvspdpn_sf" - [(set (match_operand:SF 0 "vsx_register_operand" "=wa") - (unspec:SF [(match_operand:V4SF 1 "vsx_register_operand" "wa")] - UNSPEC_VSX_CVSPDPN))] - "TARGET_XSCVSPDPN" - "xscvspdpn %x0,%x1" - [(set_attr "type" "fp")]) - -;; Optimize storing the conversion of BFmode to SFmode by shifting the -;; BFmode left 16 bits. -(define_insn_and_split "*convert_bf_to_sf_store" - [(set (match_operand:SF 0 "memory_operand" "=m") - (float_extend:SF - (match_operand:BF 1 "int_reg_operand" "r"))) - (clobber (match_scratch:SF 2 "=r"))] - "TARGET_FLOAT16" - "#" - "&& 1" - [(set (match_dup 2) - (unspec:SF [(match_dup 1)] UNSPEC_BF_SHIFT_LEFT_16BIT)) - (set (match_dup 0) - (match_dup 2))] -{ - if (GET_CODE (operands[2]) == SCRATCH) - operands[2] = gen_reg_rtx (SFmode); -} - [(set_attr "length" "8") - (set_attr "type" "store")]) - -;; Shfit a BFmode left 16 bits getting a SFmode memory value in the GPR -(define_insn "*shift_bf_16bits" - [(set (match_operand:SF 0 "int_reg_operand" "=r") - (unspec:SF - [(match_operand:BF 1 "int_reg_operand" "r")] - UNSPEC_BF_SHIFT_LEFT_16BIT))] - "TARGET_FLOAT16" - "slwi %0,%1,16" - [(set_attr "type" "shift")]) - -;; Convert SFmode/DFmode to BFmode. -;; 2 instructions are generated: -;; XSCVDPSPN -- convert SFmode/DFmode scalar to V4SFmode -;; XVCVSPBF16 -- convert V4SFmode to even V8BFmode - -(define_insn_and_split "trunc<mode>bf2" - [(set (match_operand:BF 0 "vsx_register_operand" "=wa") - (float_truncate:BF - (match_operand:SFDF 1 "vsx_register_operand" "wa"))) - (clobber (match_scratch:V4SF 2 "=wa"))] - "TARGET_BFLOAT16_HW" - "#" - "&& 1" - [(pc)] -{ - rtx op0 = operands[0]; - rtx op1 = operands[1]; - rtx op2 = operands[2]; - - if (GET_CODE (op2) == SCRATCH) - op2 = gen_reg_rtx (V4SFmode); - - emit_insn (GET_MODE (op1) == SFmode - ? gen_xscvdpspn_sf (op2, op1) - : gen_vsx_xscvdpspn (op2, op1)); - - emit_insn (gen_xvcvspbf16_bf (op0, op2)); - DONE; -} - [(set_attr "type" "fpsimple")]) - -(define_insn "vsx_xscvdpspn_sf" - [(set (match_operand:V4SF 0 "vsx_register_operand" "=wa") - (unspec:V4SF [(match_operand:SF 1 "vsx_register_operand" "wa")] - UNSPEC_VSX_CVDPSPN))] - "TARGET_XSCVDPSPN" - "xscvdpspn %x0,%x1" - [(set_attr "type" "fp")]) - -;; Convert HFmode to BFmode -(define_insn_and_split "trunchfbf2" - [(set (match_operand:BF 0 "vsx_register_operand" "=wa") - (float_truncate:BF - (match_operand:HF 1 "vsx_register_operand" "wa")))] - "TARGET_BFLOAT16_HW" - "#" - "&& can_create_pseudo_p ()" - [(pc)] -{ - rtx tmp = gen_reg_rtx (DFmode); - - emit_insn (gen_extendhfdf2 (tmp, operands[1])); - emit_insn (gen_truncdfbf2 (operands[0], tmp)); - DONE; -}) - -;; Convert BFmode to HFmode -(define_insn_and_split "expandbfhf2" - [(set (match_operand:HF 0 "vsx_register_operand" "=wa") - (float_extend:HF - (match_operand:BF 1 "vsx_register_operand" "wa")))] - "TARGET_BFLOAT16_HW" - "#" - "&& can_create_pseudo_p ()" - [(pc)] -{ - rtx tmp = gen_reg_rtx (DFmode); - - emit_insn (gen_extendbfdf2 (tmp, operands[1])); - emit_insn (gen_truncdfhf2 (operands[0], tmp)); - DONE; -}) - - -;; Convert the even elements of a vector 16-bit floating point to -;; V4SFmode. Deal with little endian vs. big endian element ordering -;; in identifying which elements are converted. - -(define_expand "cvt_fp16_to_v4sf_<mode>" - [(set (match_operand:V4SF 0 "vsx_register_operand") - (float_extend:V4SF - (vec_select:<FP16_VECTOR4> - (match_operand:VFP16_HW 1 "vsx_register_operand") - (parallel [(match_dup 2) - (match_dup 3) - (match_dup 4) - (match_dup 5)]))))] - "" -{ - int endian_adjust = WORDS_BIG_ENDIAN ? 0 : 1; - operands[2] = GEN_INT (0 + endian_adjust); - operands[3] = GEN_INT (2 + endian_adjust); - operands[4] = GEN_INT (4 + endian_adjust); - operands[5] = GEN_INT (6 + endian_adjust); -}) - -(define_insn "*cvt_fp16_to_v4sf_<mode>_le" - [(set (match_operand:V4SF 0 "vsx_register_operand") - (float_extend:V4SF - (vec_select:<FP16_VECTOR4> - (match_operand:VFP16_HW 1 "vsx_register_operand") - (parallel [(const_int 1) - (const_int 3) - (const_int 5) - (const_int 7)]))))] - "!WORDS_BIG_ENDIAN" - "<cvt_fp16_to_v4sf_insn> %x0,%x1" - [(set_attr "type" "vecfloat")]) - -(define_insn "*cvt_fp16_to_v4sf_<mode>_be" - [(set (match_operand:V4SF 0 "vsx_register_operand") - (float_extend:V4SF - (vec_select:<FP16_VECTOR4> - (match_operand:VFP16_HW 1 "vsx_register_operand") - (parallel [(const_int 0) - (const_int 2) - (const_int 4) - (const_int 6)]))))] - "WORDS_BIG_ENDIAN" - "<cvt_fp16_to_v4sf_insn> %x0,%x1" - [(set_attr "type" "vecfloat")]) - -;; Duplicate and convert a 16-bit floating point scalar to V4SFmode. - -(define_insn_and_split "*dup_<mode>_to_v4sf" - [(set (match_operand:V4SF 0 "vsx_register_operand" "=wa") - (vec_duplicate:V4SF - (float_extend:SF - (match_operand:FP16_HW 1 "vsx_register_operand" "wa"))))] - "" - "#" - "&& 1" - [(pc)] -{ - rtx op0 = operands[0]; - rtx op1 = operands[1]; - rtx op0_vfp16 = gen_lowpart (<FP16_VECTOR8>mode, op0); - - emit_insn (gen_xxspltw_<mode> (op0, op1)); - emit_insn (gen_cvt_fp16_to_v4sf_<fp16_vector8> (op0, op0_vfp16)); - DONE; -} - [(set_attr "length" "8") - (set_attr "type" "vecperm")]) - -;; Duplicate a HF/BF value so it can be used for xvcvhpspn/xvcvbf16spn. -;; Because xvcvhpspn/xvcvbf16spn only uses the even elements, we can -;; use xxspltw instead of vspltw. This has the advantage that the -;; register allocator can use any of the 64 VSX registers instead of -;; being limited to the 32 Altivec registers that VSPLTH would require. - -(define_insn "xxspltw_<mode>" - [(set (match_operand:V4SF 0 "vsx_register_operand" "=wa") - (unspec:V4SF [(match_operand:FP16_HW 1 "vsx_register_operand" "wa")] - UNSPEC_XXSPLTW_FP16))] - "" - "xxspltw %x0,%x1,1" - [(set_attr "type" "vecperm")]) - -;; Convert a V4SFmode vector to a 16-bit floating point scalar. We -;; only care about the 2nd V4SFmode element, which is the element we -;; converted the 16-bit scalar (4th element) to V4SFmode to do the -;; operation, and converted it back. - -(define_insn "xvcvspbf16_bf" - [(set (match_operand:BF 0 "vsx_register_operand" "=wa") - (unspec:BF [(match_operand:V4SF 1 "vsx_register_operand" "wa")] - UNSPEC_XVCVSPBF16_BF))] - "TARGET_BFLOAT16_HW" - "xvcvspbf16 %x0,%x1" - [(set_attr "type" "vecfloat")]) - -;; Convert between HFmode/BFmode and 128-bit binary floating point and -;; decimal floating point types. We use convert_move since some of the -;; types might not have valid RTX expanders. We use DFmode as the -;; intermediate conversion destination. - -(define_expand "extend<FP16_HW:mode><fp16_float_convert:mode>2" - [(set (match_operand:fp16_float_convert 0 "vsx_register_operand") - (float_extend:fp16_float_convert - (match_operand:FP16_HW 1 "vsx_register_operand")))] - "" -{ - rtx df_tmp = gen_reg_rtx (DFmode); - emit_insn (gen_extend<FP16_HW:mode>df2 (df_tmp, operands[1])); - convert_move (operands[0], df_tmp, 0); - DONE; -}) - -(define_expand "trunc<fp16_float_convert:mode><FP16_HW:mode>2" - [(set (match_operand:FP16_HW 0 "vsx_register_operand") - (float_truncate:FP16_HW - (match_operand:fp16_float_convert 1 "vsx_register_operand")))] - "" -{ - rtx df_tmp = gen_reg_rtx (DFmode); - - convert_move (df_tmp, operands[1], 0); - emit_insn (gen_truncdf<FP16_HW:mode>2 (operands[0], df_tmp)); - DONE; -}) - -;; Convert integers to 16-bit floating point modes. -(define_expand "float<GPR:mode><FP16_HW:mode>2" - [(set (match_operand:FP16_HW 0 "vsx_register_operand") - (float:FP16_HW - (match_operand:GPR 1 "vsx_register_operand")))] - "" -{ - rtx df_tmp = gen_reg_rtx (DFmode); - emit_insn (gen_float<GPR:mode>df2 (df_tmp, operands[1])); - emit_insn (gen_truncdf<FP16_HW:mode>2 (operands[0], df_tmp)); - DONE; -}) - -(define_expand "floatuns<GPR:mode><FP16_HW:mode>2" - [(set (match_operand:FP16_HW 0 "vsx_register_operand") - (unsigned_float:FP16_HW - (match_operand:GPR 1 "vsx_register_operand")))] - "" -{ - rtx df_tmp = gen_reg_rtx (DFmode); - emit_insn (gen_floatuns<GPR:mode>df2 (df_tmp, operands[1])); - emit_insn (gen_truncdf<FP16_HW:mode>2 (operands[0], df_tmp)); - DONE; -}) - -;; Convert 16-bit floating point modes to integers -(define_expand "fix_trunc<FP16_HW:mode><GPR:mode>2" - [(set (match_operand:GPR 0 "vsx_register_operand") - (fix:GPR - (match_operand:FP16_HW 1 "vsx_register_operand")))] - "" -{ - rtx df_tmp = gen_reg_rtx (DFmode); - emit_insn (gen_extend<FP16_HW:mode>df2 (df_tmp, operands[1])); - emit_insn (gen_fix_truncdf<GPR:mode>2 (operands[0], df_tmp)); - DONE; -}) - -(define_expand "fixuns_trunc<FP16_HW:mode><GPR:mode>2" - [(set (match_operand:GPR 0 "vsx_register_operand") - (unsigned_fix:GPR - (match_operand:FP16_HW 1 "vsx_register_operand")))] - "" -{ - rtx df_tmp = gen_reg_rtx (DFmode); - emit_insn (gen_extend<FP16_HW:mode>df2 (df_tmp, operands[1])); - emit_insn (gen_fixuns_truncdf<GPR:mode>2 (operands[0], df_tmp)); - DONE; -}) - -;; Negate 16-bit floating point by XOR with -0.0. - -(define_insn_and_split "neg<mode>2" - [(set (match_operand:FP16 0 "gpc_reg_operand" "=wa,?wr") - (neg:FP16 (match_operand:FP16 1 "gpc_reg_operand" "wa,wr"))) - (clobber (match_scratch:FP16 2 "=&wa,&r"))] - "TARGET_FLOAT16" - "#" - "&& 1" - [(set (match_dup 2) - (match_dup 3)) - (set (match_dup 0) - (xor:FP16 (match_dup 1) - (match_dup 2)))] -{ - if (GET_CODE (operands[2]) == SCRATCH) - operands[2] = gen_reg_rtx (<MODE>mode); - - REAL_VALUE_TYPE dconst; - - gcc_assert (real_from_string (&dconst, "-0.0") == 0); - - rtx rc = const_double_from_real_value (dconst, <MODE>mode); - if (!TARGET_PREFIXED) - rc = force_const_mem (<MODE>mode, rc); - - operands[3] = rc; -} - [(set_attr "type" "veclogical,integer") - (set_attr "length" "16")]) - -;; 16-bit floating point absolute value - -(define_insn_and_split "abs<mode>2" - [(set (match_operand:FP16 0 "gpc_reg_operand" "=wa,?wr") - (abs:FP16 - (match_operand:FP16 1 "gpc_reg_operand" "wa,wr"))) - (clobber (match_scratch:FP16 2 "=&wa,&r"))] - "TARGET_FLOAT16" - "#" - "&& 1" - [(set (match_dup 2) - (match_dup 3)) - (set (match_dup 0) - (and:FP16 (not:FP16 (match_dup 2)) - (match_dup 1)))] - -{ - if (GET_CODE (operands[2]) == SCRATCH) - operands[2] = gen_reg_rtx (<MODE>mode); - - REAL_VALUE_TYPE dconst; - - gcc_assert (real_from_string (&dconst, "-0.0") == 0); - - rtx rc = const_double_from_real_value (dconst, <MODE>mode); - - if (!TARGET_PREFIXED) - rc = force_const_mem (<MODE>mode, rc); - - operands[3] = rc; -} - [(set_attr "type" "veclogical,integer") - (set_attr "length" "16")]) - -;; 16-bit negative floating point absolute value - -(define_insn_and_split "*nabs<mode>2" - [(set (match_operand:FP16 0 "gpc_reg_operand" "=wa,?wr") - (neg:FP16 - (abs:FP16 - (match_operand:FP16 1 "gpc_reg_operand" "wa,wr")))) - (clobber (match_scratch:FP16 2 "=&wa,&r"))] - "TARGET_FLOAT16" - "#" - "&& 1" - [(set (match_dup 2) - (match_dup 3)) - (set (match_dup 0) - (ior:FP16 (match_dup 1) - (match_dup 2)))] -{ - if (GET_CODE (operands[2]) == SCRATCH) - operands[2] = gen_reg_rtx (<MODE>mode); - - REAL_VALUE_TYPE dconst; - - gcc_assert (real_from_string (&dconst, "-0.0") == 0); - rtx rc = const_double_from_real_value (dconst, <MODE>mode); - - if (!TARGET_PREFIXED) - rc = force_const_mem (<MODE>mode, rc); - - operands[3] = rc; -} - [(set_attr "type" "veclogical,integer") - (set_attr "length" "16")]) - -;; Add logical operations for 16-bit floating point types that are used -;; for things like negate, abs, and negative abs. Possibly in the -;; future we might need logical operators for extracting exponents and -;; mantissas. -(define_expand "and<mode>3" - [(set (match_operand:FP16 0 "gpc_reg_operand") - (and:FP16 (match_operand:FP16 1 "gpc_reg_operand") - (match_operand:FP16 2 "gpc_reg_operand")))] - "TARGET_FLOAT16" - "") - -(define_expand "ior<mode>3" - [(set (match_operand:FP16 0 "gpc_reg_operand") - (ior:FP16 (match_operand:FP16 1 "gpc_reg_operand") - (match_operand:FP16 2 "gpc_reg_operand")))] - "TARGET_FLOAT16" - "") - -(define_expand "xor<mode>3" - [(set (match_operand:FP16 0 "gpc_reg_operand") - (xor:FP16 (match_operand:FP16 1 "gpc_reg_operand") - (match_operand:FP16 2 "gpc_reg_operand")))] - "TARGET_FLOAT16" - "") - -(define_expand "nor<mode>3" - [(set (match_operand:FP16 0 "gpc_reg_operand") - (and:FP16 - (not:FP16 (match_operand:FP16 1 "gpc_reg_operand")) - (not:FP16 (match_operand:FP16 2 "gpc_reg_operand"))))] - "TARGET_FLOAT16" - "") - -(define_expand "andn<mode>3" - [(set (match_operand:FP16 0 "gpc_reg_operand") - (and:FP16 - (not:FP16 (match_operand:FP16 2 "gpc_reg_operand")) - (match_operand:FP16 1 "gpc_reg_operand")))] - "TARGET_FLOAT16" - "") - -(define_expand "eqv<mode>3" - [(set (match_operand:FP16 0 "gpc_reg_operand") - (not:FP16 - (xor:FP16 (match_operand:FP16 1 "gpc_reg_operand") - (match_operand:FP16 2 "gpc_reg_operand"))))] - "TARGET_FLOAT16" - "") - -;; Rewrite nand into canonical form -(define_expand "nand<mode>3" - [(set (match_operand:FP16 0 "gpc_reg_operand") - (ior:FP16 - (not:FP16 (match_operand:FP16 1 "gpc_reg_operand")) - (not:FP16 (match_operand:FP16 2 "gpc_reg_operand"))))] - "TARGET_FLOAT16" - "") - -;; The canonical form is to have the negated element first, so we need to -;; reverse arguments. -(define_expand "iorn<mode>3" - [(set (match_operand:FP16 0 "gpc_reg_operand") - (ior:FP16 - (not:FP16 (match_operand:FP16 2 "gpc_reg_operand")) - (match_operand:FP16 1 "gpc_reg_operand")))] - "TARGET_FLOAT16" - "") - -;; AND, IOR, and XOR insns. Unlike HImode operations prefer using -;; floating point/vector registers over GPRs. -(define_insn "*bool<mode>3" - [(set (match_operand:FP16 0 "gpc_reg_operand" "=wa,r") - (match_operator:FP16 3 "boolean_operator" - [(match_operand:FP16 1 "gpc_reg_operand" "wa,r") - (match_operand:FP16 2 "gpc_reg_operand" "wa,r")]))] - "TARGET_FLOAT16" - "@ - xxl%q3 %x0,%x1,%x2 - %q3 %0,%1,%2" - [(set_attr "type" "veclogical,logical")]) - -;; ANDC, IORC, and EQV insns. -(define_insn "*boolc<mode>3" - [(set (match_operand:FP16 0 "gpc_reg_operand" "=wa,r") - (match_operator:FP16 3 "boolean_operator" - [(not:FP16 (match_operand:FP16 2 "gpc_reg_operand" "wa,r")) - (match_operand:FP16 1 "gpc_reg_operand" "wa,r")]))] - "TARGET_FLOAT16" - "@ - xxl%q3 %x0,%x1,%x2 - %q3 %0,%1,%2" - [(set_attr "type" "veclogical,logical")]) - -;; NOR and NAND insns. -(define_insn "*boolcc<mode>3" - [(set (match_operand:FP16 0 "gpc_reg_operand" "=wa,r") - (match_operator:FP16 3 "boolean_operator" - [(not:FP16 (match_operand:FP16 1 "gpc_reg_operand" "wa,r")) - (not:FP16 (match_operand:FP16 2 "gpc_reg_operand" "wa,r"))]))] - "TARGET_FLOAT16" - "@ - xxl%q3 %x0,%x1,%x2 - %q3 %0,%1,%2" - [(set_attr "type" "veclogical,logical")]) - -;; Add vectorization support for 16-bit floating point. - -;; Binary operators being vectorized. -(define_insn_and_split "<fp16_names><mode>3" - [(set (match_operand:VFP16_HW 0 "vsx_register_operand") - (FP16_BINARY_OP:VFP16_HW - (match_operand:VFP16_HW 1 "vsx_register_operand") - (match_operand:VFP16_HW 2 "vsx_register_operand")))] - "can_create_pseudo_p ()" - "#" - "&& 1" - [(pc)] -{ - fp16_vectorization (<CODE>, operands[0], operands[1], operands[2], NULL_RTX, - FP16_BINARY); - DONE; -}) - -;; FMA operations being vectorized. -(define_insn_and_split "fma<mode>4" - [(set (match_operand:VFP16_HW 0 "vsx_register_operand") - (fma:VFP16_HW - (match_operand:VFP16_HW 1 "vsx_register_operand") - (match_operand:VFP16_HW 2 "vsx_register_operand") - (match_operand:VFP16_HW 3 "vsx_register_operand")))] - "can_create_pseudo_p ()" - "#" - "&& 1" - [(pc)] -{ - fp16_vectorization (FMA, operands[0], operands[1], operands[2], - operands[3], FP16_FMA); - DONE; -}) - -(define_insn_and_split "*fms<mode>4" - [(set (match_operand:VFP16_HW 0 "vsx_register_operand") - (fma:VFP16_HW - (match_operand:VFP16_HW 1 "vsx_register_operand") - (match_operand:VFP16_HW 2 "vsx_register_operand") - (neg:VFP16_HW - (match_operand:VFP16_HW 3 "vsx_register_operand"))))] - "can_create_pseudo_p ()" - "#" - "&& 1" - [(pc)] -{ - fp16_vectorization (FMA, operands[0], operands[1], operands[2], - operands[3], FP16_FMS); - DONE; -}) - -(define_insn_and_split "*nfma<mode>4" - [(set (match_operand:VFP16_HW 0 "vsx_register_operand") - (neg:VFP16_HW - (fma:VFP16_HW - (match_operand:VFP16_HW 1 "vsx_register_operand") - (match_operand:VFP16_HW 2 "vsx_register_operand") - (match_operand:VFP16_HW 3 "vsx_register_operand"))))] - "can_create_pseudo_p ()" - "#" - "&& 1" - [(pc)] -{ - fp16_vectorization (FMA, operands[0], operands[1], operands[2], - operands[3], FP16_NFMA); - DONE; -}) - -(define_insn_and_split "*nfms<mode>4" - [(set (match_operand:VFP16_HW 0 "vsx_register_operand") - (neg:VFP16_HW - (fma:VFP16_HW - (match_operand:VFP16_HW 1 "vsx_register_operand") - (match_operand:VFP16_HW 2 "vsx_register_operand") - (neg:VFP16_HW - (match_operand:VFP16_HW 3 "vsx_register_operand")))))] - "can_create_pseudo_p ()" - "#" - "&& 1" - [(pc)] -{ - fp16_vectorization (FMA, operands[0], operands[1], operands[2], - operands[3], FP16_NFMS); - DONE; -}) - -;; Vector Pack support. - -(define_expand "vec_pack_trunc_v4sf_v8hf" - [(match_operand:V8HF 0 "vfloat_operand") - (match_operand:V4SF 1 "vfloat_operand") - (match_operand:V4SF 2 "vfloat_operand")] - "TARGET_FLOAT16_HW" -{ - rtx r1 = gen_reg_rtx (V8HFmode); - rtx r2 = gen_reg_rtx (V8HFmode); - - emit_insn (gen_xvcvsphp_v8hf (r1, operands[1])); - emit_insn (gen_xvcvsphp_v8hf (r2, operands[2])); - rs6000_expand_extract_even (operands[0], r1, r2); - DONE; -}) - -(define_expand "vec_pack_trunc_v4sf_v8bf" - [(match_operand:V8BF 0 "vfloat_operand") - (match_operand:V4SF 1 "vfloat_operand") - (match_operand:V4SF 2 "vfloat_operand")] - "TARGET_BFLOAT16_HW" -{ - rtx r1 = gen_reg_rtx (V8BFmode); - rtx r2 = gen_reg_rtx (V8BFmode); - - emit_insn (gen_xvcvspbf16_v8bf (r1, operands[1])); - emit_insn (gen_xvcvspbf16_v8bf (r2, operands[2])); - rs6000_expand_extract_even (operands[0], r1, r2); - DONE; -}) - -;; Unfortunately the machine independent code assumes there is only one -;; 16-bit floating point type. This means we have to choose whether to -;; support packing _Float16 or __bfloat16. It looks like __bfloat16 is -;; more popular, so we choose __bfloat16 to be the default. - -(define_expand "vec_pack_trunc_v4sf" - [(match_operand:V8BF 0 "vfloat_operand") - (match_operand:V4SF 1 "vfloat_operand") - (match_operand:V4SF 2 "vfloat_operand")] - "TARGET_BFLOAT16_HW" -{ - rtx r1 = gen_reg_rtx (V8BFmode); - rtx r2 = gen_reg_rtx (V8BFmode); - - emit_insn (gen_xvcvspbf16_v8bf (r1, operands[1])); - emit_insn (gen_xvcvspbf16_v8bf (r2, operands[2])); - rs6000_expand_extract_even (operands[0], r1, r2); - DONE; -}) - -;; Used for vector conversion to _Float16 -(define_insn "xvcvsphp_v8hf" - [(set (match_operand:V8HF 0 "vsx_register_operand" "=wa") - (unspec:V8HF [(match_operand:V4SF 1 "vsx_register_operand" "wa")] - UNSPEC_XVCVSPHP_V8HF))] - "TARGET_FLOAT16_HW" - "xvcvsphp %x0,%x1" -[(set_attr "type" "vecfloat")]) - -;; Used for vector conversion to __bfloat16 -(define_insn "xvcvspbf16_v8bf" - [(set (match_operand:V8BF 0 "vsx_register_operand" "=wa") - (unspec:V8BF [(match_operand:V4SF 1 "vsx_register_operand" "wa")] - UNSPEC_XVCVSPBF16_V8BF))] - "TARGET_BFLOAT16_HW" - "xvcvspbf16 %x0,%x1" - [(set_attr "type" "vecfloat")]) - -;; Vector unpack support. Given the name is for the type being -;; unpacked, we can unpack both __bfloat16 and _Float16. - -;; Unpack vector _Float16 -(define_expand "vec_unpacks_hi_v8hf" - [(match_operand:V4SF 0 "vfloat_operand") - (match_operand:V8HF 1 "vfloat_operand")] - "TARGET_FLOAT16_HW" -{ - rtx reg = gen_reg_rtx (V8HFmode); - - rs6000_expand_interleave (reg, operands[1], operands[1], BYTES_BIG_ENDIAN); - emit_insn (gen_xvcvhpsp_v8hf (operands[0], reg)); - DONE; -}) - -(define_expand "vec_unpacks_lo_v8hf" - [(match_operand:V4SF 0 "vfloat_operand") - (match_operand:V8HF 1 "vfloat_operand")] - "TARGET_FLOAT16_HW" -{ - rtx reg = gen_reg_rtx (V8HFmode); - - rs6000_expand_interleave (reg, operands[1], operands[1], !BYTES_BIG_ENDIAN); - emit_insn (gen_xvcvhpsp_v8hf (operands[0], reg)); - DONE; -}) - -;; Used for vector conversion from _Float16 -(define_insn "xvcvhpsp_v8hf" - [(set (match_operand:V4SF 0 "vsx_register_operand" "=wa") - (unspec:V4SF [(match_operand:V8HF 1 "vsx_register_operand" "wa")] - UNSPEC_CVT_FP16_TO_V4SF))] - "TARGET_FLOAT16_HW" - "xvcvhpsp %x0,%x1" - [(set_attr "type" "vecperm")]) - -;; Unpack vector __bfloat16 -(define_expand "vec_unpacks_hi_v8bf" - [(match_operand:V4SF 0 "vfloat_operand") - (match_operand:V8BF 1 "vfloat_operand")] - "TARGET_BFLOAT16_HW" -{ - rtx reg = gen_reg_rtx (V8BFmode); - - rs6000_expand_interleave (reg, operands[1], operands[1], BYTES_BIG_ENDIAN); - emit_insn (gen_xvcvbf16spn_v8bf (operands[0], reg)); - DONE; -}) - -(define_expand "vec_unpacks_lo_v8bf" - [(match_operand:V4SF 0 "vfloat_operand") - (match_operand:V8BF 1 "vfloat_operand")] - "TARGET_BFLOAT16_HW" -{ - rtx reg = gen_reg_rtx (V8BFmode); - - rs6000_expand_interleave (reg, operands[1], operands[1], !BYTES_BIG_ENDIAN); - emit_insn (gen_xvcvbf16spn_v8bf (operands[0], reg)); - DONE; -}) - -;; Used for vector conversion from __bfloat16 -(define_insn "xvcvbf16spn_v8bf" - [(set (match_operand:V4SF 0 "vsx_register_operand" "=wa") - (unspec:V4SF [(match_operand:V8BF 1 "vsx_register_operand" "wa")] - UNSPEC_CVT_FP16_TO_V4SF))] - "TARGET_BFLOAT16_HW" - "xvcvbf16spn %x0,%x1" - [(set_attr "type" "vecperm")]) - -(define_insn "xvcvbf16spn_bf" - [(set (match_operand:V4SF 0 "vsx_register_operand" "=wa") - (unspec:V4SF [(match_operand:V4SF 1 "vsx_register_operand" "wa")] - UNSPEC_CVT_FP16_TO_V4SF))] - "TARGET_BFLOAT16_HW" - "xvcvbf16spn %x0,%x1" - [(set_attr "type" "vecperm")]) - -;; Optimize __bfloat16 binary operations. Unlike _Float16 where we -;; have instructions to convert between HFmode and SFmode as scalar -;; values, with BFmode, we only have vector conversions. Thus to do: -;; -;; __bfloat16 a, b, c; -;; a = b + c; -;; -;; the GCC compiler would normally generate: -;; -;; lxsihzx 0,4,2 // load __bfloat16 value b -;; lxsihzx 12,5,2 // load __bfloat16 value c -;; xxsldwi 0,0,0,1 // shift b into bits 16..31 -;; xxsldwi 12,12,12,1 // shift c into bits 16..31 -;; xvcvbf16spn 0,0 // vector convert b into V4SFmode -;; xvcvbf16spn 12,12 // vector convert c into V4SFmode -;; xscvspdpn 0,0 // convert b into SFmode scalar -;; xscvspdpn 12,12 // convert c into SFmode scalar -;; fadds 0,0,12 // add b+c -;; xscvdpspn 0,0 // convert b+c into SFmode memory format -;; xvcvspbf16 0,0 // convert b+c into BFmode memory format -;; stxsihx 0,3,2 // store b+c -;; -;; Using the following combiner patterns, the code generated would now -;; be: -;; -;; lxsihzx 12,4,2 // load __bfloat16 value b -;; lxsihzx 0,5,2 // load __bfloat16 value c -;; xxspltw 12,12,1 // shift b into bits 16..31 -;; xxspltw 0,0,1 // shift c into bits 16..31 -;; xvcvbf16spn 12,12 // vector convert b into V4SFmode -;; xvcvbf16spn 0,0 // vector convert c into V4SFmode -;; xvaddsp 0,0,12 // vector b+c in V4SFmode -;; xvcvspbf16 0,0 // convert b+c into BFmode memory format -;; stxsihx 0,3,2 // store b+c -;; -;; We cannot just define insns like 'addbf3' to keep the operation as -;; BFmode because GCC will not generate these patterns unless the user -;; uses -Ofast. Without -Ofast, it will always convert BFmode into -;; SFmode. - -(define_insn_and_split "*bfloat16_binary_op_internal1" - [(set (match_operand:SF 0 "vsx_register_operand") - (match_operator:SF 1 "fp16_binary_operator" - [(match_operand:SF 2 "bfloat16_v4sf_operand") - (match_operand:SF 3 "bfloat16_v4sf_operand")]))] - "TARGET_BFLOAT16_HW && can_create_pseudo_p () - && (bfloat16_bf_operand (operands[2], SFmode) - || bfloat16_bf_operand (operands[3], SFmode))" - "#" - "&& 1" - [(pc)] -{ - bfloat16_operation_as_v4sf (GET_CODE (operands[1]), operands[0], operands[2], - operands[3], NULL_RTX, FP16_BINARY); - DONE; -}) - -(define_insn_and_split "*bfloat16_binary_op_internal2" - [(set (match_operand:BF 0 "vsx_register_operand") - (float_truncate:BF - (match_operator:SF 1 "fp16_binary_operator" - [(match_operand:SF 2 "bfloat16_v4sf_operand") - (match_operand:SF 3 "bfloat16_v4sf_operand")])))] - "TARGET_BFLOAT16_HW && can_create_pseudo_p () - && (bfloat16_bf_operand (operands[2], SFmode) - || bfloat16_bf_operand (operands[3], SFmode))" - "#" - "&& 1" - [(pc)] -{ - bfloat16_operation_as_v4sf (GET_CODE (operands[1]), operands[0], operands[2], - operands[3], NULL_RTX, FP16_BINARY); - DONE; -}) - -(define_insn_and_split "*bfloat16_fma_internal1" - [(set (match_operand:SF 0 "vsx_register_operand") - (fma:SF - (match_operand:SF 1 "bfloat16_v4sf_operand") - (match_operand:SF 2 "bfloat16_v4sf_operand") - (match_operand:SF 3 "bfloat16_v4sf_operand")))] - "TARGET_BFLOAT16_HW && can_create_pseudo_p () - && (bfloat16_bf_operand (operands[1], SFmode) - + bfloat16_bf_operand (operands[2], SFmode) - + bfloat16_bf_operand (operands[3], SFmode) >= 2)" - "#" - "&& 1" - [(pc)] -{ - bfloat16_operation_as_v4sf (FMA, operands[0], operands[1], operands[2], - operands[3], FP16_FMA); - DONE; -}) - -(define_insn_and_split "*bfloat16_fma_internal2" - [(set (match_operand:BF 0 "vsx_register_operand" "=wa") - (float_truncate:BF - (fma:SF - (match_operand:SF 1 "bfloat16_v4sf_operand") - (match_operand:SF 2 "bfloat16_v4sf_operand") - (match_operand:SF 3 "bfloat16_v4sf_operand"))))] - "TARGET_BFLOAT16_HW && can_create_pseudo_p () - && (bfloat16_bf_operand (operands[1], SFmode) - + bfloat16_bf_operand (operands[2], SFmode) - + bfloat16_bf_operand (operands[3], SFmode) >= 2)" - "#" - "&& 1" - [(pc)] -{ - bfloat16_operation_as_v4sf (FMA, operands[0], operands[1], operands[2], - operands[3], FP16_FMA); - DONE; -}) - -(define_insn_and_split "*bfloat16_fms_internal1" - [(set (match_operand:SF 0 "vsx_register_operand") - (fma:SF - (match_operand:SF 1 "bfloat16_v4sf_operand") - (match_operand:SF 2 "bfloat16_v4sf_operand") - (neg:SF - (match_operand:SF 3 "bfloat16_v4sf_operand"))))] - "TARGET_BFLOAT16_HW && can_create_pseudo_p () - && (bfloat16_bf_operand (operands[1], SFmode) - + bfloat16_bf_operand (operands[2], SFmode) - + bfloat16_bf_operand (operands[3], SFmode) >= 2)" - "#" - "&& 1" - [(pc)] -{ - bfloat16_operation_as_v4sf (FMA, operands[0], operands[1], operands[2], - operands[3], FP16_FMS); - DONE; -}) - -(define_insn_and_split "*bfloat16_fms_internal2" - [(set (match_operand:BF 0 "vsx_register_operand") - (float_truncate:BF - (fma:SF - (match_operand:SF 1 "bfloat16_v4sf_operand") - (match_operand:SF 2 "bfloat16_v4sf_operand") - (neg:SF - (match_operand:SF 3 "bfloat16_v4sf_operand")))))] - "TARGET_BFLOAT16_HW && can_create_pseudo_p () - && (bfloat16_bf_operand (operands[1], SFmode) - + bfloat16_bf_operand (operands[2], SFmode) - + bfloat16_bf_operand (operands[3], SFmode) >= 2)" - "#" - "&& 1" - [(pc)] -{ - bfloat16_operation_as_v4sf (FMA, operands[0], operands[1], operands[2], - operands[3], FP16_FMS); - DONE; -}) - -(define_insn_and_split "*bfloat16_nfma_internal1" - [(set (match_operand:SF 0 "vsx_register_operand") - (neg:SF - (fma:SF - (match_operand:SF 1 "bfloat16_v4sf_operand") - (match_operand:SF 2 "bfloat16_v4sf_operand") - (match_operand:SF 3 "bfloat16_v4sf_operand"))))] - "TARGET_BFLOAT16_HW && can_create_pseudo_p () - && (bfloat16_bf_operand (operands[1], SFmode) - + bfloat16_bf_operand (operands[2], SFmode) - + bfloat16_bf_operand (operands[3], SFmode) >= 2)" - "#" - "&& 1" - [(pc)] -{ - bfloat16_operation_as_v4sf (FMA, operands[0], operands[1], operands[2], - operands[3], FP16_NFMA); - DONE; -}) - -(define_insn_and_split "*bfloat16_nfma_internal2" - [(set (match_operand:BF 0 "vsx_register_operand" "=wa") - (float_truncate:BF - (neg:SF - (fma:SF - (match_operand:SF 1 "bfloat16_v4sf_operand") - (match_operand:SF 2 "bfloat16_v4sf_operand") - (match_operand:SF 3 "bfloat16_v4sf_operand")))))] - "TARGET_BFLOAT16_HW && can_create_pseudo_p () - && (bfloat16_bf_operand (operands[1], SFmode) - + bfloat16_bf_operand (operands[2], SFmode) - + bfloat16_bf_operand (operands[3], SFmode) >= 2)" - "#" - "&& 1" - [(pc)] -{ - bfloat16_operation_as_v4sf (FMA, operands[0], operands[1], operands[2], - operands[3], FP16_NFMA); - DONE; -}) - -(define_insn_and_split "*bfloat16_nfma_internal3" - [(set (match_operand:BF 0 "vsx_register_operand" "=wa") - (neg:BF - (float_truncate:BF - (fma:SF - (match_operand:SF 1 "bfloat16_v4sf_operand") - (match_operand:SF 2 "bfloat16_v4sf_operand") - (match_operand:SF 3 "bfloat16_v4sf_operand")))))] - "TARGET_BFLOAT16_HW && can_create_pseudo_p () - && (bfloat16_bf_operand (operands[1], SFmode) - + bfloat16_bf_operand (operands[2], SFmode) - + bfloat16_bf_operand (operands[3], SFmode) >= 2)" - "#" - "&& 1" - [(pc)] -{ - bfloat16_operation_as_v4sf (FMA, operands[0], operands[1], operands[2], - operands[3], FP16_NFMA); - DONE; -}) - -(define_insn_and_split "*bfloat16_nfms_internal1" - [(set (match_operand:SF 0 "vsx_register_operand") - (neg:SF - (fma:SF - (match_operand:SF 1 "bfloat16_v4sf_operand") - (match_operand:SF 2 "bfloat16_v4sf_operand") - (neg:SF - (match_operand:SF 3 "bfloat16_v4sf_operand")))))] - "TARGET_BFLOAT16_HW && can_create_pseudo_p () - && (bfloat16_bf_operand (operands[1], SFmode) - + bfloat16_bf_operand (operands[2], SFmode) - + bfloat16_bf_operand (operands[3], SFmode) >= 2)" - "#" - "&& 1" - [(pc)] -{ - bfloat16_operation_as_v4sf (FMA, operands[0], operands[1], operands[2], - operands[3], FP16_NFMS); - DONE; -}) - -(define_insn_and_split "*bfloat16_nfms_internal2" - [(set (match_operand:BF 0 "vsx_register_operand") - (float_truncate:BF - (neg:SF - (fma:SF - (match_operand:SF 1 "bfloat16_v4sf_operand") - (match_operand:SF 2 "bfloat16_v4sf_operand") - (neg:SF - (match_operand:SF 3 "bfloat16_v4sf_operand"))))))] - "TARGET_BFLOAT16_HW && can_create_pseudo_p () - && (bfloat16_bf_operand (operands[1], SFmode) - + bfloat16_bf_operand (operands[2], SFmode) - + bfloat16_bf_operand (operands[3], SFmode) >= 2)" - "#" - "&& 1" - [(pc)] -{ - bfloat16_operation_as_v4sf (FMA, operands[0], operands[1], operands[2], - operands[3], FP16_NFMS); - DONE; -}) - -(define_insn_and_split "*bfloat16_nfms_internal3" - [(set (match_operand:BF 0 "vsx_register_operand") - (neg:BF - (float_truncate:BF - (fma:SF - (match_operand:SF 1 "bfloat16_v4sf_operand") - (match_operand:SF 2 "bfloat16_v4sf_operand") - (neg:SF - (match_operand:SF 3 "bfloat16_v4sf_operand"))))))] - "TARGET_BFLOAT16_HW && can_create_pseudo_p () - && (bfloat16_bf_operand (operands[1], SFmode) - + bfloat16_bf_operand (operands[2], SFmode) - + bfloat16_bf_operand (operands[3], SFmode) >= 2)" - "#" - "&& 1" - [(pc)] -{ - bfloat16_operation_as_v4sf (FMA, operands[0], operands[1], operands[2], - operands[3], FP16_NFMS); - DONE; -}) diff --git a/gcc/config/rs6000/predicates.md b/gcc/config/rs6000/predicates.md index b2ed06f57862..54dbc8bcc952 100644 --- a/gcc/config/rs6000/predicates.md +++ b/gcc/config/rs6000/predicates.md @@ -601,11 +601,6 @@ if (TARGET_VSX && op == CONST0_RTX (mode)) return 1; - /* If we are on power10, we can use XXSPLTIW to load constants. On power8 - and power9, we can use direct move. */ - if (FP16_SCALAR_MODE_P (mode)) - return true; - /* Constants that can be generated with ISA 3.1 instructions are easy. */ vec_const_128bit_type vsx_const; if (TARGET_POWER10 && vec_const_128bit_to_bytes (op, mode, &vsx_const)) @@ -749,10 +744,6 @@ return true; } - /* -0,0 can be done as VSPLTIH x,-1 and VSLH x,x,x. */ - if (FP16_VECTOR_MODE_P (mode) && minus_zero_constant (op, mode)) - return true; - if (TARGET_P9_VECTOR && xxspltib_constant_p (op, mode, &num_insns, &value)) return true; @@ -2180,148 +2171,3 @@ (define_predicate "lxvl_else_operand" (and (match_code "const_vector") (match_test "op == CONST0_RTX (GET_MODE (op))"))) - -;; Return 1 if this is a floating point scalar constant that is -0.0 or -;; a vector floating point constant where each element is -0.0. -(define_predicate "minus_zero_constant" - (match_code "const_double,vec_duplicate,const_vector") -{ - if (GET_CODE (op) == VEC_DUPLICATE) - { - op = XEXP (op, 0); - if (!CONST_DOUBLE_P (op)) - return false; - - mode = GET_MODE (op); - } - - /* Scalar or vector filled with duplicates. */ - if (CONST_DOUBLE_P (op)) - { - if (!SCALAR_FLOAT_MODE_P (mode)) - return false; - - const REAL_VALUE_TYPE *rtype = CONST_DOUBLE_REAL_VALUE (op); - return real_isnegzero (rtype); - } - - /* Vector constant, check all elements. */ - else if (CONST_VECTOR_P (op)) - { - if (GET_MODE_CLASS (mode) != MODE_VECTOR_FLOAT) - return false; - - size_t nunits = GET_MODE_NUNITS (mode); - for (size_t i = 0; i < nunits; i++) - { - rtx ele = CONST_VECTOR_ELT (op, i); - if (!CONST_DOUBLE_P (ele)) - return false; - - const REAL_VALUE_TYPE *rtype = CONST_DOUBLE_REAL_VALUE (ele); - if (!real_isnegzero (rtype)) - return false; - } - - return true; - } - - return false; -}) - -;; Return 1 if this is a 16-bit floating point constant that can be -;; loaded with XXSPLTIW or is 0.0 that can be loaded with XXSPLTIB. -(define_predicate "fp16_xxspltiw_constant" - (match_code "const_double") -{ - if (!FP16_SCALAR_MODE_P (mode)) - return false; - - if (op == CONST0_RTX (mode)) - return true; - - if (!TARGET_PREFIXED) - return false; - - vec_const_128bit_type vsx_const; - if (!vec_const_128bit_to_bytes (op, mode, &vsx_const)) - return false; - - return constant_generates_xxspltiw (&vsx_const); -}) - -;; Return 1 if this is a 16-bit floating point operand that can be used -;; in an add, subtract, or multiply operation that uses the vector -;; conversion function. -(define_predicate "fp16_reg_or_constant_operand" - (match_code "reg,subreg,const_double") -{ - if (REG_P (op) || SUBREG_P (op)) - return vsx_register_operand (op, mode); - - if (CONST_DOUBLE_P (op)) - return fp16_xxspltiw_constant (op, mode); - - return false; -}) - -;; Match binary operators where we convert a BFmode operand into a -;; SFmode operand so that we can optimize the BFmode operation to do -;; the operation in vector mode rather than convverting the BFmode to a -;; V8BFmode vector, converting that V8BFmode vector to V4SFmode, and -;; then converting the V4SFmode element to SFmode scalar. -(define_predicate "fp16_binary_operator" - (match_code "plus,minus,mult,smax,smin")) - -;; Match bfloat16/float operands that can be optimized to do the -;; operation in V4SFmode. -(define_predicate "bfloat16_v4sf_operand" - (match_code "reg,subreg,const_double,float_extend,float_truncate") -{ - if (mode != BFmode && mode != SFmode) - return false; - - if (REG_P (op) || SUBREG_P (op)) - return register_operand (op, mode); - - if (CONST_DOUBLE_P (op)) - return true; - - if (GET_CODE (op) == FLOAT_EXTEND) - { - rtx op_arg = XEXP (op, 0); - return (mode == SFmode - && GET_MODE (op_arg) == BFmode - && (REG_P (op_arg) || SUBREG_P (op_arg))); - } - - if (GET_CODE (op) == FLOAT_TRUNCATE) - { - rtx op_arg = XEXP (op, 0); - return (mode == BFmode - && GET_MODE (op_arg) == SFmode - && (REG_P (op_arg) || SUBREG_P (op_arg))); - } - - return false; -}) - -;; Match an operand that originally was an BFmode value to prevent -;; operations involing only SFmode values from being converted to -;; BFmode. -(define_predicate "bfloat16_bf_operand" - (match_code "reg,subreg,const_double,float_extend") -{ - if (mode == BFmode || GET_MODE (op) == BFmode) - return true; - - if (mode != SFmode) - return false; - - if (GET_MODE (op) == SFmode - && GET_CODE (op) == FLOAT_EXTEND - && GET_MODE (XEXP (op, 0)) == BFmode) - return true; - - return false; -}) diff --git a/gcc/config/rs6000/rs6000-builtin.cc b/gcc/config/rs6000/rs6000-builtin.cc index bfe5710ffd18..f4f3772d6cc4 100644 --- a/gcc/config/rs6000/rs6000-builtin.cc +++ b/gcc/config/rs6000/rs6000-builtin.cc @@ -496,10 +496,6 @@ const char *rs6000_type_string (tree type_node) return "voidc*"; else if (type_node == float128_type_node) return "_Float128"; - else if (type_node == float16_type_node) - return "_Float16"; - else if (TARGET_FLOAT16 && type_node == bfloat16_type_node) - return "__bfloat16"; else if (type_node == vector_pair_type_node) return "__vector_pair"; else if (type_node == vector_quad_type_node) @@ -780,23 +776,6 @@ rs6000_init_builtins (void) lang_hooks.types.register_builtin_type (uintPTI_type_internal_node, "__upti_internal"); } - - /* __bfloat16 support. */ - if (TARGET_FLOAT16) - { - if (!bfloat16_type_node) - { - bfloat16_type_node = make_node (REAL_TYPE); - TYPE_PRECISION (bfloat16_type_node) = 16; - SET_TYPE_MODE (bfloat16_type_node, BFmode); - layout_type (bfloat16_type_node); - t = build_qualified_type (bfloat16_type_node, TYPE_QUAL_CONST); - } - - lang_hooks.types.register_builtin_type (bfloat16_type_node, - "__bfloat16"); - } - /* Vector pair and vector quad support. */ vector_pair_type_node = make_node (OPAQUE_TYPE); SET_TYPE_MODE (vector_pair_type_node, OOmode); diff --git a/gcc/config/rs6000/rs6000-c.cc b/gcc/config/rs6000/rs6000-c.cc index 55299051c240..3fa7c04a7ce2 100644 --- a/gcc/config/rs6000/rs6000-c.cc +++ b/gcc/config/rs6000/rs6000-c.cc @@ -583,18 +583,6 @@ rs6000_target_modify_macros (bool define_p, HOST_WIDE_INT flags) if ((flags & OPTION_MASK_FLOAT128_HW) != 0) rs6000_define_or_undefine_macro (define_p, "__FLOAT128_HARDWARE__"); - /* 16-bit floating point support. */ - if ((flags & OPTION_MASK_FLOAT16) != 0) - { - rs6000_define_or_undefine_macro (define_p, "__FLOAT16__"); - rs6000_define_or_undefine_macro (define_p, "__BFLOAT16__"); - - if ((flags & OPTION_MASK_P9_VECTOR) != 0) - rs6000_define_or_undefine_macro (define_p, "__FLOAT16_HW__"); - - if ((flags & OPTION_MASK_POWER10) != 0) - rs6000_define_or_undefine_macro (define_p, "__BFLOAT16_HW__"); - } /* Tell the user if we are targeting CELL. */ if (rs6000_cpu == PROCESSOR_CELL) rs6000_define_or_undefine_macro (define_p, "__PPU__"); diff --git a/gcc/config/rs6000/rs6000-call.cc b/gcc/config/rs6000/rs6000-call.cc index f3e10d8ba0f5..b9b791bfe8ae 100644 --- a/gcc/config/rs6000/rs6000-call.cc +++ b/gcc/config/rs6000/rs6000-call.cc @@ -684,28 +684,6 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, tree fntype, " altivec instructions are disabled, use %qs" " to enable them", "-maltivec"); } - -#if !POWERPC_FLOAT16_DISABLE_WARNING - /* Warn that __bfloat16 and _Float16 might be returned differently in the - future. The issue is currently 16-bit floating point is returned in - floating point register #1 in 16-bit format. We may or may not want to - return it as a scalar 64-bit value. */ - if (fntype && warn_psabi && !cum->libcall) - { - static bool warned_about_float16_return = false; - - if (!warned_about_float16_return) - { - machine_mode ret_mode = TYPE_MODE (TREE_TYPE (fntype)); - - warned_about_float16_return = true; - if (ret_mode == BFmode || ret_mode == HFmode) - warning (OPT_Wpsabi, - "%s might be returned differently in the future", - ret_mode == BFmode ? "__bfloat16" : "_Float16"); - } - } -#endif } @@ -1663,24 +1641,6 @@ rs6000_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) return NULL_RTX; } -#if !POWERPC_FLOAT16_DISABLE_WARNING - /* Warn that _Float16 and __bfloat16 might be passed differently in the - future. The issue is currently 16-bit floating point values are passed in - floating point registers in the native 16-bit format. We may or may not - want to pass the value it as a scalar 64-bit value. */ - if (warn_psabi && !cum->libcall && FP16_SCALAR_MODE_P (mode)) - { - static bool warned_about_float16_call = false; - - if (!warned_about_float16_call) - { - warned_about_float16_call = true; - warning (OPT_Wpsabi, "%s might be passed differently in the future", - mode == BFmode ? "__bfloat16" : "_Float16"); - } - } -#endif - /* Return a marker to indicate whether CR1 needs to set or clear the bit that V.4 uses to say fp args were passed in registers. Assume that we don't need the marker for software floating point, diff --git a/gcc/config/rs6000/rs6000-cpus.def b/gcc/config/rs6000/rs6000-cpus.def index d852c7b58606..a110860acce6 100644 --- a/gcc/config/rs6000/rs6000-cpus.def +++ b/gcc/config/rs6000/rs6000-cpus.def @@ -43,15 +43,6 @@ | OPTION_MASK_ALTIVEC \ | OPTION_MASK_VSX) -/* Determine whether to enable 16-bit floating point types on power8 systems - and above. */ -#if POWERPC_FLOAT16_DEFAULT -#define TARGET_16BIT_FLOATING_POINT OPTION_MASK_FLOAT16 - -#else -#define TARGET_16BIT_FLOATING_POINT 0 -#endif - /* For now, don't provide an embedded version of ISA 2.07. Do not set power8 fusion here, instead set it in rs6000.cc if we are tuning for a power8 system. */ @@ -61,8 +52,7 @@ | OPTION_MASK_CRYPTO \ | OPTION_MASK_EFFICIENT_UNALIGNED_VSX \ | OPTION_MASK_QUAD_MEMORY \ - | OPTION_MASK_QUAD_MEMORY_ATOMIC \ - | TARGET_16BIT_FLOATING_POINT) + | OPTION_MASK_QUAD_MEMORY_ATOMIC) /* ISA masks setting fusion options. */ #define OTHER_FUSION_MASKS (OPTION_MASK_P8_FUSION \ @@ -132,7 +122,6 @@ | OPTION_MASK_EFFICIENT_UNALIGNED_VSX \ | OPTION_MASK_FLOAT128_HW \ | OPTION_MASK_FLOAT128_KEYWORD \ - | OPTION_MASK_FLOAT16 \ | OPTION_MASK_FPRND \ | OPTION_MASK_POWER10 \ | OPTION_MASK_POWER11 \ diff --git a/gcc/config/rs6000/rs6000-modes.def b/gcc/config/rs6000/rs6000-modes.def index c03d1f9ed6d0..7140b634c414 100644 --- a/gcc/config/rs6000/rs6000-modes.def +++ b/gcc/config/rs6000/rs6000-modes.def @@ -45,13 +45,6 @@ FLOAT_MODE (TF, 16, ieee_quad_format); /* IBM 128-bit floating point. */ FLOAT_MODE (IF, 16, ibm_extended_format); -/* Explicit IEEE 16-bit floating point. */ -FLOAT_MODE (HF, 2, ieee_half_format); - -/* Explicit bfloat16 floating point. */ -FLOAT_MODE (BF, 2, arm_bfloat_half_format); -ADJUST_FLOAT_FORMAT (BF, &arm_bfloat_half_format); - /* Add any extra modes needed to represent the condition code. For the RS/6000, we need separate modes when unsigned (logical) comparisons @@ -77,8 +70,6 @@ VECTOR_MODES (FLOAT, 32); /* V16HF V8SF V4DF */ /* Half VMX/VSX vector (for internal use) */ VECTOR_MODE (FLOAT, SF, 2); /* V2SF */ VECTOR_MODE (INT, SI, 2); /* V2SI */ -VECTOR_MODE (FLOAT, BF, 4); /* V4BF */ -VECTOR_MODE (FLOAT, HF, 4); /* V4HF */ /* Replacement for TImode that only is allowed in GPRs. We also use PTImode for quad memory atomic operations to force getting an even/odd register diff --git a/gcc/config/rs6000/rs6000-p8swap.cc b/gcc/config/rs6000/rs6000-p8swap.cc index 75e9808fb0fd..f0c26c0265d5 100644 --- a/gcc/config/rs6000/rs6000-p8swap.cc +++ b/gcc/config/rs6000/rs6000-p8swap.cc @@ -1598,10 +1598,10 @@ rs6000_gen_stvx (enum machine_mode mode, rtx dest_exp, rtx src_exp) stvx = gen_altivec_stvx_v16qi (src_exp, dest_exp); else if (mode == V8HImode) stvx = gen_altivec_stvx_v8hi (src_exp, dest_exp); +#ifdef HAVE_V8HFmode else if (mode == V8HFmode) stvx = gen_altivec_stvx_v8hf (src_exp, dest_exp); - else if (mode == V8BFmode) - stvx = gen_altivec_stvx_v8bf (src_exp, dest_exp); +#endif else if (mode == V4SImode) stvx = gen_altivec_stvx_v4si (src_exp, dest_exp); else if (mode == V4SFmode) @@ -1722,10 +1722,10 @@ rs6000_gen_lvx (enum machine_mode mode, rtx dest_exp, rtx src_exp) lvx = gen_altivec_lvx_v16qi (dest_exp, src_exp); else if (mode == V8HImode) lvx = gen_altivec_lvx_v8hi (dest_exp, src_exp); +#ifdef HAVE_V8HFmode else if (mode == V8HFmode) lvx = gen_altivec_lvx_v8hf (dest_exp, src_exp); - else if (mode == V8BFmode) - lvx = gen_altivec_lvx_v8bf (dest_exp, src_exp); +#endif else if (mode == V4SImode) lvx = gen_altivec_lvx_v4si (dest_exp, src_exp); else if (mode == V4SFmode) @@ -1930,7 +1930,11 @@ replace_swapped_load_constant (swap_web_entry *insn_entry, rtx swap_insn) rtx new_const_vector = gen_rtx_CONST_VECTOR (mode, XVEC (vals, 0)); new_mem = force_const_mem (mode, new_const_vector); } - else if (mode == V8HImode || mode == V8HFmode || mode == V8BFmode) + else if ((mode == V8HImode) +#ifdef HAVE_V8HFmode + || (mode == V8HFmode) +#endif + ) { rtx vals = gen_rtx_PARALLEL (mode, rtvec_alloc (8)); int i; diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h index 0683a37b4156..09424ebaf970 100644 --- a/gcc/config/rs6000/rs6000-protos.h +++ b/gcc/config/rs6000/rs6000-protos.h @@ -250,7 +250,6 @@ typedef struct { bool all_words_same; /* Are the words all equal? */ bool all_half_words_same; /* Are the half words all equal? */ bool all_bytes_same; /* Are the bytes all equal? */ - machine_mode mode; /* Original constant mode. */ } vec_const_128bit_type; extern bool vec_const_128bit_to_bytes (rtx, machine_mode, @@ -258,21 +257,6 @@ extern bool vec_const_128bit_to_bytes (rtx, machine_mode, extern unsigned constant_generates_lxvkq (vec_const_128bit_type *); extern unsigned constant_generates_xxspltiw (vec_const_128bit_type *); extern unsigned constant_generates_xxspltidp (vec_const_128bit_type *); - -/* From float16.cc. */ -/* Optimize bfloat16 and float16 operations. */ -enum fp16_operation { - FP16_BINARY, /* Bfloat16/float16 binary op. */ - FP16_FMA, /* (a * b) + c. */ - FP16_FMS, /* (a * b) - c. */ - FP16_NFMA, /* - ((a * b) + c). */ - FP16_NFMS /* - ((a * b) - c). */ -}; - -extern void fp16_vectorization (enum rtx_code, rtx, rtx, rtx, rtx, - enum fp16_operation); -extern void bfloat16_operation_as_v4sf (enum rtx_code, rtx, rtx, rtx, rtx, - enum fp16_operation); #endif /* RTX_CODE */ #ifdef TREE_CODE diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index e2b20743d2eb..5562d612b22f 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -1892,8 +1892,7 @@ rs6000_hard_regno_mode_ok_uncached (int regno, machine_mode mode) if (ALTIVEC_REGNO_P (regno)) { - if (GET_MODE_SIZE (mode) < 16 && !reg_addr[mode].scalar_in_vmx_p - && !FP16_SCALAR_MODE_P (mode)) + if (GET_MODE_SIZE (mode) < 16 && !reg_addr[mode].scalar_in_vmx_p) return 0; return ALTIVEC_REGNO_P (last_regno); @@ -1983,8 +1982,7 @@ static bool rs6000_modes_tieable_p (machine_mode mode1, machine_mode mode2) { if (mode1 == PTImode || mode1 == OOmode || mode1 == XOmode - || mode2 == PTImode || mode2 == OOmode || mode2 == XOmode - || FP16_SCALAR_MODE_P (mode1) || FP16_SCALAR_MODE_P (mode2)) + || mode2 == PTImode || mode2 == OOmode || mode2 == XOmode) return mode1 == mode2; if (ALTIVEC_OR_VSX_VECTOR_MODE (mode1)) @@ -2249,8 +2247,6 @@ rs6000_debug_reg_global (void) DImode, TImode, PTImode, - BFmode, - HFmode, SFmode, DFmode, TFmode, @@ -2271,8 +2267,6 @@ rs6000_debug_reg_global (void) V8SImode, V4DImode, V2TImode, - V8BFmode, - V8HFmode, V4SFmode, V2DFmode, V8SFmode, @@ -2629,14 +2623,8 @@ rs6000_setup_reg_addr_masks (void) /* SDmode is special in that we want to access it only via REG+REG addressing on power7 and above, since we want to use the LFIWZX and - STFIWZX instructions to load it. - - Never allow offset addressing for 16-bit floating point modes, since - it is expected that 16-bit floating point should always go into the - vector registers and we only have indexed and indirect 16-bit loads to - VSR registers. */ - bool indexed_only_p = ((m == SDmode && TARGET_NO_SDMODE_STACK) - || FP16_SCALAR_MODE_P (m)); + STFIWZX instructions to load it. */ + bool indexed_only_p = (m == SDmode && TARGET_NO_SDMODE_STACK); any_addr_mask = 0; for (rc = FIRST_RELOAD_REG_CLASS; rc <= LAST_RELOAD_REG_CLASS; rc++) @@ -2685,7 +2673,6 @@ rs6000_setup_reg_addr_masks (void) && !complex_p && (m != E_DFmode || !TARGET_VSX) && (m != E_SFmode || !TARGET_P8_VECTOR) - && !FP16_SCALAR_MODE_P (m) && !small_int_vsx_p) { addr_mask |= RELOAD_REG_PRE_INCDEC; @@ -2902,24 +2889,18 @@ rs6000_init_hard_regno_mode_ok (bool global_init_p) rs6000_vector_unit[V16QImode] = VECTOR_ALTIVEC; rs6000_vector_align[V4SImode] = align32; rs6000_vector_align[V8HImode] = align32; - rs6000_vector_align[V8HFmode] = align32; - rs6000_vector_align[V8BFmode] = align32; rs6000_vector_align[V16QImode] = align32; if (TARGET_VSX) { rs6000_vector_mem[V4SImode] = VECTOR_VSX; rs6000_vector_mem[V8HImode] = VECTOR_VSX; - rs6000_vector_mem[V8HFmode] = VECTOR_VSX; - rs6000_vector_mem[V8BFmode] = VECTOR_VSX; rs6000_vector_mem[V16QImode] = VECTOR_VSX; } else { rs6000_vector_mem[V4SImode] = VECTOR_ALTIVEC; rs6000_vector_mem[V8HImode] = VECTOR_ALTIVEC; - rs6000_vector_mem[V8HFmode] = VECTOR_ALTIVEC; - rs6000_vector_mem[V8BFmode] = VECTOR_ALTIVEC; rs6000_vector_mem[V16QImode] = VECTOR_ALTIVEC; } } @@ -2939,21 +2920,6 @@ rs6000_init_hard_regno_mode_ok (bool global_init_p) rs6000_vector_align[V1TImode] = 128; } - /* _Float16 support. */ - if (TARGET_FLOAT16) - { - rs6000_vector_mem[HFmode] = VECTOR_VSX; - rs6000_vector_mem[BFmode] = VECTOR_VSX; - rs6000_vector_align[HFmode] = 16; - rs6000_vector_align[BFmode] = 16; - - if (TARGET_P9_VECTOR) - rs6000_vector_unit[V8HFmode] = VECTOR_VSX; - - if (TARGET_POWER10) - rs6000_vector_unit[V8BFmode] = VECTOR_VSX; - } - /* DFmode, see if we want to use the VSX unit. Memory is handled differently, so don't set rs6000_vector_mem. */ if (TARGET_VSX) @@ -3035,10 +3001,6 @@ rs6000_init_hard_regno_mode_ok (bool global_init_p) reg_addr[V16QImode].reload_load = CODE_FOR_reload_v16qi_di_load; reg_addr[V8HImode].reload_store = CODE_FOR_reload_v8hi_di_store; reg_addr[V8HImode].reload_load = CODE_FOR_reload_v8hi_di_load; - reg_addr[V8BFmode].reload_store = CODE_FOR_reload_v8bf_di_store; - reg_addr[V8BFmode].reload_load = CODE_FOR_reload_v8bf_di_load; - reg_addr[V8HFmode].reload_store = CODE_FOR_reload_v8hf_di_store; - reg_addr[V8HFmode].reload_load = CODE_FOR_reload_v8hf_di_load; reg_addr[V4SImode].reload_store = CODE_FOR_reload_v4si_di_store; reg_addr[V4SImode].reload_load = CODE_FOR_reload_v4si_di_load; reg_addr[V2DImode].reload_store = CODE_FOR_reload_v2di_di_store; @@ -3068,14 +3030,6 @@ rs6000_init_hard_regno_mode_ok (bool global_init_p) reg_addr[TFmode].reload_load = CODE_FOR_reload_tf_di_load; } - if (TARGET_FLOAT16) - { - reg_addr[HFmode].reload_store = CODE_FOR_reload_hf_di_store; - reg_addr[BFmode].reload_store = CODE_FOR_reload_bf_di_store; - reg_addr[HFmode].reload_load = CODE_FOR_reload_hf_di_load; - reg_addr[BFmode].reload_load = CODE_FOR_reload_bf_di_load; - } - /* Only provide a reload handler for SDmode if lfiwzx/stfiwx are available. */ if (TARGET_NO_SDMODE_STACK) @@ -3098,8 +3052,6 @@ rs6000_init_hard_regno_mode_ok (bool global_init_p) reg_addr[V2DImode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv2di; reg_addr[V4SFmode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv4sf; reg_addr[V4SImode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv4si; - reg_addr[V8BFmode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv8bf; - reg_addr[V8HFmode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv8hf; reg_addr[V8HImode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv8hi; reg_addr[V16QImode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv16qi; reg_addr[SFmode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxsf; @@ -3110,8 +3062,6 @@ rs6000_init_hard_regno_mode_ok (bool global_init_p) reg_addr[V2DImode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv2di; reg_addr[V4SFmode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv4sf; reg_addr[V4SImode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv4si; - reg_addr[V8BFmode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv8bf; - reg_addr[V8HFmode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv8hf; reg_addr[V8HImode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv8hi; reg_addr[V16QImode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv16qi; reg_addr[SFmode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprsf; @@ -3149,10 +3099,6 @@ rs6000_init_hard_regno_mode_ok (bool global_init_p) reg_addr[V2DImode].reload_load = CODE_FOR_reload_v2di_si_load; reg_addr[V1TImode].reload_store = CODE_FOR_reload_v1ti_si_store; reg_addr[V1TImode].reload_load = CODE_FOR_reload_v1ti_si_load; - reg_addr[V8BFmode].reload_store = CODE_FOR_reload_v8bf_si_store; - reg_addr[V8BFmode].reload_load = CODE_FOR_reload_v8bf_si_load; - reg_addr[V8HFmode].reload_store = CODE_FOR_reload_v8hf_si_store; - reg_addr[V8HFmode].reload_load = CODE_FOR_reload_v8hf_si_load; reg_addr[V4SFmode].reload_store = CODE_FOR_reload_v4sf_si_store; reg_addr[V4SFmode].reload_load = CODE_FOR_reload_v4sf_si_load; reg_addr[V2DFmode].reload_store = CODE_FOR_reload_v2df_si_store; @@ -3176,14 +3122,6 @@ rs6000_init_hard_regno_mode_ok (bool global_init_p) reg_addr[TFmode].reload_load = CODE_FOR_reload_tf_si_load; } - if (TARGET_FLOAT16) - { - reg_addr[HFmode].reload_store = CODE_FOR_reload_hf_si_store; - reg_addr[BFmode].reload_store = CODE_FOR_reload_bf_si_store; - reg_addr[HFmode].reload_load = CODE_FOR_reload_hf_si_load; - reg_addr[BFmode].reload_load = CODE_FOR_reload_bf_si_load; - } - /* Only provide a reload handler for SDmode if lfiwzx/stfiwx are available. */ if (TARGET_NO_SDMODE_STACK) @@ -3923,19 +3861,6 @@ rs6000_option_override_internal (bool global_init_p) } } - /* 16-bit floating point needs 64-bit power8 at a minimum in order to load up - 16-bit values into vector registers via loads/stores from GPRs and then - using direct moves. Don't allow 16-bit float on big endian systems at the - current time. */ - if (TARGET_FLOAT16 && (!TARGET_DIRECT_MOVE_64BIT || BYTES_BIG_ENDIAN)) - { - rs6000_isa_flags &= ~OPTION_MASK_FLOAT16; - if (rs6000_isa_flags_explicit & OPTION_MASK_FLOAT16) - error ("%qs is only available on 64-bit little endian systems " - "that use at least %qs", - "-mfloat16", "-mcpu=power8"); - } - /* If hard-float/altivec/vsx were explicitly turned off then don't allow the -mcpu setting to enable options that conflict. */ if ((!TARGET_HARD_FLOAT || !TARGET_ALTIVEC || !TARGET_VSX) @@ -6516,12 +6441,6 @@ easy_altivec_constant (rtx op, machine_mode mode) return 0; } - /* For 16-bit floating point vectors, only allow 0.0 and -0.0 as easy altivec - constants. */ - if (FP16_VECTOR_MODE_P (mode)) - return (zero_constant (op, mode) || minus_zero_constant (op, mode) - ? 8 : 0); - /* V1TImode is a special container for TImode. Ignore for now. */ else if (mode == V1TImode) return 0; @@ -6629,12 +6548,6 @@ xxspltib_constant_p (rtx op, /* Handle (vec_duplicate <constant>). */ if (GET_CODE (op) == VEC_DUPLICATE) { - element = XEXP (op, 0); - - /* For 16-bit floating point, the only valid use is xxspltib is 0.0. */ - if (FP16_VECTOR_MODE_P (mode)) - return element == CONST0_RTX (GET_MODE_INNER (mode)); - if (mode != V16QImode && mode != V8HImode && mode != V4SImode && mode != V2DImode) return false; @@ -6651,20 +6564,6 @@ xxspltib_constant_p (rtx op, /* Handle (const_vector [...]). */ else if (GET_CODE (op) == CONST_VECTOR) { - /* For V8BFmode & V8HFmode, the only valid use is xxspltib is 0.0. */ - if (FP16_VECTOR_MODE_P (mode)) - { - if (op == CONST0_RTX (mode)) - return true; - - rtx zero = CONST0_RTX (GET_MODE_INNER (mode)); - for (i = 0; i < nunits; i++) - if (CONST_VECTOR_ELT (op, i) != zero) - return false; - - return true; - } - if (mode != V16QImode && mode != V8HImode && mode != V4SImode && mode != V2DImode) return false; @@ -6881,8 +6780,6 @@ output_vec_const_move (rtx *operands) return "vspltisw %0,%1"; case E_V8HImode: - case E_V8HFmode: - case E_V8BFmode: return "vspltish %0,%1"; case E_V16QImode: @@ -7111,15 +7008,6 @@ rs6000_expand_vector_init (rtx target, rtx vals) return; } - /* Special case splats of 16-bit floating point. */ - if (all_same && FP16_VECTOR_MODE_P (mode)) - { - rtx op0 = force_reg (GET_MODE_INNER (mode), XVECEXP (vals, 0, 0)); - rtx dup = gen_rtx_VEC_DUPLICATE (mode, op0); - emit_insn (gen_rtx_SET (target, dup)); - return; - } - /* Special case initializing vector short/char that are splats if we are on 64-bit systems with direct move. */ if (all_same && TARGET_DIRECT_MOVE_64BIT @@ -7614,10 +7502,6 @@ rs6000_expand_vector_set (rtx target, rtx val, rtx elt_rtx) insn = gen_vsx_set_v4si_p9 (target, target, val, elt_rtx); else if (mode == V8HImode) insn = gen_vsx_set_v8hi_p9 (target, target, val, elt_rtx); - else if (mode == V8HFmode) - insn = gen_vsx_set_v8hf_p9 (target, target, val, elt_rtx); - else if (mode == V8BFmode) - insn = gen_vsx_set_v8bf_p9 (target, target, val, elt_rtx); else if (mode == V16QImode) insn = gen_vsx_set_v16qi_p9 (target, target, val, elt_rtx); else if (mode == V4SFmode) @@ -7735,22 +7619,6 @@ rs6000_expand_vector_extract (rtx target, rtx vec, rtx elt) } else break; - case E_V8HFmode: - if (TARGET_DIRECT_MOVE_64BIT) - { - emit_insn (gen_vsx_extract_v8hf (target, vec, elt)); - return; - } - else - break; - case E_V8BFmode: - if (TARGET_DIRECT_MOVE_64BIT) - { - emit_insn (gen_vsx_extract_v8bf (target, vec, elt)); - return; - } - else - break; case E_V4SImode: if (TARGET_DIRECT_MOVE_64BIT) { @@ -7798,14 +7666,6 @@ rs6000_expand_vector_extract (rtx target, rtx vec, rtx elt) emit_insn (gen_vsx_extract_v8hi_var (target, vec, elt)); return; - case E_V8HFmode: - emit_insn (gen_vsx_extract_v8hf_var (target, vec, elt)); - return; - - case E_V8BFmode: - emit_insn (gen_vsx_extract_v8bf_var (target, vec, elt)); - return; - case E_V16QImode: emit_insn (gen_vsx_extract_v16qi_var (target, vec, elt)); return; @@ -8083,10 +7943,7 @@ rs6000_split_vec_extract_var (rtx dest, rtx src, rtx element, rtx tmp_gpr, /* See if we want to generate VEXTU{B,H,W}{L,R}X if the destination is in a general purpose register. */ if (TARGET_P9_VECTOR - && (mode == V16QImode - || mode == V8HImode - || mode == V4SImode - || FP16_VECTOR_MODE_P (mode)) + && (mode == V16QImode || mode == V8HImode || mode == V4SImode) && INT_REGNO_P (dest_regno) && ALTIVEC_REGNO_P (src_regno) && INT_REGNO_P (element_regno)) @@ -8099,7 +7956,7 @@ rs6000_split_vec_extract_var (rtx dest, rtx src, rtx element, rtx tmp_gpr, ? gen_vextublx (dest_si, element_si, src) : gen_vextubrx (dest_si, element_si, src)); - else if (mode == V8HImode || FP16_VECTOR_MODE_P (mode)) + else if (mode == V8HImode) { rtx tmp_gpr_si = gen_rtx_REG (SImode, REGNO (tmp_gpr)); emit_insn (gen_ashlsi3 (tmp_gpr_si, element_si, const1_rtx)); @@ -8201,8 +8058,6 @@ rs6000_split_vec_extract_var (rtx dest, rtx src, rtx element, rtx tmp_gpr, case E_V4SImode: case E_V8HImode: - case E_V8HFmode: - case E_V8BFmode: case E_V16QImode: { rtx tmp_altivec_di = gen_rtx_REG (DImode, REGNO (tmp_altivec)); @@ -8791,8 +8646,6 @@ reg_offset_addressing_ok_p (machine_mode mode) { case E_V16QImode: case E_V8HImode: - case E_V8HFmode: - case E_V8BFmode: case E_V4SFmode: case E_V4SImode: case E_V2DFmode: @@ -8817,13 +8670,6 @@ reg_offset_addressing_ok_p (machine_mode mode) case E_XOmode: return TARGET_MMA; - /* For 16-bit floating point types, do not allow offset addressing, since - it is assumed that most of the use will be in vector registers, and we - only have reg+reg addressing for 16-bit modes. */ - case E_BFmode: - case E_HFmode: - return false; - case E_SDmode: /* If we can do direct load/stores of SDmode, restrict it to reg+reg addressing for the LFIWZX and STFIWX instructions. */ @@ -9108,13 +8954,6 @@ rs6000_legitimate_offset_address_p (machine_mode mode, rtx x, extra = 0; switch (mode) { - /* For 16-bit floating point types, do not allow offset addressing, since - it is assumed that most of the use will be in vector registers, and we - only have reg+reg addressing for 16-bit modes. */ - case E_BFmode: - case E_HFmode: - return false; - case E_DFmode: case E_DDmode: case E_DImode: @@ -9216,11 +9055,6 @@ macho_lo_sum_memory_operand (rtx x, machine_mode mode) static bool legitimate_lo_sum_address_p (machine_mode mode, rtx x, int strict) { - /* For 16-bit floating point types, do not allow offset addressing, since - it is assumed that most of the use will be in vector registers, and we - only have reg+reg addressing for 16-bit modes. */ - if (FP16_SCALAR_MODE_P (mode)) - return false; if (GET_CODE (x) != LO_SUM) return false; if (!REG_P (XEXP (x, 0))) @@ -10917,8 +10751,6 @@ rs6000_const_vec (machine_mode mode) subparts = 4; break; case E_V8HImode: - case E_V8HFmode: - case E_V8BFmode: subparts = 8; break; case E_V16QImode: @@ -11374,8 +11206,6 @@ rs6000_emit_move (rtx dest, rtx source, machine_mode mode) case E_V16QImode: case E_V8HImode: - case E_V8HFmode: - case E_V8BFmode: case E_V4SFmode: case E_V4SImode: case E_V2DFmode: @@ -12817,9 +12647,6 @@ rs6000_secondary_reload_simple_move (enum rs6000_reg_type to_type, && ((to_type == GPR_REG_TYPE && from_type == VSX_REG_TYPE) || (to_type == VSX_REG_TYPE && from_type == GPR_REG_TYPE))) { - if (FP16_SCALAR_MODE_P (mode)) - return true; - if (TARGET_POWERPC64) { /* ISA 2.07: MTVSRD or MVFVSRD. */ @@ -13607,11 +13434,6 @@ rs6000_preferred_reload_class (rtx x, enum reg_class rclass) || mode_supports_dq_form (mode)) return rclass; - /* IEEE 16-bit and bfloat16 don't support offset addressing, but they can - go in any floating point/vector register. */ - if (FP16_SCALAR_MODE_P (mode)) - return rclass; - /* If this is a scalar floating point value and we don't have D-form addressing, prefer the traditional floating point registers so that we can use D-form (register+offset) addressing. */ @@ -13629,16 +13451,6 @@ rs6000_preferred_reload_class (rtx x, enum reg_class rclass) return rclass; } - /* For 16-bit floating point scalar modes, if we have lxsihzx/stxsihzx from - Power9, prefer the vector registers. On power8, we will need to use GPRs - to do load/store. For 16-bit floating point vector modes, only prefer - VSX. */ - if (FP16_VECTOR_MODE_P (mode)) - return TARGET_P9_VECTOR ? VSX_REGS : rclass; - - if (FP16_VECTOR_MODE_P (mode)) - return VSX_REGS; - if (is_constant || GET_CODE (x) == PLUS) { if (reg_class_subset_p (GENERAL_REGS, rclass)) @@ -13851,9 +13663,6 @@ rs6000_can_change_mode_class (machine_mode from, unsigned from_size = GET_MODE_SIZE (from); unsigned to_size = GET_MODE_SIZE (to); - if (FP16_SCALAR_MODE_P (from) || FP16_SCALAR_MODE_P (to)) - return from_size == to_size; - if (from_size != to_size) { enum reg_class xclass = (TARGET_VSX) ? VSX_REGS : FLOAT_REGS; @@ -14071,8 +13880,7 @@ rs6000_output_move_128bit (rtx operands[]) else if (TARGET_P9_VECTOR) return "lxvx %x0,%y1"; - else if (mode == V16QImode || mode == V8HImode || mode == V4SImode - || FP16_VECTOR_MODE_P (mode)) + else if (mode == V16QImode || mode == V8HImode || mode == V4SImode) return "lxvw4x %x0,%y1"; else @@ -14110,8 +13918,7 @@ rs6000_output_move_128bit (rtx operands[]) else if (TARGET_P9_VECTOR) return "stxvx %x1,%y0"; - else if (mode == V16QImode || mode == V8HImode || mode == V4SImode - || FP16_VECTOR_MODE_P (mode)) + else if (mode == V16QImode || mode == V8HImode || mode == V4SImode) return "stxvw4x %x1,%y0"; else @@ -23142,7 +22949,7 @@ rs6000_load_constant_and_splat (machine_mode mode, REAL_VALUE_TYPE dconst) { rtx reg; - if (mode == SFmode || mode == DFmode || FP16_SCALAR_MODE_P (mode)) + if (mode == SFmode || mode == DFmode) { rtx d = const_double_from_real_value (dconst, mode); reg = force_reg (mode, d); @@ -24469,8 +24276,6 @@ rs6000_scalar_mode_supported_p (scalar_mode mode) return default_decimal_float_supported_p (); else if (TARGET_FLOAT128_TYPE && (mode == KFmode || mode == IFmode)) return true; - else if (FP16_SCALAR_MODE_P (mode)) - return true; else return default_scalar_mode_supported_p (mode); } @@ -24495,10 +24300,6 @@ rs6000_libgcc_floating_mode_supported_p (scalar_float_mode mode) case E_KFmode: return TARGET_FLOAT128_TYPE && !TARGET_IEEEQUAD; - case E_BFmode: - case E_HFmode: - return TARGET_FLOAT16; - default: return false; } @@ -24526,9 +24327,6 @@ rs6000_floatn_mode (int n, bool extended) { switch (n) { - case 16: - return TARGET_FLOAT16 ? SFmode : opt_scalar_float_mode (); - case 32: return DFmode; @@ -24550,9 +24348,6 @@ rs6000_floatn_mode (int n, bool extended) { switch (n) { - case 16: - return TARGET_FLOAT16 ? HFmode : opt_scalar_float_mode (); - case 32: return SFmode; @@ -24675,7 +24470,6 @@ static struct rs6000_opt_mask const rs6000_opt_masks[] = { "future", OPTION_MASK_FUTURE, false, false }, { "hard-dfp", OPTION_MASK_DFP, false, true }, { "htm", OPTION_MASK_HTM, false, true }, - { "float16", OPTION_MASK_FLOAT16, false, true }, { "isel", OPTION_MASK_ISEL, false, true }, { "mfcrf", OPTION_MASK_MFCRF, false, true }, { "mfpgpr", 0, false, true }, @@ -29096,37 +28890,24 @@ constant_fp_to_128bit_vector (rtx op, const REAL_VALUE_TYPE *rtype = CONST_DOUBLE_REAL_VALUE (op); long real_words[VECTOR_128BIT_WORDS]; - /* For 16-bit floating point, the constant doesn't fill the whole 32-bit - word. Deal with it here, storing the bytes in big endian fashion. */ - if (FP16_SCALAR_MODE_P (mode)) - { - real_to_target (real_words, rtype, mode); - info->bytes[byte_num] = (unsigned char) (real_words[0] >> 8); - info->bytes[byte_num+1] = (unsigned char) (real_words[0]); - } + /* Make sure we don't overflow the real_words array and that it is + filled completely. */ + gcc_assert (num_words <= VECTOR_128BIT_WORDS && (bitsize % 32) == 0); - else - { - /* Make sure we don't overflow the real_words array and that it is filled - completely. */ - gcc_assert (num_words <= VECTOR_128BIT_WORDS && (bitsize % 32) == 0); + real_to_target (real_words, rtype, mode); - real_to_target (real_words, rtype, mode); - - /* Iterate over each 32-bit word in the floating point constant. The - real_to_target function puts out words in target endian fashion. We - need to arrange the order so that the bytes are written in big endian - order. */ - for (unsigned num = 0; num < num_words; num++) - { - unsigned endian_num = (BYTES_BIG_ENDIAN - ? num - : num_words - 1 - num); + /* Iterate over each 32-bit word in the floating point constant. The + real_to_target function puts out words in target endian fashion. We need + to arrange the order so that the bytes are written in big endian order. */ + for (unsigned num = 0; num < num_words; num++) + { + unsigned endian_num = (BYTES_BIG_ENDIAN + ? num + : num_words - 1 - num); - unsigned uvalue = real_words[endian_num]; - for (int shift = 32 - 8; shift >= 0; shift -= 8) - info->bytes[byte_num++] = (uvalue >> shift) & 0xff; - } + unsigned uvalue = real_words[endian_num]; + for (int shift = 32 - 8; shift >= 0; shift -= 8) + info->bytes[byte_num++] = (uvalue >> shift) & 0xff; } /* Mark that this constant involves floating point. */ @@ -29165,7 +28946,6 @@ vec_const_128bit_to_bytes (rtx op, return false; /* Set up the bits. */ - info->mode = mode; switch (GET_CODE (op)) { /* Integer constants, default to double word. */ @@ -29393,10 +29173,6 @@ constant_generates_xxspltiw (vec_const_128bit_type *vsx_const) if (!TARGET_SPLAT_WORD_CONSTANT || !TARGET_PREFIXED || !TARGET_VSX) return 0; - /* HFmode/BFmode constants can always use XXSPLTIW. */ - if (FP16_SCALAR_MODE_P (vsx_const->mode)) - return 1; - if (!vsx_const->all_words_same) return 0; diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index f52a136d4880..401f50ead4f4 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -343,26 +343,6 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); || ((MODE) == TDmode) \ || (!TARGET_FLOAT128_TYPE && FLOAT128_IEEE_P (MODE))) -/* Is this a valid 16-bit scalar floating point mode? */ -#define FP16_SCALAR_MODE_P(MODE) \ - (TARGET_FLOAT16 && ((MODE) == HFmode || (MODE) == BFmode)) - -/* Is this a valid 16-bit scalar floating point mode? */ -#define FP16_VECTOR_MODE_P(MODE) \ - (TARGET_FLOAT16 && ((MODE) == V8HFmode || (MODE) == V8BFmode)) - -/* Do we have conversion support in hardware for the 16-bit floating point? */ -#define TARGET_BFLOAT16_HW (TARGET_FLOAT16 && TARGET_POWER10) -#define TARGET_FLOAT16_HW (TARGET_FLOAT16 && TARGET_P9_VECTOR) - -/* Do we have conversion support in hardware for the 16-bit floating point and - also enable the 16-bit floating point vector optimizations? */ -#define TARGET_BFLOAT16_HW_VECTOR \ - (TARGET_FLOAT16 && TARGET_POWER10 && TARGET_BFLOAT16_VECTOR) - -#define TARGET_FLOAT16_HW_VECTOR \ - (TARGET_FLOAT16 && TARGET_POWER9 && TARGET_FLOAT16_VECTOR) - /* Return true for floating point that does not use a vector register. */ #define SCALAR_FLOAT_MODE_NOT_VECTOR_P(MODE) \ (SCALAR_FLOAT_MODE_P (MODE) && !FLOAT128_VECTOR_P (MODE)) @@ -1000,8 +980,6 @@ enum data_align { align_abi, align_opt, align_both }; #define ALTIVEC_VECTOR_MODE(MODE) \ ((MODE) == V16QImode \ || (MODE) == V8HImode \ - || (MODE) == V8HFmode \ - || (MODE) == V8BFmode \ || (MODE) == V4SFmode \ || (MODE) == V4SImode \ || VECTOR_ALIGNMENT_P (MODE)) diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 91c9cd55b427..2ccbe178bb53 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -552,8 +552,6 @@ (define_mode_iterator FMOVE128_GPR [TI V16QI V8HI - V8BF - V8HF V4SI V4SF V2DI @@ -714,14 +712,10 @@ ; A generic w/d attribute, for things like cmpw/cmpd. (define_mode_attr wd [(QI "b") (HI "h") - (BF "h") - (HF "h") (SI "w") (DI "d") (V16QI "b") (V8HI "h") - (V8BF "h") - (V8HF "h") (V4SI "w") (V2DI "d") (V1TI "q") @@ -734,8 +728,6 @@ (DI "d") (V16QI "du") (V8HI "du") - (V8BF "du") - (V8HF "du") (V4SI "du") (V2DI "d")]) @@ -785,8 +777,6 @@ PTI (V16QI "TARGET_ALTIVEC") (V8HI "TARGET_ALTIVEC") - (V8BF "TARGET_ALTIVEC") - (V8HF "TARGET_ALTIVEC") (V4SI "TARGET_ALTIVEC") (V4SF "TARGET_ALTIVEC") (V2DI "TARGET_ALTIVEC") @@ -804,8 +794,6 @@ (PTI "&r,r,r") (V16QI "wa,v,&?r,?r,?r") (V8HI "wa,v,&?r,?r,?r") - (V8BF "wa,v,&?r,?r,?r") - (V8HF "wa,v,&?r,?r,?r") (V4SI "wa,v,&?r,?r,?r") (V4SF "wa,v,&?r,?r,?r") (V2DI "wa,v,&?r,?r,?r") @@ -817,8 +805,6 @@ (PTI "r,0,r") (V16QI "wa,v,r,0,r") (V8HI "wa,v,r,0,r") - (V8BF "wa,v,r,0,r") - (V8HF "wa,v,r,0,r") (V4SI "wa,v,r,0,r") (V4SF "wa,v,r,0,r") (V2DI "wa,v,r,0,r") @@ -830,8 +816,6 @@ (PTI "r,r,0") (V16QI "wa,v,r,r,0") (V8HI "wa,v,r,r,0") - (V8BF "wa,v,r,r,0") - (V8HF "wa,v,r,r,0") (V4SI "wa,v,r,r,0") (V4SF "wa,v,r,r,0") (V2DI "wa,v,r,r,0") @@ -845,8 +829,6 @@ (PTI "r,0,0") (V16QI "wa,v,r,0,0") (V8HI "wa,v,r,0,0") - (V8BF "wa,v,r,0,0") - (V8HF "wa,v,r,0,0") (V4SI "wa,v,r,0,0") (V4SF "wa,v,r,0,0") (V2DI "wa,v,r,0,0") @@ -855,8 +837,8 @@ ;; Reload iterator for creating the function to allocate a base register to ;; supplement addressing modes. -(define_mode_iterator RELOAD [V16QI V8HI V8BF V8HF V4SI V2DI V4SF V2DF V1TI - SF SD SI DF DD DI TI PTI KF IF TF HF BF +(define_mode_iterator RELOAD [V16QI V8HI V4SI V2DI V4SF V2DF V1TI + SF SD SI DF DD DI TI PTI KF IF TF OO XO]) ;; Iterate over smin, smax @@ -15893,4 +15875,3 @@ (include "htm.md") (include "fusion.md") (include "pcrel-opt.md") -(include "float16.md") diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt index ddbf1c882f16..2b6ec5222fc1 100644 --- a/gcc/config/rs6000/rs6000.opt +++ b/gcc/config/rs6000/rs6000.opt @@ -638,10 +638,6 @@ mieee128-constant Target Var(TARGET_IEEE128_CONSTANT) Init(1) Save Generate (do not generate) code that uses the LXVKQ instruction. -mfloat16 -Target Mask(FLOAT16) Var(rs6000_isa_flags) -Enable or disable 16-bit floating point. - ; Documented parameters -param=rs6000-vect-unroll-limit= diff --git a/gcc/config/rs6000/t-rs6000 b/gcc/config/rs6000/t-rs6000 index 48c455f917dd..dc5aa87c9c7c 100644 --- a/gcc/config/rs6000/t-rs6000 +++ b/gcc/config/rs6000/t-rs6000 @@ -87,10 +87,6 @@ rs6000-c.o: $(srcdir)/config/rs6000/rs6000-c.cc rs6000-builtins.h $(COMPILE) $< $(POSTCOMPILE) -float16.o: $(srcdir)/config/rs6000/float16.cc - $(COMPILE) $< - $(POSTCOMPILE) - #$(srcdir)/config/rs6000/fusion.md: $(srcdir)/config/rs6000/genfusion.pl # $(srcdir)/config/rs6000/genfusion.pl > $(srcdir)/config/rs6000/fusion.md diff --git a/gcc/config/rs6000/vector.md b/gcc/config/rs6000/vector.md index 60c4c93aca54..22eee2f81f05 100644 --- a/gcc/config/rs6000/vector.md +++ b/gcc/config/rs6000/vector.md @@ -50,31 +50,11 @@ (define_mode_iterator VEC_K [V16QI V8HI V4SI V4SF]) ;; Vector logical modes -(define_mode_iterator VEC_L [V16QI - V8HI - V8BF - V8HF - V4SI - V2DI - V4SF - V2DF - V1TI - TI - KF - TF]) +(define_mode_iterator VEC_L [V16QI V8HI V4SI V2DI V4SF V2DF V1TI TI KF TF]) ;; Vector modes for moves. Don't do TImode or TFmode here, since their ;; moves are handled elsewhere. -(define_mode_iterator VEC_M [V16QI - V8HI - V4SI - V2DI - V8BF - V8HF - V4SF - V2DF - V1TI - KF]) +(define_mode_iterator VEC_M [V16QI V8HI V4SI V2DI V4SF V2DF V1TI KF]) ;; Vector modes for types that don't need a realignment under VSX (define_mode_iterator VEC_N [V4SI V4SF V2DI V2DF V1TI KF TF]) @@ -83,14 +63,7 @@ (define_mode_iterator VEC_C [V16QI V8HI V4SI V2DI V4SF V2DF V1TI]) ;; Vector init/extract modes -(define_mode_iterator VEC_E [V16QI - V8HI - V4SI - V2DI - V8BF - V8HF - V4SF - V2DF]) +(define_mode_iterator VEC_E [V16QI V8HI V4SI V2DI V4SF V2DF]) ;; Vector modes for 64-bit base types (define_mode_iterator VEC_64 [V2DI V2DF]) @@ -103,8 +76,6 @@ (V8HI "HI") (V4SI "SI") (V2DI "DI") - (V8BF "BF") - (V8HF "HF") (V4SF "SF") (V2DF "DF") (V1TI "TI") @@ -115,8 +86,6 @@ (V8HI "hi") (V4SI "si") (V2DI "di") - (V8BF "bf") - (V8HF "hf") (V4SF "sf") (V2DF "df") (V1TI "ti") diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md index 615aecbd992a..1305eff8cddb 100644 --- a/gcc/config/rs6000/vsx.md +++ b/gcc/config/rs6000/vsx.md @@ -46,14 +46,9 @@ ;; Iterator for vector floating point types supported by VSX (define_mode_iterator VSX_F [V4SF V2DF]) -;; Iterator for 8 element vectors -(define_mode_iterator VECTOR_16BIT [V8HI V8BF V8HF]) - ;; Iterator for logical types supported by VSX (define_mode_iterator VSX_L [V16QI V8HI - V8BF - V8HF V4SI V2DI V4SF @@ -66,8 +61,6 @@ ;; Iterator for memory moves. (define_mode_iterator VSX_M [V16QI V8HI - V8BF - V8HF V4SI V2DI V4SF @@ -78,8 +71,6 @@ TI]) (define_mode_attr VSX_XXBR [(V8HI "h") - (V8BF "h") - (V8HF "h") (V4SI "w") (V4SF "w") (V2DF "d") @@ -89,8 +80,6 @@ ;; Map into the appropriate load/store name based on the type (define_mode_attr VSm [(V16QI "vw4") (V8HI "vw4") - (V8BF "vw4") - (V8HF "vw4") (V4SI "vw4") (V4SF "vw4") (V2DF "vd2") @@ -104,8 +93,6 @@ ;; Map the register class used (define_mode_attr VSr [(V16QI "v") (V8HI "v") - (V8BF "wa") - (V8HF "wa") (V4SI "v") (V4SF "wa") (V2DI "wa") @@ -121,8 +108,6 @@ ;; What value we need in the "isa" field, to make the IEEE QP float work. (define_mode_attr VSisa [(V16QI "*") (V8HI "*") - (V8BF "*") - (V8HF "*") (V4SI "*") (V4SF "*") (V2DI "*") @@ -139,8 +124,6 @@ ;; integer modes. (define_mode_attr ??r [(V16QI "??r") (V8HI "??r") - (V8BF "??r") - (V8HF "??r") (V4SI "??r") (V4SF "??r") (V2DI "??r") @@ -153,8 +136,6 @@ ;; A mode attribute used for 128-bit constant values. (define_mode_attr nW [(V16QI "W") (V8HI "W") - (V8BF "W") - (V8HF "W") (V4SI "W") (V4SF "W") (V2DI "W") @@ -182,8 +163,6 @@ ;; operation (define_mode_attr VSv [(V16QI "v") (V8HI "v") - (V8BF "v") - (V8HF "v") (V4SI "v") (V4SF "v") (V2DI "v") @@ -224,30 +203,24 @@ ;; Iterator for ISA 3.0 vector extract/insert of small integer vectors. ;; VSX_EXTRACT_I2 doesn't include V4SImode because SI extracts can be ;; done on ISA 2.07 and not just ISA 3.0. -(define_mode_iterator VSX_EXTRACT_I [V16QI V8HI V8HF V8BF V4SI]) -(define_mode_iterator VSX_EXTRACT_I2 [V16QI V8HI V8HF V8BF]) -(define_mode_iterator VSX_EXTRACT_I4 [V16QI V8HI V8HF V8BF V4SI V2DI]) +(define_mode_iterator VSX_EXTRACT_I [V16QI V8HI V4SI]) +(define_mode_iterator VSX_EXTRACT_I2 [V16QI V8HI]) +(define_mode_iterator VSX_EXTRACT_I4 [V16QI V8HI V4SI V2DI]) (define_mode_attr VSX_EXTRACT_WIDTH [(V16QI "b") (V8HI "h") - (V8HF "h") - (V8BF "h") (V4SI "w")]) ;; Mode attribute to give the correct predicate for ISA 3.0 vector extract and ;; insert to validate the operand number. (define_mode_attr VSX_EXTRACT_PREDICATE [(V16QI "const_0_to_15_operand") (V8HI "const_0_to_7_operand") - (V8HF "const_0_to_7_operand") - (V8BF "const_0_to_7_operand") (V4SI "const_0_to_3_operand")]) ;; Mode attribute to give the constraint for vector extract and insert ;; operations. (define_mode_attr VSX_EX [(V16QI "v") (V8HI "v") - (V8HF "v") - (V8BF "v") (V4SI "wa")]) ;; Mode iterator for binary floating types other than double to @@ -423,8 +396,6 @@ ;; Like VM2 in altivec.md, just do char, short, int, long, float and double (define_mode_iterator VM3 [V4SI V8HI - V8BF - V8HF V16QI V4SF V2DF @@ -436,8 +407,6 @@ (define_mode_attr VM3_char [(V2DI "d") (V4SI "w") (V8HI "h") - (V8BF "h") - (V8HF "h") (V16QI "b") (V2DF "d") (V4SF "w")]) @@ -572,21 +541,21 @@ [(set_attr "type" "vecload") (set_attr "length" "8")]) -(define_insn_and_split "*vsx_le_perm_load_<mode>" - [(set (match_operand:VECTOR_16BIT 0 "vsx_register_operand" "=wa") - (match_operand:VECTOR_16BIT 1 "indexed_or_indirect_operand" "Z"))] +(define_insn_and_split "*vsx_le_perm_load_v8hi" + [(set (match_operand:V8HI 0 "vsx_register_operand" "=wa") + (match_operand:V8HI 1 "indexed_or_indirect_operand" "Z"))] "!BYTES_BIG_ENDIAN && TARGET_VSX && !TARGET_P9_VECTOR" "#" "&& 1" [(set (match_dup 2) - (vec_select:VECTOR_16BIT + (vec_select:V8HI (match_dup 1) (parallel [(const_int 4) (const_int 5) (const_int 6) (const_int 7) (const_int 0) (const_int 1) (const_int 2) (const_int 3)]))) (set (match_dup 0) - (vec_select:VECTOR_16BIT + (vec_select:V8HI (match_dup 2) (parallel [(const_int 4) (const_int 5) (const_int 6) (const_int 7) @@ -833,27 +802,27 @@ (const_int 0) (const_int 1)])))] "") -(define_insn "*vsx_le_perm_store_<mode>" - [(set (match_operand:VECTOR_16BIT 0 "indexed_or_indirect_operand" "=Z") - (match_operand:VECTOR_16BIT 1 "vsx_register_operand" "wa"))] +(define_insn "*vsx_le_perm_store_v8hi" + [(set (match_operand:V8HI 0 "indexed_or_indirect_operand" "=Z") + (match_operand:V8HI 1 "vsx_register_operand" "wa"))] "!BYTES_BIG_ENDIAN && TARGET_VSX && !TARGET_P9_VECTOR" "#" [(set_attr "type" "vecstore") (set_attr "length" "12")]) (define_split - [(set (match_operand:VECTOR_16BIT 0 "indexed_or_indirect_operand") - (match_operand:VECTOR_16BIT 1 "vsx_register_operand"))] + [(set (match_operand:V8HI 0 "indexed_or_indirect_operand") + (match_operand:V8HI 1 "vsx_register_operand"))] "!BYTES_BIG_ENDIAN && TARGET_VSX && !TARGET_P9_VECTOR && !reload_completed" [(set (match_dup 2) - (vec_select:VECTOR_16BIT + (vec_select:V8HI (match_dup 1) (parallel [(const_int 4) (const_int 5) (const_int 6) (const_int 7) (const_int 0) (const_int 1) (const_int 2) (const_int 3)]))) (set (match_dup 0) - (vec_select:VECTOR_16BIT + (vec_select:V8HI (match_dup 2) (parallel [(const_int 4) (const_int 5) (const_int 6) (const_int 7) @@ -892,25 +861,25 @@ ;; The post-reload split requires that we re-permute the source ;; register in case it is still live. (define_split - [(set (match_operand:VECTOR_16BIT 0 "indexed_or_indirect_operand") - (match_operand:VECTOR_16BIT 1 "vsx_register_operand"))] + [(set (match_operand:V8HI 0 "indexed_or_indirect_operand") + (match_operand:V8HI 1 "vsx_register_operand"))] "!BYTES_BIG_ENDIAN && TARGET_VSX && !TARGET_P9_VECTOR && reload_completed" [(set (match_dup 1) - (vec_select:VECTOR_16BIT + (vec_select:V8HI (match_dup 1) (parallel [(const_int 4) (const_int 5) (const_int 6) (const_int 7) (const_int 0) (const_int 1) (const_int 2) (const_int 3)]))) (set (match_dup 0) - (vec_select:VECTOR_16BIT + (vec_select:V8HI (match_dup 1) (parallel [(const_int 4) (const_int 5) (const_int 6) (const_int 7) (const_int 0) (const_int 1) (const_int 2) (const_int 3)]))) (set (match_dup 1) - (vec_select:VECTOR_16BIT + (vec_select:V8HI (match_dup 1) (parallel [(const_int 4) (const_int 5) (const_int 6) (const_int 7) @@ -1465,15 +1434,15 @@ "lxvw4x %x0,%y1" [(set_attr "type" "vecload")]) -(define_expand "vsx_ld_elemrev_<mode>" - [(set (match_operand:VECTOR_16BIT 0 "vsx_register_operand" "=wa") - (vec_select:VECTOR_16BIT - (match_operand:VECTOR_16BIT 1 "memory_operand" "Z") +(define_expand "vsx_ld_elemrev_v8hi" + [(set (match_operand:V8HI 0 "vsx_register_operand" "=wa") + (vec_select:V8HI + (match_operand:V8HI 1 "memory_operand" "Z") (parallel [(const_int 7) (const_int 6) (const_int 5) (const_int 4) (const_int 3) (const_int 2) (const_int 1) (const_int 0)])))] - "VECTOR_MEM_VSX_P (<MODE>mode) && !BYTES_BIG_ENDIAN" + "VECTOR_MEM_VSX_P (V8HImode) && !BYTES_BIG_ENDIAN" { if (!TARGET_P9_VECTOR) { @@ -1483,9 +1452,9 @@ unsigned int reorder[16] = {13,12,15,14,9,8,11,10,5,4,7,6,1,0,3,2}; int i; - subreg = simplify_gen_subreg (V4SImode, operands[1], <MODE>mode, 0); + subreg = simplify_gen_subreg (V4SImode, operands[1], V8HImode, 0); emit_insn (gen_vsx_ld_elemrev_v4si (tmp, subreg)); - subreg2 = simplify_gen_subreg (<MODE>mode, tmp, V4SImode, 0); + subreg2 = simplify_gen_subreg (V8HImode, tmp, V4SImode, 0); for (i = 0; i < 16; ++i) perm[i] = GEN_INT (reorder[i]); @@ -1493,21 +1462,21 @@ pcv = force_reg (V16QImode, gen_rtx_CONST_VECTOR (V16QImode, gen_rtvec_v (16, perm))); - emit_insn (gen_altivec_vperm_<mode>_direct (operands[0], subreg2, - subreg2, pcv)); + emit_insn (gen_altivec_vperm_v8hi_direct (operands[0], subreg2, + subreg2, pcv)); DONE; } }) -(define_insn "*vsx_ld_elemrev_<mode>_internal" - [(set (match_operand:VECTOR_16BIT 0 "vsx_register_operand" "=wa") - (vec_select:VECTOR_16BIT - (match_operand:VECTOR_16BIT 1 "memory_operand" "Z") +(define_insn "*vsx_ld_elemrev_v8hi_internal" + [(set (match_operand:V8HI 0 "vsx_register_operand" "=wa") + (vec_select:V8HI + (match_operand:V8HI 1 "memory_operand" "Z") (parallel [(const_int 7) (const_int 6) (const_int 5) (const_int 4) (const_int 3) (const_int 2) (const_int 1) (const_int 0)])))] - "VECTOR_MEM_VSX_P (<MODE>mode) && !BYTES_BIG_ENDIAN && TARGET_P9_VECTOR" + "VECTOR_MEM_VSX_P (V8HImode) && !BYTES_BIG_ENDIAN && TARGET_P9_VECTOR" "lxvh8x %x0,%y1" [(set_attr "type" "vecload")]) @@ -1615,20 +1584,20 @@ "stxvw4x %x1,%y0" [(set_attr "type" "vecstore")]) -(define_expand "vsx_st_elemrev_<mode>" - [(set (match_operand:VECTOR_16BIT 0 "memory_operand" "=Z") - (vec_select:VECTOR_16BIT - (match_operand:VECTOR_16BIT 1 "vsx_register_operand" "wa") +(define_expand "vsx_st_elemrev_v8hi" + [(set (match_operand:V8HI 0 "memory_operand" "=Z") + (vec_select:V8HI + (match_operand:V8HI 1 "vsx_register_operand" "wa") (parallel [(const_int 7) (const_int 6) (const_int 5) (const_int 4) (const_int 3) (const_int 2) (const_int 1) (const_int 0)])))] - "VECTOR_MEM_VSX_P (<MODE>mode) && !BYTES_BIG_ENDIAN" + "VECTOR_MEM_VSX_P (V8HImode) && !BYTES_BIG_ENDIAN" { if (!TARGET_P9_VECTOR) { rtx mem_subreg, subreg, perm[16], pcv; - rtx tmp = gen_reg_rtx (<MODE>mode); + rtx tmp = gen_reg_rtx (V8HImode); /* 2 is leftmost element in register */ unsigned int reorder[16] = {13,12,15,14,9,8,11,10,5,4,7,6,1,0,3,2}; int i; @@ -1639,10 +1608,10 @@ pcv = force_reg (V16QImode, gen_rtx_CONST_VECTOR (V16QImode, gen_rtvec_v (16, perm))); - emit_insn (gen_altivec_vperm_<mode>_direct (tmp, operands[1], - operands[1], pcv)); - subreg = simplify_gen_subreg (V4SImode, tmp, <MODE>mode, 0); - mem_subreg = simplify_gen_subreg (V4SImode, operands[0], <MODE>mode, 0); + emit_insn (gen_altivec_vperm_v8hi_direct (tmp, operands[1], + operands[1], pcv)); + subreg = simplify_gen_subreg (V4SImode, tmp, V8HImode, 0); + mem_subreg = simplify_gen_subreg (V4SImode, operands[0], V8HImode, 0); emit_insn (gen_vsx_st_elemrev_v4si (mem_subreg, subreg)); DONE; } @@ -1657,15 +1626,15 @@ "stxvd2x %x1,%y0" [(set_attr "type" "vecstore")]) -(define_insn "*vsx_st_elemrev_<mode>_internal" - [(set (match_operand:VECTOR_16BIT 0 "memory_operand" "=Z") - (vec_select:VECTOR_16BIT - (match_operand:VECTOR_16BIT 1 "vsx_register_operand" "wa") +(define_insn "*vsx_st_elemrev_v8hi_internal" + [(set (match_operand:V8HI 0 "memory_operand" "=Z") + (vec_select:V8HI + (match_operand:V8HI 1 "vsx_register_operand" "wa") (parallel [(const_int 7) (const_int 6) (const_int 5) (const_int 4) (const_int 3) (const_int 2) (const_int 1) (const_int 0)])))] - "VECTOR_MEM_VSX_P (<MODE>mode) && !BYTES_BIG_ENDIAN && TARGET_P9_VECTOR" + "VECTOR_MEM_VSX_P (V8HImode) && !BYTES_BIG_ENDIAN && TARGET_P9_VECTOR" "stxvh8x %x1,%y0" [(set_attr "type" "vecstore")]) @@ -3330,10 +3299,10 @@ "xxpermdi %x0,%x1,%x1,2" [(set_attr "type" "vecperm")]) -(define_insn "xxswapd_<mode>" - [(set (match_operand:VECTOR_16BIT 0 "vsx_register_operand" "=wa") - (vec_select:VECTOR_16BIT - (match_operand:VECTOR_16BIT 1 "vsx_register_operand" "wa") +(define_insn "xxswapd_v8hi" + [(set (match_operand:V8HI 0 "vsx_register_operand" "=wa") + (vec_select:V8HI + (match_operand:V8HI 1 "vsx_register_operand" "wa") (parallel [(const_int 4) (const_int 5) (const_int 6) (const_int 7) (const_int 0) (const_int 1) @@ -3433,15 +3402,15 @@ "lxvd2x %x0,%y1" [(set_attr "type" "vecload")]) -(define_insn "*vsx_lxvd2x8_le_<MODE>" - [(set (match_operand:VECTOR_16BIT 0 "vsx_register_operand" "=wa") - (vec_select:VECTOR_16BIT - (match_operand:VECTOR_16BIT 1 "memory_operand" "Z") +(define_insn "*vsx_lxvd2x8_le_V8HI" + [(set (match_operand:V8HI 0 "vsx_register_operand" "=wa") + (vec_select:V8HI + (match_operand:V8HI 1 "memory_operand" "Z") (parallel [(const_int 4) (const_int 5) (const_int 6) (const_int 7) (const_int 0) (const_int 1) (const_int 2) (const_int 3)])))] - "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode) && !TARGET_P9_VECTOR" + "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (V8HImode) && !TARGET_P9_VECTOR" "lxvd2x %x0,%y1" [(set_attr "type" "vecload")]) @@ -3509,15 +3478,15 @@ [(set_attr "type" "vecstore") (set_attr "length" "8")]) -(define_insn "*vsx_stxvd2x8_le_<MODE>" - [(set (match_operand:VECTOR_16BIT 0 "memory_operand" "=Z") - (vec_select:VECTOR_16BIT - (match_operand:VECTOR_16BIT 1 "vsx_register_operand" "wa") +(define_insn "*vsx_stxvd2x8_le_V8HI" + [(set (match_operand:V8HI 0 "memory_operand" "=Z") + (vec_select:V8HI + (match_operand:V8HI 1 "vsx_register_operand" "wa") (parallel [(const_int 4) (const_int 5) (const_int 6) (const_int 7) (const_int 0) (const_int 1) (const_int 2) (const_int 3)])))] - "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode) && !TARGET_P9_VECTOR" + "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (V8HImode) && !TARGET_P9_VECTOR" "stxvd2x %x1,%y0" [(set_attr "type" "vecstore")]) @@ -4091,8 +4060,7 @@ if (which_alternative == 0 && ((<MODE>mode == V16QImode && INTVAL (operands[2]) == (BYTES_BIG_ENDIAN ? 7 : 8)) - || ((<MODE>mode == V8HImode || <MODE>mode == V8HFmode - || <MODE>mode == V8BFmode) + || (<MODE>mode == V8HImode && INTVAL (operands[2]) == (BYTES_BIG_ENDIAN ? 3 : 4)))) { enum machine_mode dest_mode = GET_MODE (operands[0]); @@ -4171,8 +4139,7 @@ else vec_tmp = src; } - else if (<MODE>mode == V8HImode || <MODE>mode == V8HFmode - || <MODE>mode == V8BFmode) + else if (<MODE>mode == V8HImode) { if (value != 3) emit_insn (gen_altivec_vsplth_direct (vec_tmp, src, element)); diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index e3bbc2502726..339d1d2c97a2 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -1401,7 +1401,7 @@ See RS/6000 and PowerPC Options. -mpointers-to-nested-functions -msave-toc-indirect -mpower8-fusion -mcrypto -mhtm -mquad-memory -mquad-memory-atomic -mcompat-align-parm --mfloat128 -mfloat128-hardware -mfloat16 +-mfloat128 -mfloat128-hardware -mgnu-attribute -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} -mstack-protector-guard-offset=@var{offset} -mprefixed @@ -32012,28 +32012,6 @@ The default for @option{-mfloat128-hardware} is enabled on PowerPC Linux systems using the ISA 3.0 instruction set, and disabled on other systems. - -@opindex mfloat16 -@opindex mno-float16 -@item -mfloat16 -@itemx -mno-float16 -Enable/disable both the @code{_Float16} and @code{__bfloat16} keywords -for using 16-bit floating point. - -The @code{_Float16} keyword is for IEEE 16-bit floating point and GCC -generates either software emulation for IEEE 16-bit floating point or -hardware instructions. - -The @code{__bfloat16} keyword is for Google brain 16-bit floating -point and GCC generates either software emulation for Google brain -16-bit floating point or hardware instructions. - -At the current time, 16-bit floating point support is experimental, -and support may be changed in future releases. If you pass or return -a 16-bit floating point value, GCC will issue a warning that the ABI -may change in the future unless you use the @option{-Wno-psabi} -option. - @opindex m32 @opindex m64 @item -m32 diff --git a/gcc/testsuite/gcc.target/powerpc/bfloat16-1.c b/gcc/testsuite/gcc.target/powerpc/bfloat16-1.c deleted file mode 100644 index bbd6ce1f9373..000000000000 --- a/gcc/testsuite/gcc.target/powerpc/bfloat16-1.c +++ /dev/null @@ -1,34 +0,0 @@ -/* { dg-do run } */ -/* { dg-require-effective-target ppc_bfloat16_runtime } */ -/* { dg-options "-mfloat16 -O2" } */ - -#include <stdlib.h> - -/* This tests whether we can do __bfloat16 calculations either with software - emuluation or via hardware support. */ -volatile __bfloat16 two = 2.0; -volatile __bfloat16 three = 3.0; -volatile __bfloat16 result_add, result_sub, result_mul, result_div; - -int -main (int argc, char *argv[]) -{ - result_add = three + two; - result_sub = three - two; - result_mul = three * two; - result_div = three / two; - - if (((double)result_add) != 5.0) - abort (); - - if (((double)result_sub) != 1.0) - abort (); - - if (((double)result_mul) != 6.0) - abort (); - - if (((double)result_div) != 1.5) - abort (); - - return 0; -} diff --git a/gcc/testsuite/gcc.target/powerpc/bfloat16-2.c b/gcc/testsuite/gcc.target/powerpc/bfloat16-2.c deleted file mode 100644 index 00c70ece1876..000000000000 --- a/gcc/testsuite/gcc.target/powerpc/bfloat16-2.c +++ /dev/null @@ -1,72 +0,0 @@ -/* { dg-do run } */ -/* { dg-require-effective-target ppc_bfloat16_hw } */ -/* { dg-options "-mfloat16 -O2" } */ - -#include <stdlib.h> - -/* On a power10/power11 system, test whether we can do __bfloat16 calculations - with both software emulation (i.e. running the code with -mcpu=power8) and - hardware conversions (i.e. with -mcpu=power10 or -mcpu=power11). - - Power10 supports the XVCVBF16SPN and XVCVSPBF16 instructions that convert between - a vector __bfloat16 and a vector float. */ - -extern void do_power10 (void) __attribute__ ((noinline,target("cpu=power10"))); -extern void do_power8 (void) __attribute__ ((noinline,target("cpu=power8"))); - -volatile __bfloat16 two = 2.0; -volatile __bfloat16 three = 3.0; -volatile __bfloat16 p8_add, p8_sub, p8_mul, p8_div; -volatile __bfloat16 p10_add, p10_sub, p10_mul, p10_div; - -void -do_power8 (void) -{ - p8_add = three + two; - p8_sub = three - two; - p8_mul = three * two; - p8_div = three / two; -} - -void -do_power10 (void) -{ - p10_add = three + two; - p10_sub = three - two; - p10_mul = three * two; - p10_div = three / two; -} - -int -main (int argc, char *argv[]) -{ - do_power8 (); - - if (((double)p8_add) != 5.0) - abort (); - - if (((double)p8_sub) != 1.0) - abort (); - - if (((double)p8_mul) != 6.0) - abort (); - - if (((double)p8_div) != 1.5) - abort (); - - do_power10 (); - - if (((double)p10_add) != 5.0) - abort (); - - if (((double)p10_sub) != 1.0) - abort (); - - if (((double)p10_mul) != 6.0) - abort (); - - if (((double)p10_div) != 1.5) - abort (); - - return 0; -} diff --git a/gcc/testsuite/gcc.target/powerpc/float16-1.c b/gcc/testsuite/gcc.target/powerpc/float16-1.c deleted file mode 100644 index e3a749ebbef8..000000000000 --- a/gcc/testsuite/gcc.target/powerpc/float16-1.c +++ /dev/null @@ -1,34 +0,0 @@ -/* { dg-do run } */ -/* { dg-require-effective-target ppc_float16_runtime } */ -/* { dg-options "-mfloat16 -O2" } */ - -#include <stdlib.h> - -/* This tests whether we can do _Float16 calculations either with software - emuluation or via hardware support. */ -volatile _Float16 two = 2.0F16; -volatile _Float16 three = 3.0F16; -volatile _Float16 result_add, result_sub, result_mul, result_div; - -int -main (int argc, char *argv[]) -{ - result_add = three + two; - result_sub = three - two; - result_mul = three * two; - result_div = three / two; - - if (((double)result_add) != 5.0) - abort (); - - if (((double)result_sub) != 1.0) - abort (); - - if (((double)result_mul) != 6.0) - abort (); - - if (((double)result_div) != 1.5) - abort (); - - return 0; -} diff --git a/gcc/testsuite/gcc.target/powerpc/float16-2.c b/gcc/testsuite/gcc.target/powerpc/float16-2.c deleted file mode 100644 index 27df6dbaf23f..000000000000 --- a/gcc/testsuite/gcc.target/powerpc/float16-2.c +++ /dev/null @@ -1,73 +0,0 @@ -/* { dg-do run } */ -/* { dg-require-effective-target ppc_float16_hw } */ -/* { dg-options "-mfloat16 -O2" } */ - -#include <stdlib.h> - -/* On a power10/power11 system, test whether we can do _Float16 calculations - with both software emulation (i.e. running the code with -mcpu=power8) and - hardware conversions (i.e. with -mcpu=power9, -mcpu=power10 or - -mcpu=power11). - - Power9 supports the XSCVHPDP and XSCVDPHP instructions that convert between - a scalar _Float16 and a scalar double. */ - -extern void do_power9 (void) __attribute__ ((noinline,target("cpu=power9"))); -extern void do_power8 (void) __attribute__ ((noinline,target("cpu=power8"))); - -volatile __bfloat16 two = 2.0; -volatile __bfloat16 three = 3.0; -volatile __bfloat16 p8_add, p8_sub, p8_mul, p8_div; -volatile __bfloat16 p10_add, p10_sub, p10_mul, p10_div; - -void -do_power8 (void) -{ - p8_add = three + two; - p8_sub = three - two; - p8_mul = three * two; - p8_div = three / two; -} - -void -do_power10 (void) -{ - p10_add = three + two; - p10_sub = three - two; - p10_mul = three * two; - p10_div = three / two; -} - -int -main (int argc, char *argv[]) -{ - do_power8 (); - - if (((double)p8_add) != 5.0) - abort (); - - if (((double)p8_sub) != 1.0) - abort (); - - if (((double)p8_mul) != 6.0) - abort (); - - if (((double)p8_div) != 1.5) - abort (); - - do_power10 (); - - if (((double)p10_add) != 5.0) - abort (); - - if (((double)p10_sub) != 1.0) - abort (); - - if (((double)p10_mul) != 6.0) - abort (); - - if (((double)p10_div) != 1.5) - abort (); - - return 0; -} diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index edddb7e12447..cba178b937f8 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -3628,140 +3628,6 @@ proc check_ppc_recip_hw_available { } { }] } -# Return true if the PowerPC has hardware support for doing _Float16 -# conversions -proc check_ppc_float16_hw_available { } { - return [check_cached_effective_target ppc_float16_hw_available { - # Some simulators may not support XSCVHPDP - # For now, disable on Darwin - if { [istarget powerpc-*-eabi] || [istarget *-*-darwin*]} { - expr 0 - } else { - set options "-mfloat16" - check_runtime_nocache ppc_float16_hw_available { - extern void abort (void); - volatile _Float16 x = 3.0F16; - volatile union { - _Float16 five_f16; - unsigned short five_us; - } u = { 5.0F16 }; - int main() - { - double y; - asm ("xscvhpdp %x0,%x1" : "=wa" (y) : "wa" (x)); - if (y != 3.0) - abort (); - if (u.five_us != 0x4500) - abort (); - return 0; - } - } $options - } - }] -} - -# Return true if the PowerPC can do _Float16 calculations via either -# software or hardware support. -proc check_ppc_float16_runtime_available { } { - return [check_cached_effective_target ppc_float16_runtime_available { - # Some simulators may not support XSCVHPDP - # For now, disable on Darwin - if { [istarget powerpc-*-eabi] || [istarget *-*-darwin*]} { - expr 0 - } else { - set options "-mfloat16" - check_runtime_nocache ppc_float16_runtime_available { - extern void abort (void); - volatile _Float16 x = 3.0F16; - volatile _Float16 y = 4.0F16; - volatile _Float16 z; - volatile union { - _Float16 five_f16; - unsigned short five_us; - } u = { 5.0F16 }; - int main() - { - z = x + y; - if (((double)z) != 7.0) - abort (); - if (u.five_us != 0x4500) - abort (); - return 0; - } - } $options - } - }] -} - -# Return true if the PowerPC has hardware support for doing __bfloat16 -# conversions -proc check_ppc_bfloat16_hw_available { } { - return [check_cached_effective_target ppc_bfloat16_hw_available { - # Some simulators may not support XVCVBF16SPN/XVADDSP - # For now, disable on Darwin - if { [istarget powerpc-*-eabi] || [istarget *-*-darwin*]} { - expr 0 - } else { - set options "-mfloat16" - check_runtime_nocache ppc_float16_hw_available { - extern void abort (void); - typedef __bfloat16 vbf16 __attribute__ ((vector_size (16))); - volatile vbf16 x = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 }; - volatile vector float y = { 2.0f, 2.0f, 2.0f, 2.0f }; - volatile vector float z; - volatile vector float r; - volatile union { - __bfloat16 five_bf16; - unsigned short five_us; - } u = { 5.0 }; - int main() - { - asm ("xvcvbf16spn %x0,%x1" : "=wa" (z) : "wa" (x)); - r = y + z; - if (r[0] != 3.0 || r[1] != 3.0 || r[2] != 3.0 || r[3] != 3.0) - abort (); - if (u.five_us != 0x40a0) - abort (); - return 0; - } - } $options - } - }] -} - -# Return true if the PowerPC can do __bfloat16 calculations via either -# software or hardware support. -proc check_ppc_bfloat16_runtime_available { } { - return [check_cached_effective_target ppc_bfloat16_runtime_available { - # Some simulators may not support XVCVBF16SPN - # For now, disable on Darwin - if { [istarget powerpc-*-eabi] || [istarget *-*-darwin*]} { - expr 0 - } else { - set options "-mfloat16" - check_runtime_nocache ppc_bfloat16_runtime_available { - extern void abort (void); - volatile __bfloat16 x = 3.0; - volatile __bfloat16 y = 4.0; - volatile __bfloat16 z; - volatile union { - __bfloat16 five_bf16; - unsigned short five_us; - } u = { 5.0 }; - int main() - { - z = x + y; - if (((double)z) != 7.0) - abort (); - if (u.five_us != 0x40a0) - abort (); - return 0; - } - } $options - } - }] -} - # Return 1 if the target supports executing AltiVec and Cell PPU # instructions, 0 otherwise. Cache the result. @@ -10903,10 +10769,6 @@ proc is-effective-target { arg } { "ppc_recip_hw" { set selected [check_ppc_recip_hw_available] } "ppc_cpu_supports_hw" { set selected [check_ppc_cpu_supports_hw_available] } "ppc_mma_hw" { set selected [check_ppc_mma_hw_available] } - "ppc_float16_hw" { set selected [check_ppc_float16_hw_available] } - "ppc_float16_runtime" { set selected [check_ppc_float16_runtime_available] } - "ppc_bfloat16_hw" { set selected [check_ppc_bfloat16_hw_available] } - "ppc_bfloat16_runtime" { set selected [check_ppc_bfloat16_runtime_available] } "dfp_hw" { set selected [check_dfp_hw_available] } "htm_hw" { set selected [check_htm_hw_available] } "named_sections" { set selected [check_named_sections_available] } diff --git a/libgcc/config.host b/libgcc/config.host index d8ef1ca2c607..046156fa5e78 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -1304,10 +1304,6 @@ powerpc*-*-linux*) tmake_file="${tmake_file} rs6000/t-float128-p10-hw" fi - if test $libgcc_cv_powerpc_float16 = yes; then - tmake_file="${tmake_file} rs6000/t-float16" - fi - extra_parts="$extra_parts ecrti.o ecrtn.o ncrti.o ncrtn.o" md_unwind_header=rs6000/linux-unwind.h ;; diff --git a/libgcc/config/rs6000/sfp-machine.h b/libgcc/config/rs6000/sfp-machine.h index b6dd03a710e3..f0ede0e042a3 100644 --- a/libgcc/config/rs6000/sfp-machine.h +++ b/libgcc/config/rs6000/sfp-machine.h @@ -22,9 +22,6 @@ typedef unsigned int UTItype __attribute__ ((mode (TI))); #define _FP_I_TYPE int #endif /* 32-bits */ -#define _FP_NANFRAC_H _FP_QNANBIT_H -#define _FP_NANFRAC_B _FP_QNANBIT_B - /* The type of the result of a floating point comparison. This must match `__libgcc_cmp_return__' in GCC for the target. */ typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__))); @@ -65,8 +62,6 @@ typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__))); #define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1 #endif -#define _FP_NANSIGN_H 1 -#define _FP_NANSIGN_B 1 #define _FP_NANSIGN_S 0 #define _FP_NANSIGN_D 0 #define _FP_NANSIGN_Q 0 @@ -166,46 +161,3 @@ void __sfp_handle_exceptions (int); # define strong_alias(name, aliasname) _strong_alias(name, aliasname) # define _strong_alias(name, aliasname) \ extern __typeof (name) aliasname __attribute__ ((alias (#name))); - -/* Add prototypes for the HFmode and BFmode functions. */ -typedef double DFtype2; -typedef float SFtype2; -typedef int DItype2 __attribute__ ((mode (DI))); -typedef unsigned int UDItype2 __attribute__ ((mode (DI))); -typedef int SItype2 __attribute__ ((mode (SI))); -typedef unsigned int USItype2 __attribute__ ((mode (SI))); - -#ifdef __FLOAT16__ -typedef float HFtype2 __attribute__ ((mode (HF))); - -extern CMPtype __eqhf2 (HFtype2, HFtype2); -extern DFtype2 __extendhfdf2 (HFtype2); -extern SFtype2 __extendhfsf2 (HFtype2); -extern DItype2 __fixhfdi (HFtype2); -extern SItype2 __fixhfsi (HFtype2); -extern UDItype2 __fixunshfdi (HFtype2); -extern USItype2 __fixunshfsi (HFtype2); -extern HFtype2 __floatdihf (DItype2); -extern HFtype2 __floatsihf (SItype2); -extern HFtype2 __floatundihf (UDItype2); -extern HFtype2 __floatunsihf (USItype2); -extern HFtype2 __truncdfhf2 (DFtype2); -extern HFtype2 __truncsfhf2 (SFtype2); -#endif - -#ifdef __BFLOAT16__ -typedef float BFtype2 __attribute__ ((mode (BF))); - -extern SFtype2 __extendbfsf2 (BFtype2); -extern BFtype2 __floatdibf (DItype2); -extern BFtype2 __floatsibf (SItype2); -extern BFtype2 __floatundibf (UDItype2); -extern BFtype2 __floatunsibf (USItype2); -extern BFtype2 __truncdfbf2 (DFtype2); -extern BFtype2 __truncsfbf2 (SFtype2); -#endif - -#if defined(__FLOAT16__) && defined(__BFLOAT16__) -extern HFtype2 __truncbfhf2 (BFtype2); -extern BFtype2 __trunchfbf2 (HFtype2); -#endif diff --git a/libgcc/config/rs6000/t-float16 b/libgcc/config/rs6000/t-float16 deleted file mode 100644 index f77df910b3ff..000000000000 --- a/libgcc/config/rs6000/t-float16 +++ /dev/null @@ -1,61 +0,0 @@ -# _Float16 library support - -fp16_funcs = eqhf2 extendhfdf2 extendhfsf2 \ - fixhfsi fixhfdi fixhfti fixunshfsi fixunshfdi fixunshfti \ - floatsihf floatdihf floattihf floatunsihf floatundihf floatuntihf \ - truncdfhf2 truncsfhf2 - -fp16_src = $(addprefix $(srcdir)/soft-fp/,$(addsuffix .c,$(fp16_funcs))) -fp16_obj = $(addsuffix $(objext),$(fp16_funcs)) - -FP16_CFLAGS = -mfloat16 -Wno-psabi \ - -I$(srcdir)/soft-fp -I$(srcdir)/config/rs6000 - -$(fp16_obj) : INTERNAL_CFLAGS += $(FP16_CFLAGS) - -# __bfloat16 library support - -bfp16_funcs = extendbfsf2 floatdibf floatsibf floatundibf floatunsibf \ - truncdfbf2 truncsfbf2 - -bfp16_src = $(addprefix $(srcdir)/soft-fp/,$(addsuffix .c,$(bfp16_funcs))) -bfp16_obj = $(addsuffix $(objext),$(bfp16_funcs)) - -$(bfp16_obj) : INTERNAL_CFLAGS += $(FP16_CFLAGS) - -# Conversion between __bfloat16 and _Float16 - -both_fp16_funcs = truncbfhf2 trunchfbf2 -both_fp16_src = $(addprefix $(srcdir)/soft-fp/,$(addsuffix .c,$(both_fp16_funcs))) -both_fp16_obj = $(addsuffix $(objext),$(both_fp16_funcs)) - -$(both_fp16_obj) : INTERNAL_CFLAGS += $(FP16_CFLAGS) - -# For now, only put it in the static library -# LIB2ADD += $(fp16_src) $(bfp16_src) $(both_fp16_src) - -LIB2ADD_ST += $(fp16_src) $(bfp16_src) $(both_fp16_src) - -.PHONY: test-float16 clean-float16 - -test-float16: - @echo "fp16_src:"; \ - for x in $(fp16_src); do echo " $$x"; done; \ - echo; \ - echo "bfp16_src:"; \ - for x in $(bfp16_src); do echo " $$x"; done; \ - echo; \ - echo "both_fp16_src:"; \ - for x in $(both_fp16_src); do echo " $$x"; done; \ - echo; \ - echo "fp16_obj:"; \ - for x in $(fp16_obj); do echo " $$x"; done; \ - echo; \ - echo "bfp16_obj:"; \ - for x in $(bfp16_obj); do echo " $$x"; done; \ - echo; \ - echo "both_fp16_obj:"; \ - for x in $(bfp16_obj); do echo " $$x"; done; - -clean-float16: - @$(MULTICLEAN) multi-clean DO=clean-float16 diff --git a/libgcc/configure b/libgcc/configure index 2e4b564100c6..f2bee6d90fe2 100755 --- a/libgcc/configure +++ b/libgcc/configure @@ -5240,8 +5240,6 @@ case ${host} in # check if we have VSX (ISA 2.06) support to build the software libraries, and # whether the assembler can handle xsaddqp for hardware support. Also check if # a new glibc is being used so that __builtin_cpu_supports can be used. -# -# Add float16 support also powerpc*-*-linux*) saved_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128" @@ -5336,27 +5334,6 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgcc_cv_powerpc_3_1_float128_hw" >&5 $as_echo "$libgcc_cv_powerpc_3_1_float128_hw" >&6; } CFLAGS="$saved_CFLAGS" - - CFLAGS="$CFLAGS -mfloat16 -Wno-psabi" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the PowerPC can build the _Float16 libraries" >&5 -$as_echo_n "checking whether the PowerPC can build the _Float16 libraries... " >&6; } -if ${libgcc_cv_powerpc_float16+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -_Float16 addf16 (_Float16 a, _Float16 b) { return a + b; } -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - libgcc_cv_powerpc_float16=yes -else - libgcc_cv_powerpc_float16=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgcc_cv_powerpc_float16" >&5 -$as_echo "$libgcc_cv_powerpc_float16" >&6; } - CFLAGS="$saved_CFLAGS" esac case ${host} in diff --git a/libgcc/configure.ac b/libgcc/configure.ac index ea53fd799e17..72d23b427d0f 100644 --- a/libgcc/configure.ac +++ b/libgcc/configure.ac @@ -419,8 +419,6 @@ case ${host} in # check if we have VSX (ISA 2.06) support to build the software libraries, and # whether the assembler can handle xsaddqp for hardware support. Also check if # a new glibc is being used so that __builtin_cpu_supports can be used. -# -# Add float16 support also powerpc*-*-linux*) saved_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128" @@ -479,15 +477,6 @@ powerpc*-*-linux*) [libgcc_cv_powerpc_3_1_float128_hw=yes], [libgcc_cv_powerpc_3_1_float128_hw=no])]) CFLAGS="$saved_CFLAGS" - - CFLAGS="$CFLAGS -mfloat16 -Wno-psabi" - AC_CACHE_CHECK([whether the PowerPC can build the _Float16 libraries], - [libgcc_cv_powerpc_float16], - [AC_COMPILE_IFELSE( - [AC_LANG_SOURCE([_Float16 addf16 (_Float16 a, _Float16 b) { return a + b; }])], - [libgcc_cv_powerpc_float16=yes], - [libgcc_cv_powerpc_float16=no])]) - CFLAGS="$saved_CFLAGS" esac case ${host} in
