Is GDC a solid option versus LDC?

2022-03-04 Thread rempas via D.gnu
From what I know, most people (if not all), seem to prefer LDC 
over GDC. When it comes to C, I always prefer GCC as GCC's 
backend compiles code faster and also produces code will run 
faster than LLVM (even if the differences are small). When it 
comes to D, GDC seems to compile code faster in my machine (AMD 
Ryzen 5 2400G) than LDC about 3-4 times faster!


However, I'm really skeptical as to why people seem to prefer LDC 
and I wonder if GDC is not as stable and reliable as LDC or if 
most code that uses recent code doesn't work in GDC. I have also 
heard that LDC get support for new things faster than GDC. Is 
that true? And if yes, then for how much difference are we 
talking about?


Any personal experiences would be much appreciated.


Re: Is GDC a solid option versus LDC?

2022-03-04 Thread rempas via D.gnu

On Friday, 4 March 2022 at 15:17:49 UTC, rikki cattermole wrote:


GDC has a few issues that LDC simply doesn't have.

For instance GCC can only depend on a binary of the last 
version of GCC (my knowledge of that is what I've heard from 
Iain).


What this means is its stuck using a frontend that is based 
upon a version that was still C++ and that is ol. Many 
years old.


The version you are probably using was released back in 2017, 
more or less. Yes some patches have been back ported (2.076 is 
the version, but even that was D so they had to have been 
rewritten into C++).


Right now GDC is close to getting the frontend written in D, 
which from what I hear should be next release. At which point 
it'll keep up.


Oh, sucks to hear that. Can I get some more info (links?) on that 
one? Also do you know where is the current development source of 
GDC?


Re: Is GDC a solid option versus LDC?

2022-03-04 Thread rempas via D.gnu

On Friday, 4 March 2022 at 15:26:38 UTC, H. S. Teoh wrote:


Both GDC and LDC are good compilers. I wouldn't hesitate to use 
either if performance is important in what I'm doing.


The only difference is that GDC, being a part of the GCC 
project, is tied to the GCC release cycle, so it tends to lag 
behind DMD and LDC in terms of the latest language 
developments.  LDC releases on its own schedule, and as of a 
year or two ago, has been closely tracking DMD releases, so it 
is very up-to-date in terms of language development. Being 
practically on par with DMD means that I can easily switch 
between DMD and LDC latest releases without having to worry 
about my code being incompatible with either.  (Though 
generally that doesn't really happen that much, and hardly at 
all if you aren't always keeping tabs on the latest language 
developments.)


If your code isn't reliant on the bleeding edge, though, GDC is 
definitely not inferior to LDC in any way.



T


Thank you! I was wondering, Is staying so much up to date really 
impossible here? Other than ImportC (which will still be 
completed at some point), D has already support for 1 million 
features already so will this be a big problem? I see this 
becoming a smaller problem with each release.


Re: Is GDC a solid option versus LDC?

2022-03-04 Thread rempas via D.gnu

On Friday, 4 March 2022 at 15:59:33 UTC, Iain Buclaw wrote:


announcement: 
https://forum.dlang.org/post/nuphsvwkdlygdcxai...@forum.dlang.org


mainline: https://gcc.gnu.org/git.html
gh-mirror: https://github.com/gcc-mirror/gcc/


Thanks a lot!


error: matching constraint references invalid operand number

2022-03-04 Thread rempas via D.gnu
Hello! After I've been convinced on using, GDC as my go to 
compiler when I need optimization (or other than x86_x64 targets) 
thanks to the replays of my previous posts, I now try to compiler 
my project using GDC but I'm having an error. I'm trying to use 
inline assembly (GCC syntax) but it won't compile (compiled 
without any problems with LDC). The inline assembly block 
specifically is part of the following function:


```d
i32 sys_clock_nanosleep(clock_id clock, i32 flags, timespec* req, 
timespec* rem) {

  i32 ret_code;

  asm {
"syscall"
: "=a" (ret_code)
: "a" (230), "D" (clock), "S" (flags), "d" (req), "r10" (rem)
: "memory", "rcx", "r11";
  }

  return ret_code;
}
```

When I try to compile, I'm getting the following error message:

```
source/time.d: In function ‘sys_clock_nanosleep’:
source/time.d:132:31: error: matching constraint references 
invalid operand number

  132 |   : "memory", "rcx", "r11";
```

Any ideas?


Re: error: matching constraint references invalid operand number

2022-03-05 Thread rempas via D.gnu

On Friday, 4 March 2022 at 23:33:12 UTC, Iain Buclaw wrote:


GCC doesn't have constraints for registers %r8 .. %15.  As D 
doesn't have register variables either, you'll have to set-up 
r10 in the instruction string.

```
asm {
  "mov %[rem], %%r10; syscall"
  : "=a" (ret_code)
  : "a" (230), "D" (clock), "S" (flags), "d" (req), [rem] "r" 
(rem)

  : "memory", "rcx", "r10", "r11";
}
```


Thank you! This will do the trick! Do you happen to know if D 
plans to add "registers" in the future or if it has been 
suggested but was rejected?


Also, how can I see the D specific options for GDC? Thinks like 
how to set "versions", options like the "-fno-druntime" and other 
specific D stuff as I'll I'm seeing in the "--help" message are 
options that are general and the output is in general the same as 
GCC.


Re: error: matching constraint references invalid operand number

2022-03-05 Thread rempas via D.gnu

On Saturday, 5 March 2022 at 17:31:17 UTC, Iain Buclaw wrote:


With the option "--help=d"


Alright! This will do the trick! Thanks a lot for your time and 
thanks a lot for your amazing work in GDC in general!


Re: Is GDC a solid option versus LDC?

2022-03-06 Thread rempas via D.gnu

On Friday, 4 March 2022 at 17:13:23 UTC, H. S. Teoh wrote:


As I said, if you're not relying on the latest-and-greatest 
bleeding edge, GDC is a perfectly fine compiler. Iain has 
already said the next release will be self-hosting, so we can 
finally move on from the ancient C++-based compiler to the 
latest self-hosted one. Once that's done, GDC should keep up 
with language developments at a much better pace than before.



T


Thank you! I do rely in a small D subset so I will be fine. Have 
an amazing day ;)