980619-1.c 716 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (C) 2007
  3. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. /*
  8. * This file is originally a part of the GCC testsuite.
  9. */
  10. #include <common.h>
  11. #include <post.h>
  12. GNU_FPOST_ATTR
  13. #if CONFIG_POST & CONFIG_SYS_POST_FPU
  14. int fpu_post_test_math4 (void)
  15. {
  16. volatile float reale = 1.0f;
  17. volatile float oneplus;
  18. int i;
  19. if (sizeof (float) != 4)
  20. return 0;
  21. for (i = 0; ; i++)
  22. {
  23. oneplus = 1.0f + reale;
  24. if (oneplus == 1.0f)
  25. break;
  26. reale = reale / 2.0f;
  27. }
  28. /* Assumes ieee754 accurate arithmetic above. */
  29. if (i != 24) {
  30. post_log ("Error in FPU math4 test\n");
  31. return -1;
  32. }
  33. return 0;
  34. }
  35. #endif /* CONFIG_POST & CONFIG_SYS_POST_FPU */