[ARM] Fix inline memcpy trip count sequence
authorDavid Green <david.green@arm.com>
Mon, 24 May 2021 10:01:58 +0000 (11:01 +0100)
committerDavid Green <david.green@arm.com>
Mon, 24 May 2021 10:01:58 +0000 (11:01 +0100)
commit6cc78b9245bcc0e7a52723e2c298d290284e779b
tree9786666c201b40216fb81105be959e06ebf8dc9e
parent587408c199e8125bb454a44b7a7b20e015f4d317
[ARM] Fix inline memcpy trip count sequence

The trip count for a memcpy/memset will be n/16 rounded up to the
nearest integer. So (n+15)>>4. The old code was including a BIC too, to
clear one of the bits, which does not seem correct. This remove the
extra BIC.

Note that ideally this would never actually be generated, as in the
creation of a tail predicated loop we will DCE that setup code, letting
the WLSTP perform the trip count calculation. So this doesn't usually
come up in testing (and apparently the ARMLowOverheadLoops pass does not
do any sort of validation on the tripcount). Only if the generation of
the WLTP fails will it use the incorrect BIC instructions.

Differential Revision: https://reviews.llvm.org/D102629
llvm/lib/Target/ARM/ARMISelLowering.cpp
llvm/test/CodeGen/Thumb2/mve-memtp-loop.ll
llvm/test/CodeGen/Thumb2/mve-phireg.ll
llvm/test/CodeGen/Thumb2/mve-tp-loop.mir