Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is LLVM's Intrinsic llvm.sin.f64 unsupported? #4338

Closed
Maher4Ever opened this issue May 19, 2016 · 4 comments
Closed

Is LLVM's Intrinsic llvm.sin.f64 unsupported? #4338

Maher4Ever opened this issue May 19, 2016 · 4 comments
Labels

Comments

@Maher4Ever
Copy link
Contributor

Maher4Ever commented May 19, 2016

Hello Emscripten devs!

I'm trying to compile an LLVM IR file to JS using emscripten. Some functions in that file use the Sin function and it's declared as follows:

declare double @llvm.sin.f64(double) #2

; Other code ...

attributes #2 = { nounwind readnone }

When I compile my LLVM IR file, emcc complains about a missing sin function:

warning: unresolved symbol: llvm_sin_f64

I noticed that the dots are replaced with underscores in the function name, but my files doesn't contain any references to that function; only to the standard LLVM one with dots.

Since emcc can't find this function it has an incomplete implementation in the generated JS:

function _llvm_sin_f64() {
  Module['printErr']('missing function: llvm_sin_f64'); abort(-1);
}

I'm running the 64 bit version of emscripten from the incoming branch.

Is the @llvm.sin.f64 intrinsic unsupported? Or is this a bug?

@Maher4Ever Maher4Ever changed the title Is @llvm.sin.f64 unsupported? Is LLVM's Intrinsic @llvm.sin.f64 unsupported? May 19, 2016
@Maher4Ever Maher4Ever changed the title Is LLVM's Intrinsic @llvm.sin.f64 unsupported? Is LLVM's Intrinsic llvm.sin.f64 unsupported? May 19, 2016
@kripken
Copy link
Member

kripken commented May 19, 2016

This does look like a bug. We should implement it the same way as lllvm.fabs.* etc., in fastcomp's lib/Target/JSBackend/CallHandlers.h. Alternatively it could be added to library.js, which would make it work, but be a slower call out of asm.js.

@Maher4Ever
Copy link
Contributor Author

I tried only modifying CallHandler.h in fastcomp and redirecting the call to the Math Sin function, but that didn't work. I also had to redirect the call in library.js. Now It's working, I'll run the tests and if everything goes fine I'll submit a pull request.

@Maher4Ever
Copy link
Contributor Author

I submitted the fix as promised above. I ran the complete test suite and everything passed.

@stale
Copy link

stale bot commented Aug 30, 2019

This issue has been automatically marked as stale because there has been no activity in the past 2 years. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant.

@stale stale bot added the wontfix label Aug 30, 2019
@stale stale bot closed this as completed Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants