[llvm-dev] Is it legal to pass a half by value on x86_64? (original) (raw)

Craig Topper via llvm-dev llvm-dev at lists.llvm.org
Thu Mar 4 22:24:42 PST 2021


I'm not sure how robust the half support is on X86, clang should never generate it. I believe in llvm 11 it changed to pass in the lower 16 bits of an integer register instead of in a float register. What does "incorrect math operations" mean? We're emulating half precision with floats and a conversion function, I don't think it will always match exactly with what native half would do.

Do you have a more complete IR file for Windows that I can take a look at?

~Craig

On Thu, Mar 4, 2021 at 9:45 PM Jason Hafer via llvm-dev < llvm-dev at lists.llvm.org> wrote:

Hello,

I am attempting to understand an anomaly I am seeing when dealing with half on Windows and could use some help. Using LLVM 8 or 10, if I have IR of the flavor below: define void @foo(i8, i8, i8, i8, half) { %6 = alloca half store half %4, half* %6, align 1 ... ret void } _Using x8664-pc-linux, we convert the float passed in with gnuf2hieee. Using x8664-pc-windows I do not get the conversion, so we end up with incorrect math operations. While investigating I noticed clang gave me the error below: _error: parameters cannot have fp16 type; did you forget * ? _void foo(int dc1, int dc2,int dc3,int dc4, fp16 in) So, this got me wondering if "define void @foo(i8, i8, i8, i8, half) " is even legal to use or if I should rather pass by ref? I have yet to find documentation to convince me one way or the other. Thus, I was hoping someone here might be able to shed some light on the issue. Thank you in advance! Cheers, JP


LLVM Developers mailing list llvm-dev at lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210304/85c43dc3/attachment.html>



More information about the llvm-dev mailing list