aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Tooling/CompilationDatabaseTest.cpp
diff options
context:
space:
mode:
authorCullen Rhodes <cullen.rhodes@arm.com>2022-11-15 10:34:23 +0000
committerCullen Rhodes <cullen.rhodes@arm.com>2022-11-15 10:34:23 +0000
commitce3e7eb96888f55347a1e1714c5ae65e7a472a70 (patch)
tree32e9d2378a4cdd204d7d75dcc85416fbe7320b4f /clang/unittests/Tooling/CompilationDatabaseTest.cpp
parent3ddd5a848f0da3fd54bd6f4d42441020c5d60735 (diff)
downloadllvm-ce3e7eb96888f55347a1e1714c5ae65e7a472a70.zip
llvm-ce3e7eb96888f55347a1e1714c5ae65e7a472a70.tar.gz
llvm-ce3e7eb96888f55347a1e1714c5ae65e7a472a70.tar.bz2
[AArch64][SVE] Fix bad PTEST(PG, OP(PG, ...)) optimization
AArch64InstrInfo::optimizePTestInstr attempts to remove a PTEST of a predicate generating operation that identically sets flags (implictly). When the PTEST and the predicate-generating operation use the same mask the PTEST is currently removed. This is incorrect since it doesn't consider element size. PTEST operates on 8-bit predicates, but for instructions like compare that also support 16/32/64-bit predicates, the implicit PTEST performed by the instruction will consider fewer lanes for these element sizes and could set different first or last active flags. For example, consider the following instruction sequence ptrue p0.b ; P0=1111-1111-1111-1111 index z0.s, #0, #1 ; Z0=<0,1,2,3> index z1.s, #1, #1 ; Z1=<1,2,3,4> cmphi p1.s, p0/z, z1.s, z0.s ; P1=0001-0001-0001-0001 ; ^ last active ptest p0, p1.b ; P1=0001-0001-0001-0001 ; ^ last active where the compare generates a canonical all active 32-bit predicate (equivalent to 'ptrue p1.s, all'). The implicit PTEST sets the last active flag, whereas the PTEST instruction with the same mask doesn't. This patch restricts the optimization to instructions operating on 8-bit predicates. One caveat is the optimization is safe regardless of element size for any active, this will be addressed in a later patch. Reviewed By: bsmith Differential Revision: https://reviews.llvm.org/D137716
Diffstat (limited to 'clang/unittests/Tooling/CompilationDatabaseTest.cpp')
0 files changed, 0 insertions, 0 deletions