This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, middle end]: Fix PR 37908, thinko with atomic NAND operation


Hello!

Currently, we are expanding atomic NAND operation as "target =
(~target & val)", whic is simply not NAND operation. Correct operation
would be "target = ~(target & val)".

Attached patch corrects this thinko.

2008-10-24  Uros Bizjak  <ubizjak@gmail.com>

	PR middle-end/37908
	* optabs.c (expand_sync_operation): Properly handle NAND case
	by calculating ~(t1 & val) instead of (~t1 & val).

testsuite/ChangeLog:

2008-10-24  Uros Bizjak  <ubizjak@gmail.com>

	PR middle-end/37908
	* gcc.dg/pr37908.c: New test.

_However_, this patch fails following tests:

FAIL: gcc.dg/ia64-sync-1.c execution test
FAIL: gcc.dg/ia64-sync-2.c execution test
FAIL: gcc.dg/sync-2.c execution test
FAIL: gcc.dg/sync-3.c execution test

In these tests, we check for target = (~target & val), where NAND (0,
7) becomes 7. Correct NAND operation would produce -1, calculated as
~(0 & 7).

Attached patch was bootstrapped and tested on x86-pc-linux-gnu. I
would like to ask for a second opinion, if failed tests are in fact
correct or not.

Uros.

Attachment: p.diff.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]