Port-vax archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Some more patches for GCC on NetBSD/VAX coming soon...



On 2016-04-01 14:32, Rhialto wrote:
On Thu 31 Mar 2016 at 21:24:04 -0700, Jake Hamby wrote:
On VAX, you might be able to do the same thing if there's a
particularly long instruction that's an effective nop and is faster to
execute than the number of bytes it is.

Is there any mechanism in gcc to jump into the middle of an instruction
which is (effectively) a nop when executed from the start, but which can
be mostly any (shorter) instruction when entered somewhere in the
middle?

It's a common technique on 8-bitters such as the 6502, to avoid extra
branches:

	cmp #42
	beq label
	lda #1
	.byte $2C   ; opcode for a 3-byte instruction that doesn't do much,
		    ; usually the BIT abs instruction that only changes
		    ; condition codes
label:	lda #2	    ; a 2-byte instruction
	...

Ooo. A tricky way of doing a skip. I hadn't seen that before. Nice.
However, on, for example a VAX, this is pretty hard to do, as the instruction length is not encoded into the opcode. So, you do not know how many bytes will be consumed by an instruction from just looking at the opcode byte. And this also means that whatever you happen to stuff into the following bytes would also affect the "skip" instruction size. So this is close to impossible to do on a VAX. Other architectures might be different. I doubt gcc in general would know and use such tricks. But that's just a guess on my part.

	Johnny



Home | Main Index | Thread Index | Old Index