News for hackers. Stuff that matters.
Re:Qnice – An Elegant 16 Bit Processor by pjc50 on Friday March 13, 2020 @06:29AM (#22566166)
> why the higher-level syntax has never made its way to lower level ASM has baffled me

Traditionally assembler was both for bootstrap processes and for the older heavily resource constrained systems, so there was a lot of emphasis on making it as simple to parse as possible; opcode first, then arguments, because the opcode is first in the byte stream of almost all variable-instruction length systems.

And of course no support for complex expressions, so no point in building a full mathematic expression parser.

Then there's the question of which add instruction you want. The vast proliferation of instructions in things like AVX gives you "VADDPS" and even "VFMSUBADD132PD", which expands to: https://www.felixcloutier.com/x86/vfmsubadd132pd:vfmsubadd21...

    IF (VEX.128) THEN
        DEST[63:0]←RoundFPControl_MXCSR(DEST[63:0]*SRC3[63:0] + SRC2[63:0])
        DEST[127:64]←RoundFPControl_MXCSR(DEST[127:64]*SRC3[127:64] - SRC2[127:64])
        DEST[MAXVL-1:128] ←0
    ELSEIF (VEX.256)
        DEST[63:0]←RoundFPControl_MXCSR(DEST[63:0]*SRC3[63:0] + SRC2[63:0])
        DEST[127:64]←RoundFPControl_MXCSR(DEST[127:64]*SRC3[127:64] - SRC2[127:64])
        DEST[191:128]←RoundFPControl_MXCSR(DEST[191:128]*SRC3[191:128] + SRC2[191:128])
        DEST[255:192]←RoundFPControl_MXCSR(DEST[255:192]*SRC3[255:192] - SRC2[255:192]
    FI
    VFMSUBADD213PD DEST, SRC2, SRC3
    IF (VEX.128) THEN
        DEST[63:0]←RoundFPControl_MXCSR(SRC2[63:0]*DEST[63:0] + SRC3[63:0])
        DEST[127:64]←RoundFPControl_MXCSR(SRC2[127:64]*DEST[127:64] - SRC3[127:64])
        DEST[MAXVL-1:128] ←0
    ELSEIF (VEX.256)
        DEST[63:0]←RoundFPControl_MXCSR(SRC2[63:0]*DEST[63:0] + SRC3[63:0])
        DEST[127:64]←RoundFPControl_MXCSR(SRC2[127:64]*DEST[127:64] - SRC3[127:64])
        DEST[191:128]←RoundFPControl_MXCSR(SRC2[191:128]*DEST[191:128] + SRC3[191:128])
        DEST[255:192]←RoundFPControl_MXCSR(SRC2[255:192]*DEST[255:192] - SRC3[255:192]
    FI
Re:Qnice – An Elegant 16 Bit Processor by throwaway_pdp09 on Friday March 13, 2020 @06:40AM (#22566211)
We don't have resource constrained systems now. I doubt parsing asm ever took up much anyway.

I'm not suggesting we permit complex (ie. general opcode combination) expressions. I deliberately never suggested it.

As to straighforward FMAC-type instructions, that's even clearer in my notation: a += b * c

But As for the proliferation of those add types you linked to, OK, possibly valid, but how much of this are you going to be manually writing compared to the very mundane style non-simd non-packed instructions? My guess is very little as you have relatively few number of such instructions (although they're doing a great deal of work over streams of data, but that's not relevant).

Re:Qnice – An Elegant 16 Bit Processor by pjc50 on Friday March 13, 2020 @08:56AM (#22566856)
Oddly I think it's the weird instructions that people are going to write more often: hardly anyone writes assembler compared to the more likely use case of reading disassembly, and when they are writing it it's usually specifically to do something that's difficult or impossible to get a high level language to emit.
Re:Qnice – An Elegant 16 Bit Processor by throwaway_pdp09 on Friday March 13, 2020 @08:59AM (#22566879)
I think that makes a lot of sense.
Re:Qnice – An Elegant 16 Bit Processor by carapace on Friday March 13, 2020 @10:09AM (#22567338)
"Terse"

I'll be damned, it still exists, in all it's glory: http://terse.com/

> TERSE represents a whole new concept in low-level programming and is the first real advance in assembly language programming since the invention of the Macro Assembler.

> TERSE is an x86 specific programming language compatible with the entire processor family from the 8088 through the Pentium 4 and beyond. It is a machine-level language that gives you all of the control available in assembly language with the ease-of-use and the look-and-feel of a high-level language like C.

> TERSE is a very mature language. Conceived in 1986, implemented in 1987, proven in real world applications for over a decade, and used by Fortune 250 corporations, universities, and programmers on six continents since 1996! TERSE has virtually replaced assembly language for time and/or space critical applications in embedded x86 based and PC applications.

Re:Qnice – An Elegant 16 Bit Processor by oso2k on Friday March 13, 2020 @03:38PM (#22570246)
Good ol' Terse. Terse & HLA [0] always tended too far to the ASM side. Made writing it seem more like messy ASM. I wanted some thing more like C. Then I realized, I already had working C.

[0] http://plantation-productions.com/Webster/HighLevelAsm/hla_e...