20001122-1.c 599 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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_math1 (void)
  14. {
  15. volatile double a;
  16. double c, d;
  17. volatile double b;
  18. d = 1.0;
  19. do
  20. {
  21. c = d;
  22. d = c * 0.5;
  23. b = 1 + d;
  24. } while (b != 1.0);
  25. a = 1.0 + c;
  26. if (a == 1.0) {
  27. post_log ("Error in FPU math1 test\n");
  28. return -1;
  29. }
  30. return 0;
  31. }
  32. #endif /* CONFIG_POST & CONFIG_SYS_POST_FPU */