public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/53354] New: %z# asm specifier could be extended to support immediate constraints
@ 2012-05-15  1:40 svfuerst at gmail dot com
  2012-05-15  1:47 ` [Bug target/53354] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: svfuerst at gmail dot com @ 2012-05-15  1:40 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53354

             Bug #: 53354
           Summary: %z# asm specifier could be extended to support
                    immediate constraints
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: svfuerst@gmail.com


It would be nice if %z# would work with immediate asm constraints:

void foo(void)
{
#if 1
    int x = 1;
    asm("mov%z0 %0, bar":: "r" (x));
#else
    asm("mov%z0 %0, bar":: "i" (1));
#endif
}

The first option isn't optimal as an extra register is needed.  If the second
is tried, gcc exits with "error: invalid 'asm': invalid operand type used with
operand code 'z'"

Typically, to work around this, people use a switch statement based on the size
of the immediate, and manually copy the code for sizes of 1, 2, 4, 8 byte
registers.  It would be simpler if the bulky switch statements weren't
necessary.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug target/53354] %z# asm specifier could be extended to support immediate constraints
  2012-05-15  1:40 [Bug c/53354] New: %z# asm specifier could be extended to support immediate constraints svfuerst at gmail dot com
@ 2012-05-15  1:47 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-05-15  1:47 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53354

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
          Component|c                           |target
         Resolution|                            |INVALID

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-05-15 01:42:09 UTC ---
We don't want to this because const_int for RTL don't have a mode so the
back-end does not know what extension to use here.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-05-15  1:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-15  1:40 [Bug c/53354] New: %z# asm specifier could be extended to support immediate constraints svfuerst at gmail dot com
2012-05-15  1:47 ` [Bug target/53354] " pinskia at gcc dot gnu.org

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).