-
Enhancement
-
Resolution: Implemented
-
Medium
-
Code Generation Tools
-
CODEGEN-7433
-
-
-
default
-
Nothing easy. Either compile without optimisation by using -Ooff, or rearrange the code so the problem does not occur.
When a program has two or more adjacent, or nearly-adjacent, operations that look like
dst0 &= ~src; dst1 &= ~src;
and optimisation is used, the compiler may not produce BIC instructions for them, instead using a two-instruction sequence like XOR-AND or EOR-AND. The code still behaves correctly, but it's a little slower and a little larger.
The problem is that the optimiser represents ~X internally as (X^~0), and if it moves sub-expressions around, later stages may not recognise the operation pattern that is best implemented by BIC.
The problem is more likely to occur with char variables than with int, but there isn't much way to control it other than restructuring the code. The performance effect is small; if it's happening in a critical path, it may be worth doing the work, but otherwise probably not.