This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Comply with rules on ARMv8-A thumb mode partial deprecation of IT.
ClosedPublic

Authored by huihuiz on Jun 17 2019, 9:59 PM.

Details

Summary

When identifing instructions that can be folded into a MOVCC instruction,
checking for a predicate operand is not enough, also need to check for
thumb2 function, with restrict-IT, is the machine instruction eligible for
ARMv8 IT or not.

Notes in ARMv8-A Architecture Reference Manual, section "Partial deprecation of IT"

https://usermanual.wiki/Pdf/ARM20Architecture20Reference20ManualARMv8.1667877052.pdf

"ARMv8-A deprecates some uses of the T32 IT instruction. All uses of IT that apply to
instructions other than a single subsequent 16-bit instruction from a restricted set
are deprecated, as are explicit references to the PC within that single 16-bit
instruction. This permits the non-deprecated forms of IT and subsequent instructions
to be treated as a single 32-bit conditional instruction."

Diff Detail

Repository
rL LLVM

Event Timeline

huihuiz created this revision.Jun 17 2019, 9:59 PM

for example, test.ll below

define i1 @scalar_i64_lowestbit_eq(i64 %x, i64 %y) {
%t0 = shl i64 1, %y
%t1 = and i64 %t0, %x
%res = icmp eq i64 %t1, 0
ret i1 %res
}

run: llc test.ll -mtriple=thumbv8 -o - | llvm-mc -triple thumbv8 --show-encoding

will give you the warning of "deprecated instruction in IT block" for ARMv8 in thumb mode.

 it ge                      @ encoding: [0xa8,0xbf]
<stdin>:39:2: warning: deprecated instruction in IT block
 lslge.w r3, r12, lr
 ^
 lslge.w r3, r12, lr             @ encoding: [0x0c,0xfa,0x0e,0xf3]
ostannard accepted this revision.Jun 18 2019, 5:55 AM
ostannard added a subscriber: ostannard.

LGTM

This revision is now accepted and ready to land.Jun 18 2019, 5:55 AM
This revision was automatically updated to reflect the committed changes.