[PATCH v3, middle end]: Fix PR 37908, thinko with atomic NAND operation
Uros Bizjak
ubizjak@gmail.com
Wed Nov 5 13:18:00 GMT 2008
Hello!
As discussed with Jakub on IRC, attached iteration of the patch adds
following message when atomic NAND builtins are used:
note: '__sync_fetch_and_nand_X' changed semantics in GCC 4.4
The patch also decorates all occurences of atomic NAND builtin through
the testsuite with appropriate dg-message.
2008-11-05 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).
* builtins.c (expand_builtin_sync_operation): Warn for changed
semantics in NAND builtins.
* doc/extend.texi (Atomic Builtins) [__sync_fetch_and_nand]: Correct
__sync_fetch_and_nand builtin operation in the example. Add note
about changed semantics in GCC 4.4.
[__sync_nand_and_fetch]: Correct __sync_nand_and_fetch builtin
operation in the example. Add note about changed semantics in GCC 4.4.
testsuite/ChangeLog:
2008-11-05 Uros Bizjak <ubizjak@gmail.com>
PR middle-end/37908
* gcc.dg/pr37908.c: New test.
* gcc.dg/ia64-sync-1.c: Correct __sync_fetch_and_nand and
__sync_nand_and_fetch results. Add dg-message to nand builtins.
(init_si, init_di): Change init value for __sync_fetch_and_nand to -1.
(test_si, test_di): Change expected result of
__sync_nand_and_fetch to ~7.
* gcc.dg/ia64-sync-2.c: Correct __sync_fetch_and_nand and
__sync_nand_and_fetch results. Add dg-message to nand builtins.
(init_noret_si, init_noret_di): Change init value for
__sync_fetch_and_nand to -1.
(init_noret_si, init_noret_di): Change expected result of
__sync_nand_and_fetch to ~7.
* gcc.dg/sync-2.c: Correct __sync_fetch_and_nand and
__sync_nand_and_fetch results. Add dg-message to nand builtins.
(init_qi, init_qi): Change init value for __sync_fetch_and_nand to -1.
(init_hi, init_hi): Change expected result of
__sync_nand_and_fetch to ~7.
* gcc.dg/sync-3.c: Copy from sync-2.c instead of including
the c source file.
* gcc.c-torture/compile/sync-1.c: Add dg-message to nand builtins.
* gcc.c-torture/compile/sync-2.c: Ditto.
* gcc.c-torture/compile/sync-3.c: Ditto.
Patch was bootstrapped and regression tested on i686-pc-linux-gnu. OK
for mainline?
Uros.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: p.diff.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20081105/77c91fe2/attachment.txt>
More information about the Gcc-patches
mailing list