-
Notifications
You must be signed in to change notification settings - Fork 158
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
Add floating point type? #90
Comments
I've opened a branch for this, and I have floating point data movement and floating point constants working. AMaCC is only 35 lines longer, which also includes support for typed function prototypes for external libraries. int main() val.f = 1.0; // actually works! for (ii=0; ii<10; ++ii) { for (ii=0; ii<10; ++ii) { return 0; $ ./amacc decl.c 80: e24b0008 sub r0, fp, #8 a[ii] = val.f // float data movement works with complex types ac: e24b000c sub r0, fp, #12 constant pool includes FP 234: b6c06340 strblt r6, [r0], r0, asr #6 |
I restructured quite a bit for this change, probably more than AMaCC would be comfortable with. I'm moving this ticket over to the HPCguy / Squint repository. I'll still be fixing the AMaCC bugs I have logged in the other issues here. |
Floating point support has been added to the Main branch of https://github.com/HPCguy/Squint. I will gladly add this to AMaCC as-is. |
I'm guessing 32bit floating point would take 150-400 lines of C source code to implement. For instance, now that dynamic library support has been expanded, AMaCC can call strtof() to parse float constants, saving many lines of compiler code. New IR symbols can be added for FP operations, probably around a dozen. It's my belief that type promotions and function call ABI would be the hardest part of the whole implementation. I think the AMaCC type system is already well positioned to handle float, although some comparison expressions in amacc.c may get longer if there are three base types to consider rather than two. The question for discussion is, just because it can be added, should it be added?
The text was updated successfully, but these errors were encountered: