Skip to content

yl2x is a DigitalMars-specific builtin#4671

Merged
MartinNowak merged 1 commit intodlang:masterfrom
ibuclaw:ddmd_yl2x
Aug 23, 2015
Merged

yl2x is a DigitalMars-specific builtin#4671
MartinNowak merged 1 commit intodlang:masterfrom
ibuclaw:ddmd_yl2x

Conversation

@ibuclaw
Copy link
Member

@ibuclaw ibuclaw commented May 20, 2015

Fix linker errors building with gdc, much more to come... :-)

@ibuclaw ibuclaw added the DDMD label May 20, 2015
@WalterBright
Copy link
Member

The y2lx instruction is x86 specific, not Digital Mars specific.

@ibuclaw
Copy link
Member Author

ibuclaw commented May 20, 2015

Is INLINE_YL2X set in the DMD compiler? That would be one compromise if it did.

@WalterBright
Copy link
Member

Is INLINE_YL2X set in the DMD compiler?

No. Just provide a yl2x function in the GDC port.

@ibuclaw
Copy link
Member Author

ibuclaw commented May 21, 2015

No. Just provide a yl2x function in the GDC port.

I'd rather not. There is no way to map it to any architecture (even x86) on my side.

@WalterBright
Copy link
Member

Why wouldn't inline assembler work?

@ibuclaw
Copy link
Member Author

ibuclaw commented May 21, 2015

It goes against convention - and will be a red flag for any reviewers in upstream GCC.

It's difficult enough fixing the front-end so it doesn't care about what target it is generating code for, let alone what host we will be running on.

@yebblies
Copy link
Contributor

This change means that ddmd built with gdc won't be able to evaluate the yl2x intrinsics at compile time, while dmd built with gcc can? Does gcc/gdc really not provide this builtin in some way?

@yebblies yebblies closed this May 21, 2015
@yebblies yebblies reopened this May 21, 2015
@yebblies
Copy link
Contributor

Sorry, hit wrong button.

@ibuclaw
Copy link
Member Author

ibuclaw commented May 21, 2015

Sorry, hit wrong button.

You're lucky I'll be absent next week, or you will have something to be sorry about... :-)

This change means that ddmd built with gdc won't be able to evaluate the yl2x intrinsics at compile time, while dmd built with gcc can? Does gcc/gdc really not provide this builtin in some way?

There's log2l, but it will produce wildly different results from fy2lx - that is to say, dmd's fy2lx will give incorrectly rounded results vs. log2l.

@yebblies
Copy link
Contributor

You're lucky I'll be absent next week, or you will have something to be sorry about... :-)

You're not coming this year?

There's log2l, but it will produce wildly different results from fy2lx - that is to say, dmd's fy2lx will give incorrectly rounded results vs. log2l.

Hmm ok. Do we have a ctfeable implementation in core.math? If so, can we just completely remove ctfe builtin support? It seems like much too obscure a thing to have compiler code dedicated to it.

I don't want a compiler built by dmd and a compiler built by gdc to have different capabilities, I'm sure you can agree.

@ibuclaw
Copy link
Member Author

ibuclaw commented May 22, 2015

Do we have a ctfeable implementation in core.math?

No.

It seems like much too obscure a thing to have compiler code dedicated to it

This is what I said in the original PR for CTFE-yl2x! You still merged it in despite my warnings.

I don't want a compiler built by dmd and a compiler built by gdc to have different capabilities

On that note, std.math.tan is a problematic function too that DMD treats like a built-in.

@yebblies
Copy link
Contributor

Do we have a ctfeable implementation in core.math?

No.

Oh yeah, it doesn't need to be ctfeable. Just present. Does GDC druntime not provide this either?

This is what I said in the original PR for CTFE-yl2x! You still merged it in despite my warnings.

I didn't merge it.

On that note, std.math.tan is a problematic function too that DMD treats like a built-in.

What's so problematic about tan?

But yeah, we should probably avoid adding ctfe intrinsics that depend on the host compiler/runtime.

@ibuclaw
Copy link
Member Author

ibuclaw commented May 22, 2015

What's so problematic about tan?

It's a weird half/half. DMD recognises it as a CTFE-able builtin, but runtime it uses inline assembler.

For simplicity on my part, I only implement body-less functions in std.math/core.math as intrinsics.

@ibuclaw
Copy link
Member Author

ibuclaw commented May 23, 2015

And... I found a case where the implied use of yl2x broke gdc, along with every non-x86 target. dlang/phobos#3309

Sigh - We should put a stop to this by removing uses of yl2x from std.math. They might have been useful in the beginning. But not anymore.

@yebblies
Copy link
Contributor

Or by implementing a portable version somewhere.

@ibuclaw
Copy link
Member Author

ibuclaw commented May 23, 2015

Or by implementing a portable version somewhere.

It's caled log2, I did this 2 years ago.

dlang/phobos@bf2b2a1

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

else assert(0);

MartinNowak added a commit that referenced this pull request Aug 23, 2015
yl2x is a DigitalMars-specific builtin
@MartinNowak MartinNowak merged commit 232cd7e into dlang:master Aug 23, 2015
@ibuclaw ibuclaw deleted the ddmd_yl2x branch August 23, 2015 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants