public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Michael Meissner <meissner@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/meissner/heads/work122-vpair)] Add negate support. Date: Fri, 16 Jun 2023 21:15:02 +0000 (GMT) [thread overview] Message-ID: <20230616211502.52E6B3858D35@sourceware.org> (raw) https://gcc.gnu.org/g:2a3bfc746f13793ab4fd78dd3cb00c805dbb1d06 commit 2a3bfc746f13793ab4fd78dd3cb00c805dbb1d06 Author: Michael Meissner <meissner@linux.ibm.com> Date: Fri Jun 16 17:14:10 2023 -0400 Add negate support. 2023-06-16 Michael Meissner <meissner@linux.ibm.com> gcc/ * config/rs6000/mma.md (UNSPEC_PAIR_NEG_F32): New unspec. (UNSPEC_PAIR_NEG_F64): Likewise. (UNSPEC_PAIR_1OPS): Add negate operators. (pairop): Likewise. (pairmode): Likewise. * config/rs6000/rs6000-builtin.cc (rs6000_gimple_fold_builtin): Add support for negation. * config/rs6000/rs6000-builtins.def (__builtin_neg_f32_scalar): New built-in function. (__builtin_neg_f32_vector): Likewise. (__builtin_neg_f32_vpair): Likewise. (__builtin_neg_f64_scalar): Likewise. (__builtin_neg_f64_vector): Likewise. (__builtin_neg_f64_vpair): Likewise. * config/rs6000/rs6000-overload.def (__builtin_neg_f32): New overloaded built-in functions. (__builtin_neg_f64): Likewise. Diff: --- gcc/config/rs6000/mma.md | 10 +++++++++- gcc/config/rs6000/rs6000-builtin.cc | 15 +++++++++++++++ gcc/config/rs6000/rs6000-builtins.def | 14 ++++++++++++++ gcc/config/rs6000/rs6000-overload.def | 16 ++++++++++++++++ 4 files changed, 54 insertions(+), 1 deletion(-) diff --git a/gcc/config/rs6000/mma.md b/gcc/config/rs6000/mma.md index d127a8673eb..932376cd27a 100644 --- a/gcc/config/rs6000/mma.md +++ b/gcc/config/rs6000/mma.md @@ -99,6 +99,8 @@ UNSPEC_PAIR_FMA_F64 UNSPEC_PAIR_MULT_F32 UNSPEC_PAIR_MULT_F64 + UNSPEC_PAIR_NEG_F32 + UNSPEC_PAIR_NEG_F64 UNSPEC_PAIR_SCALE_F32 UNSPEC_PAIR_SCALE_F64 UNSPEC_PAIR_SUB_F32 @@ -276,7 +278,9 @@ (UNSPEC_MMA_PMXVI8GER4SPP "pmxvi8ger4spp")]) (define_int_iterator UNSPEC_PAIR_1OPS [UNSPEC_PAIR_ABS_F32 - UNSPEC_PAIR_ABS_F64]) + UNSPEC_PAIR_ABS_F64 + UNSPEC_PAIR_NEG_F32 + UNSPEC_PAIR_NEG_F64]) (define_int_iterator UNSPEC_PAIR_2OPS [UNSPEC_PAIR_ADD_F32 UNSPEC_PAIR_ADD_F64 @@ -299,6 +303,8 @@ (UNSPEC_PAIR_FMA_F64 "FMA") (UNSPEC_PAIR_MULT_F32 "MULT") (UNSPEC_PAIR_MULT_F64 "MULT") + (UNSPEC_PAIR_NEG_F32 "NEG") + (UNSPEC_PAIR_NEG_F64 "NEG") (UNSPEC_PAIR_SUB_F32 "MINUS") (UNSPEC_PAIR_SUB_F64 "MINUS")]) @@ -310,6 +316,8 @@ (UNSPEC_PAIR_FMA_F64 "V2DF") (UNSPEC_PAIR_MULT_F32 "V4SF") (UNSPEC_PAIR_MULT_F64 "V2DF") + (UNSPEC_PAIR_NEG_F32 "V4SF") + (UNSPEC_PAIR_NEG_F64 "V2DF") (UNSPEC_PAIR_SCALE_F32 "V4SF") (UNSPEC_PAIR_SCALE_F64 "V2DF") (UNSPEC_PAIR_SUB_F32 "V4SF") diff --git a/gcc/config/rs6000/rs6000-builtin.cc b/gcc/config/rs6000/rs6000-builtin.cc index 4bac4387b68..54e6b9e7c9c 100644 --- a/gcc/config/rs6000/rs6000-builtin.cc +++ b/gcc/config/rs6000/rs6000-builtin.cc @@ -2295,6 +2295,21 @@ rs6000_gimple_fold_builtin (gimple_stmt_iterator *gsi) return true; } + case RS6000_BIF_NEG_F32_SCALAR: + case RS6000_BIF_NEG_F32_VECTOR: + case RS6000_BIF_NEG_F64_SCALAR: + case RS6000_BIF_NEG_F64_VECTOR: + { + location_t loc = gimple_location (stmt); + lhs = gimple_call_lhs (stmt); + arg0 = gimple_call_arg (stmt, 0); + tree t = build1 (NEGATE_EXPR, TREE_TYPE (lhs), arg0); + g = gimple_build_assign (lhs, t); + gimple_set_location (g, loc); + gsi_replace (gsi, g, true); + return true; + } + case RS6000_BIF_REDUCE_F32_SCALAR: case RS6000_BIF_REDUCE_F64_SCALAR: { diff --git a/gcc/config/rs6000/rs6000-builtins.def b/gcc/config/rs6000/rs6000-builtins.def index ef846cff03d..88ed493897e 100644 --- a/gcc/config/rs6000/rs6000-builtins.def +++ b/gcc/config/rs6000/rs6000-builtins.def @@ -4152,6 +4152,20 @@ v256 __builtin_mult_f64_vpair (v256, v256); MULT_F64_VPAIR vpair_MULT_V2DF {mma,pair} + float __builtin_neg_f32_scalar (float); + NEG_F32_SCALAR nothing {} + vf __builtin_neg_f32_vector (vf); + NEG_F32_VECTOR nothing {} + v256 __builtin_neg_f32_vpair (v256); + NEG_F32_VPAIR vpair_NEG_V4SF {mma,pair} + + double __builtin_neg_f64_scalar (double); + NEG_F64_SCALAR nothing {} + vd __builtin_neg_f64_vector (vd); + NEG_F64_VECTOR nothing {} + v256 __builtin_neg_f64_vpair (v256); + NEG_F64_VPAIR vpair_NEG_V2DF {mma,pair} + float __builtin_reduce_f32_scalar (float); REDUCE_F32_SCALAR nothing {} float __builtin_reduce_f32_vector (vf); diff --git a/gcc/config/rs6000/rs6000-overload.def b/gcc/config/rs6000/rs6000-overload.def index a2294bce66c..daf6726cca5 100644 --- a/gcc/config/rs6000/rs6000-overload.def +++ b/gcc/config/rs6000/rs6000-overload.def @@ -6224,6 +6224,22 @@ v256 __builtin_mult_f64 (v256, v256); MULT_F64_VPAIR +[NEG_F32, SKIP, __builtin_neg_f32] + float __builtin_neg_f32 (float); + NEG_F32_SCALAR + vf __builtin_neg_f32 (vf); + NEG_F32_VECTOR + v256 __builtin_neg_f32 (v256); + NEG_F32_VPAIR + +[NEG_F64, SKIP, __builtin_neg_f64] + double __builtin_neg_f64 (double); + NEG_F64_SCALAR + vd __builtin_neg_f64 (vd); + NEG_F64_VECTOR + v256 __builtin_neg_f64 (v256); + NEG_F64_VPAIR + [REDUCE_F32, SKIP, __builtin_reduce_f32] float __builtin_reduce_f32 (float); REDUCE_F32_SCALAR
reply other threads:[~2023-06-16 21:15 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230616211502.52E6B3858D35@sourceware.org \ --to=meissner@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).