From: Nathan Froyd <froydnj@codesourcery.com>
To: gcc-patches@gcc.gnu.org
Subject: use build_one_cst in tree-ssa-loop-im.c
Date: Sun, 31 Oct 2010 15:17:00 -0000 [thread overview]
Message-ID: <20101031023224.GF6758@nightcrawler> (raw)
This code in tree-ssa-loop-im.c:
/* For vectors, create a VECTOR_CST full of 1's. */
if (TREE_CODE (type) == VECTOR_TYPE)
{
int i, len;
tree list = NULL_TREE;
real_one = build_real (TREE_TYPE (type), dconst1);
len = TYPE_VECTOR_SUBPARTS (type);
for (i = 0; i < len; i++)
list = tree_cons (NULL, real_one, list);
real_one = build_vector (type, list);
}
else
real_one = build_real (type, dconst1);
reduces to:
if (TREE_CODE (type) == VECTOR_TYPE)
{
real_one = build_real (TREE_TYPE (type), dconst1);
real_one = build_vector_from_val (type, real_one);
}
else
real_one - build_real (type, dconst1);
which is exactly what build_one_cst does. So call that instead.
Tested on x86_64-unknown-linux-gnu. Committed as obvious.
-Nathan
* tree-ssa-loop-im.c (rewrite_reciprocal): Use build_one_cst.
Index: tree-ssa-loop-im.c
===================================================================
--- tree-ssa-loop-im.c (revision 166100)
+++ tree-ssa-loop-im.c (working copy)
@@ -910,19 +910,7 @@ rewrite_reciprocal (gimple_stmt_iterator
add_referenced_var (var);
DECL_GIMPLE_REG_P (var) = 1;
- /* For vectors, create a VECTOR_CST full of 1's. */
- if (TREE_CODE (type) == VECTOR_TYPE)
- {
- int i, len;
- tree list = NULL_TREE;
- real_one = build_real (TREE_TYPE (type), dconst1);
- len = TYPE_VECTOR_SUBPARTS (type);
- for (i = 0; i < len; i++)
- list = tree_cons (NULL, real_one, list);
- real_one = build_vector (type, list);
- }
- else
- real_one = build_real (type, dconst1);
+ real_one = build_one_cst (type);
stmt1 = gimple_build_assign_with_ops (RDIV_EXPR,
var, real_one, gimple_assign_rhs2 (stmt));
reply other threads:[~2010-10-31 2:32 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=20101031023224.GF6758@nightcrawler \
--to=froydnj@codesourcery.com \
--cc=gcc-patches@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: 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).