public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Uros Bizjak" <ubizjak@gmail.com>
To: "Mohamed Shafi" <shafitvm@gmail.com>
Cc: GCC <gcc@gcc.gnu.org>
Subject: Re: How to write pattern for addition with carry operation
Date: Sat, 07 Jun 2008 11:40:00 -0000	[thread overview]
Message-ID: <5787cf470806070439o60ea9e85y415b3012ceb6cc4e@mail.gmail.com> (raw)
In-Reply-To: <ba0bd44d0806070218o2b97991ct3f3b379752f45f1a@mail.gmail.com>

On Sat, Jun 7, 2008 at 11:18 AM, Mohamed Shafi <shafitvm@gmail.com> wrote:

>>> The 16bit target that i am porting to gcc4.1.2 doesn't have any
>>> instructions for 32bit operations. But for addition and subtraction
>>> there is
>>> addc
>>> subc
>>> instructions that consider carry bit also. Presently i have patterns
>>> for SImode addition and subtraction such that the template will have
>>>
>>> add %0, %1\naddc %N0, %N1
>>> sub %0, %1\nsubc %N0, %N1
>>>
>>> Will it be possible for me to write separate patterns for the
>>> instructions add and addc?
>>>
>>
>> You can look into config/i386.md, how i.e. adddi3 is expanded and split in
>> case of !TARGET_64BIT.
>
> But is it scheduling safe?
> I mean you can't have addc executed before add. If i am right there
> will be no dependency between the two instructions. So there can be a
> case where addc gets scheduled before add. Am i right on both counts?

No, they are connected through carry flag in the sense that "add" is
the producer "and addc" is the consumer of CC reg, At least this is
the way i386 pattern works for a couple of decades without problems.

Uros.

  reply	other threads:[~2008-06-07 11:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-07  7:33 Uros Bizjak
2008-06-07  9:19 ` Mohamed Shafi
2008-06-07 11:40   ` Uros Bizjak [this message]
2008-06-08  1:30   ` Ian Lance Taylor
  -- strict thread matches above, loose matches on Subject: below --
2008-06-07  5:37 Mohamed Shafi

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=5787cf470806070439o60ea9e85y415b3012ceb6cc4e@mail.gmail.com \
    --to=ubizjak@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=shafitvm@gmail.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).