This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/53354] New: %z# asm specifier could be extended to support immediate constraints


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]