public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@redhat.com>
To: Zhenqiang Chen <zhenqiang.chen@arm.com>
Cc: Marcus Shawcroft <Marcus.Shawcroft@arm.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH, AARCH64] Fix  ICE in CCMP (PR64015)
Date: Tue, 25 Nov 2014 09:37:00 -0000	[thread overview]
Message-ID: <54744AEA.9010706@redhat.com> (raw)
In-Reply-To: <000001d0088b$a4590c40$ed0b24c0$@arm.com>

On 11/25/2014 09:41 AM, Zhenqiang Chen wrote:
> I want to confirm with you two things before I rework it.
> (1) expand_insn needs an optab_handler as input. Do I need to define a ccmp_optab with different mode support in optabs.def?

No, look again: expand_insn needs an enum insn_code as input.  Since this is
the backend, you can use any icode name you like, which means that you can use
CODE_FOR_ccmp_and etc directly.

> (2) To make sure later operands not clobber CC, all operands are expanded before ccmp-first in current implementation. If taking tree/gimple as input, what's your preferred logic to guarantee CC not clobbered?

Hmm.  Perhaps the target hook will need to output two sequences, each of which
will be concatenated while looping around the calls to gen_ccmp_next.  The
first sequence will be operand preparation and the second sequence will be ccmp
generation.

Something like

bool
aarch64_gen_ccmp_start(rtx *prep_seq, rtx *gen_seq,
                       int cmp_code, int bit_code,
                       tree op0, tree op1)
{
  bool success;

  start_sequence ();
  // Widen and expand operands
  *prep_seq = get_insns ();
  end_sequence ();

  start_sequence ();
  // Generate the first compare
  *gen_seq = get_insns ();
  end_sequence ();

  return success;
}

bool
aarch64_gen_ccmp_next(rtx *prep_seq, rtx *gen_seq,
                      rtx prev, int cmp_code, int bit_code,
                      tree op0, tree op1)
{
  bool success;

  push_to_sequence (*prep_seq);
  // Widen and expand operands
  *prep_seq = get_insns ();
  end_sequence ();

  push_to_sequence (*gen_seq);
  // Generate the next ccmp
  *gen_seq = get_insns ();
  end_sequence ();

  return success;
}

If there are ever any failures, the middle-end can simply discard the
sequences.  If everything succeeds, it simply calls emit_insn on both sequences.


r~

  reply	other threads:[~2014-11-25  9:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-24  8:21 Zhenqiang Chen
2014-11-24  8:21 ` Andrew Pinski
2014-11-24  9:49 ` Richard Henderson
2014-11-25  9:11   ` Zhenqiang Chen
2014-11-25  9:37     ` Richard Henderson [this message]
2014-11-26 10:00       ` Zhenqiang Chen
2014-11-28 17:28         ` Richard Henderson
2014-12-12  7:52       ` Zhenqiang Chen
2014-12-12 19:25         ` Richard Henderson
2014-12-15  9:05           ` Zhenqiang Chen
2015-01-15 15:40             ` Jiong Wang
2015-01-15 18:28             ` Richard Henderson
2015-01-16 11:01               ` Marcus Shawcroft
2015-01-18 21:26                 ` Christophe Lyon
2015-01-18 22:12                   ` Andrew Pinski
2015-01-18 23:29                     ` Christophe Lyon

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=54744AEA.9010706@redhat.com \
    --to=rth@redhat.com \
    --cc=Marcus.Shawcroft@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=zhenqiang.chen@arm.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).