20001122-1.c 602 B

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