Author Topic: Intel SPMD Program Compiler  (Read 1148 times)

AW

  • Member
  • *****
  • Posts: 2442
  • Let's Make ASM Great Again!
Re: Intel SPMD Program Compiler
« Reply #30 on: October 19, 2019, 12:01:36 AM »
This produces 1536 bytes:
cl -GS- -O1 -Zl mandelbrottest.c -mandelbrottest.exe -link /entry:"main" -fixed

Code: [Select]
#include <complex.h>
#include <stdio.h>
#pragma comment(lib, "ucrt.lib")
#pragma comment(linker,"/merge:.data=.text")

float _fltused = 0.0;
int main() {
for (int row = 0, max_row = 22, max_iteration = 20; row < max_row; ++row) {
for (int column = 0, iteration=0, max_column = 78; column < max_column; ++column, iteration = 0) {
for (_Fcomplex z = { 0,0 }, x = { 0,0 }, c = { (float)column * 2 / max_column - 1.5f , (float)row * 2 / max_row - 1.0f }; (cabsf(z) < 2) && (++iteration < max_iteration); x._Val[0] = z._Val[0] * z._Val[0] - z._Val[1] * z._Val[1] + c._Val[0], x._Val[1] = z._Val[0] * z._Val[1] + z._Val[1] * z._Val[0] + c._Val[1], z._Val[0]=x._Val[0], z._Val[1] = x._Val[1]);
printf("%c", iteration == max_iteration ? '#' : '.');
}
printf("\n");
}
}