flat assembler
Message board for the users of flat assembler.
Index
> Projects and Ideas > idea for code generator for math functions (optimizing compi |
Author |
|
revolution 30 May 2012, 06:08
I think that is a task for an HLL compiler. Write it in C (or whatever language one prefers), compile, and extract the resulting assembly code.
However don't expect it to be good code, it will be adequate. |
|||
30 May 2012, 06:08 |
|
tthsqe 30 May 2012, 06:54
hmmm..
That doesn't always work: What if I don't have a HLL compiler? (Or I can't get it to work) What if the compiler places transcendental functions in some other place? What if the program could use some simplifying assumptions about the function to produce better code than the compiler. I was thinking it to be more of a fun exercise in basic HLL -> quality asm transformation. I admit it is probably not that useful. |
|||
30 May 2012, 06:54 |
|
shutdownall 30 May 2012, 09:12
Well you could create a mathlib (inc) which could be included in projects when needed and publish it here.
|
|||
30 May 2012, 09:12 |
|
typedef 30 May 2012, 09:41
tthsqe wrote: hmmm.. Use naked functions. You must however make the prologue and epilogue in ASM (inline) like so. Code: __declspec(naked) type convention func_name(parameters...) { __asm push ebp __asm mov ebp, esp // your C code here __asm mov esp, ebp __asm pop ebp ret // return that complies with appropriate convention used. } Your function will then start with MOV EDI,EDI. You can then re-assemble the code in FASM with probably some optimization and tweaks to suit. Good luck. |
|||
30 May 2012, 09:41 |
|
JohnFound 30 May 2012, 09:54
Learn, to think assembly language. Then you will be able to freely write any function.
|
|||
30 May 2012, 09:54 |
|
tthsqe 03 Jun 2012, 23:12
I find thinking in assembly very error-prone when dealing with the x87 fpu - what I'm working on is a homemade optimizing compiler for HLL -> fpu to explore how compilers like gcc or icc work.
|
|||
03 Jun 2012, 23:12 |
|
Madis731 26 Jun 2012, 22:35
I think the optimizer (or the brain) should turn to FPU only for FSINCOS and such functions, because stuff like MULSD, ADDSD can be accomplished out-of-order in the SSE.
|
|||
26 Jun 2012, 22:35 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.