Comments (3)
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()
{
int ii;
union {
int i;
float f;
} val;
float a = malloc(10sizeof(float));
val.f = 1.0; // actually works!
for (ii=0; ii<10; ++ii) {
a[ii] = val.f;
val.i = val.i + 0x10000;
}
for (ii=0; ii<10; ++ii) {
val.f = a[ii];
printf("%08x\n", val.i);
}
return 0;
}
$ ./amacc decl.c
3f800000
3f810000
3f820000
3f830000
3f840000
3f850000
3f860000
3f870000
3f880000
3f890000
80: e24b0008 sub r0, fp, #8
84: e52d0004 push {r0} ; (str r0, [sp, #-4]!)
88: ed9f0a6c vldr s0, [pc, #432] ; 0x240 <---- fp constant
8c: e49d1004 pop {r1} ; (ldr r1, [sp], #4)
90: ed810a00 vstr s0, [r1] <----- proper data movement with coprocessor
94: e24b0004 sub r0, fp, #4
98: e52d0004 push {r0} ; (str r0, [sp, #-4]!)
9c: e3a00000 mov r0, #0
a0: e49d1004 pop {r1} ; (ldr r1, [sp], #4)
a4: e5810000 str r0, [r1]
a8: ea000022 b 0x138
a[ii] = val.f // float data movement works with complex types
ac: e24b000c sub r0, fp, #12
b0: e5900000 ldr r0, [r0]
b4: e52d0004 push {r0} ; (str r0, [sp, #-4]!)
b8: e24b0004 sub r0, fp, #4
bc: e5900000 ldr r0, [r0]
c0: e52d0004 push {r0} ; (str r0, [sp, #-4]!)
c4: e3a00004 mov r0, #4
c8: e49d1004 pop {r1} ; (ldr r1, [sp], #4)
cc: e0000091 mul r0, r1, r0
d0: e49d1004 pop {r1} ; (ldr r1, [sp], #4)
d4: e0800001 add r0, r0, r1
d8: e52d0004 push {r0} ; (str r0, [sp, #-4]!)
dc: e24b0008 sub r0, fp, #8
e0: ed900a00 vldr s0, [r0]
e4: e49d1004 pop {r1} ; (ldr r1, [sp], #4)
e8: ed810a00 vstr s0, [r1]
constant pool includes FP
234: b6c06340 strblt r6, [r0], r0, asr #6
238: b6c87008 strblt r7, [r8], r8
23c: 00010000 andeq r0, r1, r0
240: 3f800000 svccc 0x00800000
244: b6c06334 ; instruction: 0xb6c06334
from amacc.
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.
from amacc.
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.
from amacc.
Related Issues (20)
- AssertionError: shift operations HOT 3
- How left shift handles negative number? HOT 1
- Remove the presence of global *e HOT 3
- Improve portability by adding ssize_t and long types
- Reorder opcode enumeration HOT 1
- Incorrect execution result for simple program HOT 2
- Modulo (operator%) does not give correct result HOT 2
- Can't create elf file directly on ARM? HOT 9
- Calling convention documentation? HOT 1
- id->class is not consistently defined HOT 3
- Can the codegen() for IR instruction CLCA be removed? HOT 3
- Consider adding static storage class? HOT 4
- Allow array declarations using [] operators. HOT 2
- Enhance robustness of '[ ]' operator for array access. HOT 2
- Can't create ELF executable from bootstrap amacc compiler
- Add support for struct assignement.
- Compound assign operators don't work with struct member lvalues HOT 1
- bad dereference compiler error HOT 1
- Simple program breaks the compiler HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amacc.