fab/isel: Move atomic optimizations to isel from fab [PR121762]
These atomic optimizations that are currently in fab are really an
instruction selection like optimizations so let's move them to gimple-isel.cc.
Note since this is the last manual optimization left in fab, I have simplified
the code to only fold internal and normal builtins. The next patch will remove all
of fab.
Bootstrapped and tested on x86_64-linux-gnu.
PR tree-optimization/121762
gcc/ChangeLog:
* gimple-isel.cc (gimple_nop_atomic_bit_test_and_p): New decl.
(gimple_nop_convert): Likewise.
(convert_atomic_bit_not): Moved from tree-ssa-ccp.cc.
(optimize_atomic_bit_test_and): Likewise.
(optimize_atomic_op_fetch_cmp_0): Likewise.
(gimple_isel_builtin_call): New function.
(CASE_ATOMIC): Moved from tree-ssa-ccp.cc.
(CASE_ATOMIC_CMP0): Likewise.
(CASE_ATOMIC_BIT_TEST_AND): Likewise.
(pass_gimple_isel::execute): For calls just call gimple_isel_builtin_call.
* tree-ssa-ccp.cc (convert_atomic_bit_not): Move to gimple-isel.cc.
(gimple_nop_atomic_bit_test_and_p): Likewise.
(gimple_nop_convert): Likewise.
(optimize_atomic_bit_test_and): Likewise.
(optimize_atomic_op_fetch_cmp_0): Likewise.
(pass_fold_builtins::execute): Just call fold_stmt for internal
or normal bultin calls.
(CASE_ATOMIC): Move to gimple-isel.cc.
(CASE_ATOMIC_CMP0): Likewise.
(CASE_ATOMIC_BIT_TEST_AND): Likewise.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>