980619-1.c 713 B

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