ARM first & default LDC

Max Haughton maxhaton at gmail.com
Wed Dec 16 10:33:43 UTC 2020


On Wednesday, 16 December 2020 at 10:26:46 UTC, Iain Buclaw wrote:
> On Wednesday, 16 December 2020 at 05:20:21 UTC, Max Haughton 
> wrote:
>>
>> Ultimately in this discussion of arm and RISC-V making the 
>> frontend asm {} blocks understand them would probably do more 
>> than changing compilers. It's a relatively simple thing to 
>> have but I don't think any other language can do it.
>
> asm {} blocks are cross platform without needing special 
> support.
>
>
> uint result = void;
> version (ARM)
> {
>     asm nothrow @nogc
>     {
>         "vmrs %0, FPSCR;
>          and %0, %0, #0x1F;" : "=r" (result);
>     }
> }
> else version (RISCV32)
> {
>     asm nothrow @nogc
>     {
>         "frflags %0" : "=r" (result);
>     }
> }
> return result;

I know I just like the dmd-style ones, it feels much more 
ergonomic than the equivalent in C++. I'm not a huge fan of GCC 
style asm, but ultimately I guess I'm bikeshedding.


More information about the Digitalmars-d mailing list