-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[WIP] Introduce floats canonicalize, min, max intrinsics etc. #4559
Conversation
Sorry, but I don't understand why this is useful, why there are so many |
In addition to what @asterite said, if there's a LLVM intrinsic why aren't we binding and using it in instrinsics.cr. |
@asterite There are two problems now:
And I have a question - how to embed checks for existence of imported function in Library? llvm.canonicalize available from LLVM 5, llvm.minmax available from 3.N (I doesn't check which N). @RX14 Yes, I have seen intrinsics, but doesn't understood criteria to place them into Intrinsics or LibM. Looks like they exists everywhere. |
I think the float normalization intrinsic should go in |
It does bad distribution. I prefer this: https://github.com/python/cpython/blob/master/Python/pyhash.c#L34 |
It is not the problem, I will add IS_50 constant if needed. But OK, will replace, recompile and try. |
No. We don't support LLVM5 and compiling and linking against LLVM5 will just fail. |
@ysbaddaden I want just to add IS_50 = {{LibLLVM::VERSION.starts_with?("5.0")}} and test for it with {% if LibLLVM::IS_50 %}
fun canonicalize_f32 = "llvm.canonicalize.f32"(value : Float32) : Float32
fun canonicalize_f64 = "llvm.canonicalize.f64"(value : Float64) : Float64
{% end %} and other places. To not rewrite code later. |
|
|
See http://llvm.org/docs/LangRef.html#llvm-canonicalize-intrinsic for details. Fix FloatXX.hash to use canonicalize. Introduce LibLLVM::IS_5 constant.
0fedf21
to
e8577ba
Compare
Thanks to @RX14 and @ysbaddaden for your help. Now it's ready. P.S.: Sorry for bad commits since I did not have a working VM during the day. |
@asterite Looks like compiler cannot be built using LLVM <4.0, it raises on LLVM 3.8/Travis:
I don't know, is it OK? |
Looks like I must not use This pull request will be [WIP] until #4396 landed. Anyway I can rework Float hashing with |
It works fine with LLVM 3.6+, just tested. Extracted from crystal-lang#4559.
See http://llvm.org/docs/LangRef.html#llvm-canonicalize-intrinsic for details.
It is first step to rework Floats hashing.