public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: William Tambe <tambewilliam@gmail.com>
To: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: how to use emit_clobber () ?
Date: Sat, 25 Apr 2020 15:52:59 -0400	[thread overview]
Message-ID: <CAF8i9mO_f5A_U+oFO1bqJEtpS3YJAqt7ThOKvzo5+CvSXMS8AA@mail.gmail.com> (raw)
In-Reply-To: <CAF8i9mP7DOTq3WKeGVu5mn4mDK8B03Mp441G4TtLY6vDkBAScg@mail.gmail.com>

Correcting typo in my previous email.

On Sat, Apr 25, 2020 at 3:21 PM William Tambe <tambewilliam@gmail.com> wrote:
>
> The following define_expand is used to generate a call to
> __tls_get_addr() when the first operand of movsi is detected as a TLS
> symbol by tls_symbol_operand().
>
> I am trying to accomplish generating a call to __tls_get_addr()
> passing two arguments in two registers where I would like to clobber
> the first register argument.
>
> However the use of emit_clobber() has no effect.
>
> Any idea, how emit_clobber should be used below ?
>
> (define_expand "movsi"
>  [(set (match_operand:SI 0 "nonimmediate_operand" "")
>        (match_operand:SI 1 "general_operand"      ""))]
>  ""
>  {
>    rtx op0 = operands[0];
>    rtx op1 = operands[1];
>    if (tls_symbolic_operand (op0, VOIDmode)) {
>      rtx arg0 = gen_rtx_REG (SImode, ARCH_FIRST_ARG_REGNUM);
>      rtx arg1 = gen_rtx_REG (SImode, ARCH_FIRST_ARG_REGNUM+1);
>      emit_insn (arg1);
>      emit_clobber (gen__movsi (arg0, op0));

Above is incorrect; what I am using is below:
     emit_clobber (arg1);
     emit_insn (gen__movsi (arg0, op0));

Question remain the same; any idea how emit_clobber should be used in
order to have an effect ?

>      rtx fn = gen_rtx_MEM (FUNCTION_MODE, gen_arch_tga());
>      rtx_insn *insn = emit_call_insn (gen_call_value (arg0, fn, const0_rtx));
>      RTL_CONST_CALL_P (insn) = 1;
>      use_reg (&CALL_INSN_FUNCTION_USAGE (insn), arg0);
>      use_reg (&CALL_INSN_FUNCTION_USAGE (insn), arg1);
>      if (GET_CODE (op0) == MEM)
>        arg0 = gen_rtx_MEM (SImode, arg0);
>      operands[0] = arg0;
>    }
>    emit_insn (gen__movsi (operands[0], operands[1]));
>    DONE;
>  })

  reply	other threads:[~2020-04-25 19:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-25 19:21 William Tambe
2020-04-25 19:52 ` William Tambe [this message]
2020-04-27  7:46   ` Richard Sandiford

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=CAF8i9mO_f5A_U+oFO1bqJEtpS3YJAqt7ThOKvzo5+CvSXMS8AA@mail.gmail.com \
    --to=tambewilliam@gmail.com \
    --cc=gcc-help@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).