-
Notifications
You must be signed in to change notification settings - Fork 128
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
[CIR][CIRGen][Builtin][Type] Support for IEEE Quad (long double) added (in CIR + Direct to LLVM) #966
Conversation
Added type definition in CIRTypes.td, created appropriate functions for the same in CIRTypes.cpp like getPreferredAlignment, getPreferredAlignment, etc. Optionally added lowering in LowerToLLVM.cpp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, thanks for working on this! Please add tests for the changes. The new set of tests should cover both the CIRGen part and the LLVM lowering part.
At a bare minimum, check out clang/test/CIR/CodeGen/types.c
and update it to include fp128.
Long double gets converted to fp128 (IEEE Quad) when compiled for a few selected architectures, hence compile and checks added to types-IEEE-quad.c (for cir gen check), and types-IEEE-quad.cir (for cir direct lowering) in their respective folders.
Thanks for you suggestions @Lancern I have added 2 test cases one for CIR gen and one for lowering. |
removed the llvm_unreachable("NYI") for IEEEquad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for this!
It seems some unrelated formatting/header include changes got pulled in. It's not a problem here, but it can sometimes make diffs harder to read, so if there's any editor configuration you can find to disable those, it might be useful for the future :)
Unused header removed from CIRTypes.cpp, combined the lowering tests and the cir gen tests into one, with proper FILECHECK directives.
@smeenai Thank you, for taking out the time to review my PR, I have incorporated the changes you suggested. :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this, inline comment follows.
Modified test case to change prefix to check cir to CIR and to change prefect to check llvm ir to LLVM.
@bcardosolopes , Thank you for reviewing my PR, I have made the changes you requested. :) |
Thanks guys for all the help along the way. :) |
Thank you for the patch; |
Addresses #931
Added type definition in CIRTypes.td, created appropriate functions for the same in CIRTypes.cpp like getPreferredAlignment, getPreferredAlignment, etc. Optionally added lowering in LowerToLLVM.cpp
This is for test case2 : (https://godbolt.org/z/8Y85148EY)
If you want me to add the test case to any perticular folder / with a certain name please let me know,
As of test case 1, rightly pointed out by @Lancern it might be an due to lack of support for int128 and is tracked by another issue.
If I missed anything do let me know :)