This is the mail archive of the gcc@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]

Re: Suggestions for extended asm


Michael Meissner <meissner@cygnus.com> wrote:
> The usual solution is to extend gas so it can reverse the sense of the test and
> do a jump around a jump.  You always are fighting a losing game having the
> compiler know the lengths.

Yes (I see it is already done on a few other targets), though it may
be tricky on AVR: it would have to correctly handle conditional skip
instructions, which can only skip one real machine instruction, and only
if it is not a two-word instruction (AVR core bug with interrupts).

So the following ("skip" and "branch" used as general names for any
of the suitable AVR instructions):

	skip
	branch	label

would generally need to be expanded to:

	skip
	branch	1f	; always one-word instruction
	rjmp	2f
1:
	rjmp	label	; safe to expand to "jmp" if still out of range
2:

(some optimization is possible if branch is unconditional "rjmp" and
skip is not "cpse" which has no reverse condition form, but that might
be a little too much AVR assembler hackery for the GCC list :-).

> IMHO, what we should do is allow general attributes to be set (maybe adding
> another ':' followed by pairs of comma separated string strings.

Yes, that would be nice.

Thanks,
Marek

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