Issue Details (XML | Word | Printable)

Key: PCC-273
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Anders Magnusson
Reporter: Iain Hibbert
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.

xasm constraint % not supported

Created: 15/Mar/11 10:40 AM   Updated: 15/Mar/11 06:21 PM
Component/s: i386 target
Affects Version/s: None
Fix Version/s: None

Environment: NetBSD/i386

 Description  « Hide
The following code fragment (simplified from Xorg display driver sources)

static void foo(void)
        int a, b;

        asm ( "movsl" : "=%c" (a) : "0" (b) );

fails to compile, with

  foo.c, line 6: bad xasm constraint %

I don't much understand this, but according to the gcc online docs I found at the '%' modifier signifies:

Declares the instruction to be commutative for this operand and the following operand. This means that the compiler may interchange the two operands if that is the cheapest way to make all operands fit the constraints. GCC can only handle one commutative pair in an asm; if you use more, the compiler may fail. Note that you need not use the modifier if the two alternatives are strictly identical; this would only waste time in the reload pass. The modifier is not operational after register allocation, so the result of define_peephole2 and define_splits performed after reload cannot rely on `%' to make the intended insn match.

and thus perhaps it is an optimisation hint that can be safely ignored?

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Anders Magnusson added a comment - 15/Mar/11 06:21 PM
True, fixed, it's ignored for now, thanks.