On Wednesday, 18 August 2021 at 08:09:36 UTC, Iain Buclaw wrote:
On Wednesday, 18 August 2021 at 07:08:09 UTC, Mahdi wrote:
A helloworld program on the X86_64-pc-linux-gnu platform
contains 40 lines of assembly code or on the ARM
(aarch64-linux-gnu) platform only 34 lines of assembly code,
but on the risc-v(riscv64-unknow-gnu-linux) platform contains
871 lines of code on the explore.dgnu.org site!
I'm concerned that this will affect the performance of the
risc-v platform.
A Phobos helloworld is over 1000 lines of assembly on both
x86_64 and ARM64. My guess is that Compiler Explorer isn't
smart enough to filter RISC-V assembly in the same way as ARM
or X86.
This can be confirmed locally with objdump, to reveal a bunch of
code that's filtered out by default:
```
$ cat hello.d
void main() {
import std.stdio : writeln;
writeln("Hello, world!");
}
$ gdc hello.d
$ objdump -dwr --no-show-raw-insn a.out | grep -m1 isValidDchar |
ddemangle
3179a: call 6b870 <pure nothrow @nogc @safe bool
std.utf.isValidDchar(dchar)>
```
You can also confirm it the Compiler Explorer by opening the
Filter menu, below the compiler selection and "Compiler
options..." input, and unchecking the 'Directives' filter.