0003-gcc-xtensa-fix-NAND-code-in-xtensa_expand_atomic.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. From 6765eecde2ed8d4be0fc217408b9e9b92a840aff Mon Sep 17 00:00:00 2001
  2. From: Max Filippov <jcmvbkbc@gmail.com>
  3. Date: Tue, 4 Sep 2018 00:39:32 -0700
  4. Subject: [PATCH] gcc: xtensa: fix NAND code in xtensa_expand_atomic
  5. NAND is ~(a1 & a2), but xtensa_expand_atomic does ~a1 & a2.
  6. That fixes libatomic tests atomic-op-{1,2}.
  7. gcc/
  8. 2018-09-04 Max Filippov <jcmvbkbc@gmail.com>
  9. * config/xtensa/xtensa.c (xtensa_expand_atomic): Reorder AND and
  10. XOR operations in NAND case.
  11. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
  12. Backported from: r264087
  13. ---
  14. gcc/config/xtensa/xtensa.c | 4 ++--
  15. 1 file changed, 2 insertions(+), 2 deletions(-)
  16. diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
  17. index 7cfe64d42895..080bb4ad765d 100644
  18. --- a/gcc/config/xtensa/xtensa.c
  19. +++ b/gcc/config/xtensa/xtensa.c
  20. @@ -1614,9 +1614,9 @@ xtensa_expand_atomic (enum rtx_code code, rtx target, rtx mem, rtx val,
  21. break;
  22. case MULT: /* NAND */
  23. - tmp = expand_simple_binop (SImode, XOR, old, ac.modemask,
  24. + tmp = expand_simple_binop (SImode, AND, old, val,
  25. NULL_RTX, 1, OPTAB_DIRECT);
  26. - tmp = expand_simple_binop (SImode, AND, tmp, val,
  27. + tmp = expand_simple_binop (SImode, XOR, tmp, ac.modemask,
  28. new_rtx, 1, OPTAB_DIRECT);
  29. break;
  30. --
  31. 2.11.0