April 10
On Wed, 10 Apr 2019 at 15:10, Stefanos Baziotis via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
>
> On Wednesday, 10 April 2019 at 12:56:39 UTC, Radu wrote:
> > Actually, this is what you might look for:
> >
> > https://godbolt.org/z/Zvyc3G
> >
> > Notice that at -O the memcmp is inlined.
>
> Yes, thanks Radu, as I said in the previous post, I don't have
> LDC on my machine
> right now to test but I also didn't know that godbolt supports D.
> That's good.
> GDC interestingly does not inline it.
>

You need to cast(bool), or memcmp() == 0.

-- 
Iain
April 10
On Wed, 10 Apr 2019 at 16:07, Iain Buclaw <ibuclaw@gdcproject.org> wrote:
>
> On Wed, 10 Apr 2019 at 15:10, Stefanos Baziotis via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> >
> > On Wednesday, 10 April 2019 at 12:56:39 UTC, Radu wrote:
> > > Actually, this is what you might look for:
> > >
> > > https://godbolt.org/z/Zvyc3G
> > >
> > > Notice that at -O the memcmp is inlined.
> >
> > Yes, thanks Radu, as I said in the previous post, I don't have
> > LDC on my machine
> > right now to test but I also didn't know that godbolt supports D.
> > That's good.
> > GDC interestingly does not inline it.
> >
>
> You need to cast(bool), or memcmp() == 0.
>

If you are interested in the number returned from memcmp(), I guess the reason why it wouldn't inline might be to do with the endianess, and that the order memcmp compares is in the other direction - I think you'll need to bswap all values before you compare.

-- 
Iain
April 10
On Wednesday, 10 April 2019 at 13:09:19 UTC, Stefanos Baziotis wrote:
> [snip]
>
> Yes, thanks Radu, as I said in the previous post, I don't have LDC on my machine
> right now to test but I also didn't know that godbolt supports D. That's good.
> GDC interestingly does not inline it.

I'm a big fan of run.dlang.org
April 10
On Wednesday, 10 April 2019 at 14:12:02 UTC, Iain Buclaw wrote:
>
> You need to cast(bool), or memcmp() == 0.

Yes, thanks, didn't catch it.

> I guess the reason why it wouldn't inline might be to do with the endianess, and that the order memcmp compares is in the other direction - I think you'll need to bswap all values before you compare.

From what I know, endianess can cause differences in the result but how
does it change the inlining of the compiler?
April 10
On Wednesday, 10 April 2019 at 14:38:34 UTC, jmh530 wrote:
>
> I'm a big fan of run.dlang.org

I have to use from the first time I learned D. I didn't know it supports LDC.
It's very usefult that you can see the LLVM IR!
I like Godbolt better for asm, because of the coloring for each line. :)


Next ›   Last »
1 2 3 4 5