Coder Social home page Coder Social logo

Add floating point type? about amacc HOT 3 CLOSED

jserv avatar jserv commented on June 19, 2024
Add floating point type?

from amacc.

Comments (3)

HPCguy avatar HPCguy commented on June 19, 2024

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.

HPCguy avatar HPCguy commented on June 19, 2024

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.

HPCguy avatar HPCguy commented on June 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.