public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alan Lawrence <alan.lawrence@arm.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH 1/3] optabs.c: Make vector_compare_rtx cope with VOIDmode constants (e.g. const0_rtx)
Date: Fri, 01 May 2015 15:12:00 -0000	[thread overview]
Message-ID: <554397F2.80901@arm.com> (raw)
In-Reply-To: <55312945.8010905@arm.com>

[-- Attachment #1: Type: text/plain, Size: 333 bytes --]

Alan Lawrence wrote:
> As per introduction, this allows vector_compare_rtx to work on DImode vectors.
> 
> Bootstrapped + check-gcc on x86-unknown-linux-gnu.
> 
> gcc/ChangeLog:
> 
> 	* optabs.c (vector_compare_rtx): Handle RTL operands having VOIDmode.
> 

Ping. (DImode vectors are explicitly allowed by stor-layout.c.)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: vec_cmp_rtx.patch --]
[-- Type: text/x-patch; name=vec_cmp_rtx.patch, Size: 1497 bytes --]

diff --git a/gcc/optabs.c b/gcc/optabs.c
index f8d584eeeb11a2c19d8c8d887a0ff18aed5f56b4..135c88938f8bc03eed4dc7f1b5adcb0bb0606b1e 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -6530,18 +6530,28 @@ vector_compare_rtx (enum tree_code tcode, tree t_op0, tree t_op1,
 {
   struct expand_operand ops[2];
   rtx rtx_op0, rtx_op1;
+  machine_mode m0, m1;
   enum rtx_code rcode = get_rtx_code (tcode, unsignedp);
 
   gcc_assert (TREE_CODE_CLASS (tcode) == tcc_comparison);
 
-  /* Expand operands.  */
+  /* Expand operands.  For vector types with scalar modes, e.g. where int64x1_t
+     has mode DImode, this can produce a constant RTX of mode VOIDmode; in such
+     cases, use the original mode.  */
   rtx_op0 = expand_expr (t_op0, NULL_RTX, TYPE_MODE (TREE_TYPE (t_op0)),
 			 EXPAND_STACK_PARM);
+  m0 = GET_MODE (rtx_op0);
+  if (m0 == VOIDmode)
+    m0 = TYPE_MODE (TREE_TYPE (t_op0));
+
   rtx_op1 = expand_expr (t_op1, NULL_RTX, TYPE_MODE (TREE_TYPE (t_op1)),
 			 EXPAND_STACK_PARM);
+  m1 = GET_MODE (rtx_op1);
+  if (m1 == VOIDmode)
+    m1 = TYPE_MODE (TREE_TYPE (t_op1));
 
-  create_input_operand (&ops[0], rtx_op0, GET_MODE (rtx_op0));
-  create_input_operand (&ops[1], rtx_op1, GET_MODE (rtx_op1));
+  create_input_operand (&ops[0], rtx_op0, m0);
+  create_input_operand (&ops[1], rtx_op1, m1);
   if (!maybe_legitimize_operands (icode, 4, 2, ops))
     gcc_unreachable ();
   return gen_rtx_fmt_ee (rcode, VOIDmode, ops[0].value, ops[1].value);

  reply	other threads:[~2015-05-01 15:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-17 15:37 [PATCH 0/3][AArch64] DImode vector compares Alan Lawrence
2015-04-17 15:39 ` [PATCH 1/3] optabs.c: Make vector_compare_rtx cope with VOIDmode constants (e.g. const0_rtx) Alan Lawrence
2015-05-01 15:12   ` Alan Lawrence [this message]
2015-05-01 16:32     ` Jeff Law
2015-04-17 15:40 ` [PATCH 2/3][AArch64] Add vcond(u?)didi pattern Alan Lawrence
2015-05-05 11:13   ` Marcus Shawcroft
2015-04-17 15:41 ` [PATCH 3/3][AArch64] Idiomatic 64x1 comparisons in arm_neon.h Alan Lawrence
2015-05-05 11:14   ` Marcus Shawcroft
2015-05-05  9:43 ` [PATCH 0/3][AArch64] DImode vector compares Alan Lawrence

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=554397F2.80901@arm.com \
    --to=alan.lawrence@arm.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).