Ah yes haven't tested that. sorry!
One needs to set -ffast-math in order to have gcc compile to native cpu floating point operations. Here are my experiments:
The source. It is just like visual's OP but used x and y instead:
#include <math.h>
__attribute__((packed)) struct TIteration3Dext {
double Cw,Rold,RStopD,x,y,z,w; // use with neg indizes before C1. w is also used for 3d ifs and abox analytic DE
double Px, Py, Pz; // actual position, never change these! Can be used as input.
double Cx, Cy, Cz; //+24 these are the constants for adding. Pxyz or the julia seed. Cw is @-56 (begin of struct)
void* PVar; //+48 the actual formulas adress of constants and vars, constants at offset 0 increasing, user vars below -8
float SmoothItD; //+52
double Rout; //+56 the square of the vector length, can be used as input
int ItResultI; //+64
int maxIt; //+68
float RStop; //+72
int nHybrid[6]; //+76 all formulas iteration counts or single weights in interpol-hybrid
void* fHPVar[6]; //+100 all formulas pointer to constants+vars, PVars-8=0.5, use PVar for the actual formula
void* fHybrid[6]; //+124 the formulas adresses
int CalcSIT; //+148
int DoJulia; //+152
float LNRStop; //+156
int DEoption; //+160
float fHln[6]; //+164 for SmoothIts
int iRepeatFrom; //+188
double OTrap; //+192
double VaryScale; //+200 to use in vary by its
int bFirstIt; //+208 used also as iteration count, is set to 0 on it-start
int bTmp; //+212 tmpBuf, free of use.
double Dfree1; //+216
double Dfree2; //+224
double Deriv1; //+232 for 4D first deriv or as full derivs
double Deriv2; //+240
double Deriv3; //+248
float SMatrix4[4][4]; //+256 for 4d rotation, used like most other values only by the programs iteration loop procedure
};
// fastcall is not quite delphi fastcall.
// first two args are ok, third is in ecx in delphi, on stack here.
void __attribute__((fastcall)) formula(
double* x, // [eax]
double* y, // [edx]
double* arg, // [ebp+8], points to TIteration3Dext.C1
void* dummy // so we end w/ ret 8 as delphi expects
) {
// Compute ptr to proper start of TIteration3Dext struct.
struct TIteration3Dext* cfg = (struct TIteration3Dext*)(arg-7);
// Read / write some fields as demonstration.. not a real formula ;-)
double tmp=cfg->x;
cfg->x=cos(sin(cfg->y));
cfg->y=tmp;
}
Compile with
gcc -c -m32 -O3 -mfpmath=387 -ffast-math sineswap.c
Otput assembly juste to see if there are no library calls and no data sections:
objdump -D sineswap.o
sineswap.o: file format pe-i386
Disassembly of section .text:
00000000 <@formula@16>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 8b 45 08 mov 0x8(%ebp),%eax
6: 83 e8 38 sub $0x38,%eax
9: 8b 50 18 mov 0x18(%eax),%edx
c: 8b 48 1c mov 0x1c(%eax),%ecx
f: dd 40 20 fldl 0x20(%eax)
12: d9 fe fsin
14: d9 ff fcos
16: dd 58 18 fstpl 0x18(%eax)
19: 89 50 20 mov %edx,0x20(%eax)
1c: 89 48 24 mov %ecx,0x24(%eax)
1f: c9 leave
20: c2 08 00 ret $0x8
23: 90 nop
Then take only the machine code:
objcopy -Obinary -j .text sineswap.o sineswap.bin
Then convert the binary file to hexadecimal values in text file:
bin2hex sineswap.bin sineswap.txt
then add MB3D stuff and save as sineswap.m3f :
[OPTIONS]
.Version = 2
.DEoption = -1
[CODE]
5589E58B450883E8388B50188B481CDD4020D9FED9FFDD5818895020894824C9C2080090
[END]
Description:
Test of compiling a formula with GCC.
Now the parameters:
Mandelbulb3Dv18{
b.....Y/...g2...w....26...U2xSE.FEG1.TLyGzcFHn2Ezkskg1RPYyvTB4OmJcqszipiyP.9Q4zj
................................3CcamACAtz1.......EO./..................y.2...wD
...Uz.....UR..../wU0/......q/...W/....E3.....2LNaiUt1joD/w.........m/dkpXm1.....
z.UaNadD12..0..........wz..................................u1....y1...sD...../..
.z1...kDmxchI3E6bxnNtGvRevNwy6EccKb8ZDlDyOAa4uMzGwvZyxtOCCPKzUDDlGyIvAqD7f84AINX
xvfDDzwW9qnMz8kgNCnrmapD......Ia2...g7........sD.6....sD..E.....................
.............oAnAt1...sD....z.Lv15.2iDQ.kuyk/.pv15.wjDQ.E0zk/.Hw15......Q....k1.
..................kz.wzzz1EM.c6.P....61...EK....Q/...c3...UD....5/...I1.....SF52
...U.ydelyjeYFnzTeOgzf8No.6.2c..zzzz............4............0........k.8.kXWF1.
.sM93P58iz9.MmnWK2zwz0........../EU0.wzzz1...........s/...................E.2c..
zzzz.............0...................2./8.kzzzD............8....................
/EU0.wzzz1....................................uBZ.U7EgU7tj/eVv1.oQm2oElCnueM.YXB
bYX7Ot6Ul/.8Gsm0Drb3jC4.a.l0aUWTUSH7.M029MmWy/uBZ.U7EgU7hv5crI0.a.l0aIoTUSH7.M02
9Mmfz/uBZ.U7EgU7...crIGJzzFoTuIdyzngi8qdxzZX.4rU................................
E....6....E.....I.........kQdtKNnRLMk/..........................................
...................6./..........................................................
................................................................................
.....................2..........0....YYPoJqNZ756ExqRZ75.........................
8............................./E........kz9.....................................
................................................................................
................................}
The picture

[/code]