1. 31
  1. 12

    I’m curious to hear more about this:

    I still believe that there is an assembler to be built where assembly, macros, types and smart memory tracing could become dominant. Yes, the research exists in many forms. What I want to see is a single paper focusing on these 4 aspects of an assembly language.

    In particular, what does “smart memory tracing” mean here?

    Just in case you haven’t seen it yet here: I’m working on a system that has no Assembly or C, just machine code and a type-safe language. It even has a paper about it. But the underlying desire you’re hinting at could be close to what I’m doing.

    1. 5

      I have seen your work and part of what I do is directly inspired by it!

    2. 7

      I’d be interested to see what the compiler came up with, to compare it to your hand-written code?

      1. 1

        You can? :) I didn’t include a comparison because the post would’ve gotten huge but I did mention I peeked into it.

      2. 2

        Run it through Godbolt to see what both gcc and clang (among others) do with it.

        1. 1

          I just used objdump against the gcc generated binary, but yes it’d be neat to see what other compilers do. Most likely they all generate similar code. While working on it another person was checking that out actually.

          1. 2

            I more meant, run the original through Godbolt and see what various compilers produce and how that compares.

            1. 1

              I’d recommend just looking at the asm output, perhaps in Intel syntax?

              gcc -S -masm=intel test.c

              Experiment with -O0…-O3.. And you should be able to use diff for some insight.

              (I guess using objdump is similar - I’m not sure if the output is the same. Haven’t checked:

              objdump -d –disassembler-options=intel a.out )

          2. 1

            Did you use -march=native flag to the C compiler? That would take advantage of all your CPU features, which could give you some clues to improve the hand written assembly.

            1. 1


            2. 1

              Simplest thing would be to use VTune to analyse the running code & see what’s going on. At a guess the compiler is probably managing to avoid instruction dependencies that are causing your code to induce pipeline stalls, given that it isn’t using any magic instructions.

              1. 1

                (or use perf under linux, which can work as a substitute for VTune in the right circumstances :) )