The attached file gcc.diff contains a kinda helpless attempt to generate
this instruction. My first problem is that any optimization optimizes it
away because it is a NOP. Is there any way to prevent the optimizer from
removing it?
You can make a new instruction pattern with an UNSPEC_VOLATILE pattern.
For a quick prototype you could also use an assembler prologue, although
if you need not experiment with different insn sequences, this will likely
be more work in the long run if/when assembler prologues are eventually
discontinued.

Finally, is there a nicer way to specify the %edi register? Hardcoding the
value 5 doesn't look pretty.
You can use a define_constants definition in the .md file to give a symbolic
name to such constants.  i386.md already has DI_REG .

Now I need gcc to set this suffix, but here I am pretty lost. I haven't
found out yet how to add this to the gcc code.
This becomes a non-issue when you define your own UNSPEC_VOLATILE pattern
or assembler prologue.

The other issue is
compatibility with old binutils versions, since so far this feature is in
svn only and no release has it.
You could fall back to .byte / .short directives to emit specific opcodes.

Reply via email to