Re:Asm-declaration – Embed assembly language code within a C...
by ____Sash---701_ on Friday July 26, 2019 @11:54AM
(#20535708)
I believe it was discussed in Cologne, 'Enabling Constexpr Intrinsics......' - http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p166...
Quite a meaty document, should provide you with help for material on the subject.
Re:Asm-declaration – Embed assembly language code within a C...
by paulirwin on Friday July 26, 2019 @01:53PM
(#20536761)
Even as a C++ amateur I didn't find it as a meaty or intimidating proposal, rather it was refreshingly brief. If you understand that constexpr functions can be evaluated at either run time or compile time, it makes sense that asm isn't allowed in a compile-time context (it could get really trippy if it was!). This allows for flow analysis to permit asm when evaluating at runtime within a constexpr function, as long as there's a non-asm constexpr alternative path available at compile time. If I'm misunderstanding or missing some subtleties, as a novice I'd appreciate any corrections.
Re:Asm-declaration – Embed assembly language code within a C...
by stevekemp on Friday July 26, 2019 @01:57PM
(#20536814)
Trial and error is valuable, but if you go to github and search for "movq", "ld a,(hl)", or similar string you can often find examples of code that is presumably working.
I'm reminding myself of Z80 assembly at the moment, building a simple computer and I've done a bit of that.
On a related note, I always find the official docs for GCC inline assembly are insufficient for figuring out what I am trying to do. I nearly always have to resort to dumb trial and error. I was just recently planning to write some docs of my own on the subject. Not tutorial docs, but reference docs.