From: Will Schmidt <will_schmidt@vnet.ibm.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
Segher Boessenkool <segher@kernel.crashing.org>,
Bill Schmidt <wschmidt@linux.vnet.ibm.com>,
David Edelsohn <dje.gcc@gmail.com>
Subject: Re: [PATCH, rs6000] (v2) Gimple folding for vec_madd()
Date: Thu, 26 Oct 2017 23:04:00 -0000 [thread overview]
Message-ID: <1509056018.26707.226.camel@brimstone.rchland.ibm.com> (raw)
In-Reply-To: <CAFiYyc0r1HGCUjO6ZWxmV2Ei8LN92j5WtO8tXGr+F4HRu2Sp8A@mail.gmail.com>
Hi,
[PATCH, rs6000] (v2) Gimple folding for vec_madd()
Add support for gimple folding of the vec_madd() (vector multiply-add)
intrinsics. Per earlier feedback and education, this now includes
the addition of a "define_expand fmav8hi4" in altivec.md.
Testcase coverage is provided by the existing tests as
gcc.target/powerpc/fold-vec-madd-*.c
Sniff-tests passed. Regtests will be kicked off shortly. OK for trunk?
(pending successful test results, of course:-) )
Thanks,
-Will
[gcc]
2017-10-26 Will Schmidt <will_schmidt@vnet.ibm.com>
* config/rs6000/rs6000.c: (rs6000_gimple_fold_builtin) Add support for
gimple folding of vec_madd() intrinsics.
* config/rs6000/altivec.md: Add define_expand fmav8hi4
diff --git a/gcc/config/rs6000/altivec.md b/gcc/config/rs6000/altivec.md
index 6ea529b..36e6ddd 100644
--- a/gcc/config/rs6000/altivec.md
+++ b/gcc/config/rs6000/altivec.md
@@ -943,10 +943,22 @@
(match_operand:V8HI 3 "register_operand" "v")))]
"TARGET_ALTIVEC"
"vmladduhm %0,%1,%2,%3"
[(set_attr "type" "veccomplex")])
+(define_expand "fmav8hi4"
+ [(use (match_operand:V8HI 0 "register_operand" ""))
+ (use (match_operand:V8HI 1 "register_operand" ""))
+ (use (match_operand:V8HI 2 "register_operand" ""))
+ (use (match_operand:V8HI 3 "register_operand" ""))]
+ "TARGET_ALTIVEC"
+{
+ emit_insn (gen_altivec_vmladduhm (operands[0], operands[1],
+ operands[2], operands[3]));
+ DONE;
+})
+
(define_expand "altivec_vmrghb"
[(use (match_operand:V16QI 0 "register_operand" ""))
(use (match_operand:V16QI 1 "register_operand" ""))
(use (match_operand:V16QI 2 "register_operand" ""))]
"TARGET_ALTIVEC"
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 4837e14..1cd4278 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -16606,10 +16606,25 @@ rs6000_gimple_fold_builtin (gimple_stmt_iterator *gsi)
build_int_cst (arg2_type, 0)), arg0);
gimple_set_location (g, loc);
gsi_replace (gsi, g, true);
return true;
}
+ /* vec_madd (Float) */
+ case ALTIVEC_BUILTIN_VMADDFP:
+ case VSX_BUILTIN_XVMADDDP:
+ case ALTIVEC_BUILTIN_VMLADDUHM:
+ {
+ arg0 = gimple_call_arg (stmt, 0);
+ arg1 = gimple_call_arg (stmt, 1);
+ tree arg2 = gimple_call_arg (stmt, 2);
+ lhs = gimple_call_lhs (stmt);
+ gimple *g = gimple_build_assign (lhs, FMA_EXPR , arg0, arg1, arg2);
+ gimple_set_location (g, gimple_location (stmt));
+ gsi_replace (gsi, g, true);
+ return true;
+ }
+
default:
if (TARGET_DEBUG_BUILTIN)
fprintf (stderr, "gimple builtin intrinsic not matched:%d %s %s\n",
fn_code, fn_name1, fn_name2);
break;
next prev parent reply other threads:[~2017-10-26 22:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-25 15:14 [PATCH, rs6000] " Will Schmidt
2017-10-26 9:10 ` Richard Biener
2017-10-26 14:34 ` Will Schmidt
2017-10-26 15:18 ` Richard Biener
2017-10-26 15:19 ` Richard Biener
2017-10-26 15:27 ` Will Schmidt
2017-10-26 23:04 ` Will Schmidt [this message]
2017-10-26 23:42 ` [PATCH, rs6000] (v2) " Segher Boessenkool
2017-10-27 15:56 ` [PATCH, rs6000] (v3) " Will Schmidt
2017-10-27 16:52 ` David Edelsohn
2017-10-27 17:50 ` Segher Boessenkool
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=1509056018.26707.226.camel@brimstone.rchland.ibm.com \
--to=will_schmidt@vnet.ibm.com \
--cc=dje.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=richard.guenther@gmail.com \
--cc=segher@kernel.crashing.org \
--cc=wschmidt@linux.vnet.ibm.com \
/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: link
Be 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).