public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: DJ Delorie <dj@redhat.com>
To: brian@shapes.demon.co.uk
Cc: gcc@gcc.gnu.org
Subject: Re: MSP430 in gcc4.9 ... enable interrupts?
Date: Fri, 14 Feb 2014 19:17:00 -0000	[thread overview]
Message-ID: <201402141917.s1EJHb0H008351@greed.delorie.com> (raw)
In-Reply-To: <1392372773.17088.27.camel@Gannet.Four> (message from Brian	Drummond on Fri, 14 Feb 2014 10:12:53 +0000)


The constructs in the *.md files are for the compiler's internal use
(i.e. there are function attributes that trigger those).  You don't
need compiler support for these opcodes at the user level; the right
way is to implement those builtins as inline assembler in a common
header file:

static inline __attribute__((always_inline))
void __nop()
{
  asm volatile ("NOP");
}

static inline __attribute__((always_inline))
void __eint()
{
  asm volatile ("EINT");
}


Or more simply:

#define __eint() asm("EINT")
#define __nop() asm("NOP")


For opcodes with parameters, you use a more complex form of inline
assembler:

static inline __attribute__((always_inline))
void BIC_SR(const int x)
{
  asm volatile ("BIC.W %0,R2" :: "i" (x));
}

  reply	other threads:[~2014-02-14 19:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-14 10:12 Brian Drummond
2014-02-14 19:17 ` DJ Delorie [this message]
2014-02-14 20:53   ` Brian Drummond
2014-02-16 14:26   ` David Brown
2014-02-17 23:12     ` DJ Delorie
2014-02-18  8:01       ` David Brown

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=201402141917.s1EJHb0H008351@greed.delorie.com \
    --to=dj@redhat.com \
    --cc=brian@shapes.demon.co.uk \
    --cc=gcc@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).