Skip to content
  • Projects
  • Groups
  • Snippets
  • Help

Martin / daiteq-demo

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Settings
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Switch branch/tag
  • daiteq-demo
  • simple
  • tests
  • float
  • float_sret.c
  • Martin's avatar
    daiteq LLVM demos, Release 4 · 3428f119
    Martin committed Oct 11, 2021
    3428f119 Browse File
float_sret.c 357 Bytes
BlameHistoryPermalink
Edit
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
////C: '-msoft-float'

/* test function which returns structure */

typedef struct ts {
  int      i;
  unsigned u;
  float    f;
} ts_t;

ts_t func(ts_t x)
{
  volatile ts_t tmp;
  tmp.i = (int)x.u;
  tmp.u = (unsigned)x.i;
  tmp.f = -x.f;
  return tmp;
}

int main(void)
{
  volatile ts_t A = {.i=1234,.u=4321,.f=1.2345F};

  A = func(A);

  return 0;
}