Instructions that inject results into the next instruction
Seairth
Posts: 2,474
in Propeller 2
It occurs to me that SCA, SCAS, GETXACC, and XORO32 have an issue from a discovery perspective. All four instructions stuff a value into the next instructions S register, but the subsequent instruction doesn't look any different. In other words, it is not immediately obvious that "something else" is going on. I am not suggesting that the instructions should be changed, mind you. Instead, I'm thinking that there should be some means to easily indicate this in the code. But a particular recommendation escapes me. I know the old "0-0" trick for P1 might work, but it doesn't feel like a real solution. So, for now, I'm just putting it out there for discussion.
Comments
True, but I left them out because they at least "ALT" something.
I guess it would be nice to hide ALTS/D/R with similar syntactic sugar too.
Except, in those cases, you still use all operands in the next instruction. The ALT instructions also do exactly what they say, though you still end up having to place a dummy/placeholder in the appropriate operand of the next instruction.
Enjoy!
M ike
I can't image how a programming language could be developed to use it. I guess we will be stuck with assembler.
Mike
That's not really germane to this discussion, I think.
Iseries, just you watch.
I happen to be flipping through my Moto 6809 programmers reference.
This book is beautiful. Each instruction has a page, and what you need to know is on that page. It is super easy to use.
Seems to me we can do a similar thing here. Page for each instruction, code snippet, effects.
As of right now, the syntax is lean and mean. Would hate to see it cluttered further over what is largely a documentation problem..
Mike
and with fastspin yuou have Spin1/2, Basic and C already as HLLs available. There is also Prop2gcc(?) using the existing port of gcc for the P1 and reworks the generated P1 PASM into P2 PASM.
The actual port from gcc for p2 is planned and some work is already done for P2 hot some intermediate P2.
Enjoy!
Mike
Have you written compiler backends and code generators? Take it from someone who has that the instruction
set is a lot better than many - lots of registers that are completely orthogonal is a huge benefit, all these AUG and
ALT instructions are just addressing modes in disguise, plenty of basic ALU operations. Compiling for the cordic
pipeline is no more tricky than for any other pipelined processor, and it can be used naively easily with lower
performance, and the block memory reads and writes enable efficient stack use.
This should be more like RISC instructions or ARM based. Less is more these days.
Mike
Valid point.
It has been suggested before that these unclear-patches of two lines, be presented to the user as a single, 3 operand opcodes, where that is clearer.
They really are 64 bit opcodes, and the user should not be bothered by needing to know the two obtuse jig-saw pieces that make up the 64b opcode..
Other MCUs have variable length opcodes, and anyone wanting to know exact sizes, and even exact break-downs, can always look at generated list files.
instruction to be more than one long. A warning would be generated for any multi-long instruction not annotated this way?
[ actually rather than 'ex', perhaps ##, since this already serves the purpose for AUGS/AUGD, or 'aug' ]
Also if we still need to keep some original argument name lying around for D instead of using 00-00 maybe we can just put in "d_value-00" for the D field assuming the assembler allows it and won't affect the generated code in any way. I agree it is not perfect but at least helps show something special happens there that is different from the 0-0 case.
-Phil
This has future-proofing for Prop3, as the port injection will be an optional parameter there. Although it doesn't resolve the immediate concern over erratic looking sources.
So maybe not a bad idea to add aliases to the existing instruction pairs.
Enjoy!
Mike
How about an explicit placeholder symbol, such as $$, which lets the compiler know that you know what you're doing and lets it produce a warning when you don't use it?
setxxxx/getxxxx are all 3 op instructions, just the last op is a constant thus from the PASM syntax would if fit right in, just a macro in assembler...
Enjoy!
Mike