Open llvmbot opened 5 years ago
changed the description
AVR has gained great optimization on 8/16/32-bit shifts.
@llvm/issue-subscribers-backend-msp430
This could change in IR, but a codegen fix would probably be a better solution: https://godbolt.org/z/h41svc8dn
I am sure AVR has gained great improvement, against your original test C code: https://godbolt.org/z/b4cPvj1Eo
Extended Description
A number of comparisons involving bit tests are converted into shifts by InstCombine and DAGCombine. However, shifts are expensive for most 8 and 16 bit targets with comparatively cheaper selects.
It is desirable that selects are emitted instead of shifts for these targets. The following cases were identified in TargetLowering and DAGCombine and were fixed by:
https://reviews.llvm.org/D69116 https://reviews.llvm.org/D69120 https://reviews.llvm.org/D69326 https://reviews.llvm.org/D70042
Cases in InstCombine remain to be fixed. In llvm-dev it has been suggested that these cases should be fixed by reversing the current canonicalisation. I am showing them in this and following reports:
REPORTED CASE:
Source code:
IR code:
MSP430 Target code:
AVR Target code:
EXPECTED RESULT:
Source code:
Expected IR code:
Expected MSP430 Target code:
Expected AVR Target code: