[ARM GlobalISel] Fix selection of G_SELECT
authorDiana Picus <diana.picus@linaro.org>
Thu, 28 Mar 2019 09:09:27 +0000 (09:09 +0000)
committerDiana Picus <diana.picus@linaro.org>
Thu, 28 Mar 2019 09:09:27 +0000 (09:09 +0000)
commit4d512df30035c54a81b2e67d80debbc09b003afb
tree600a0c093400c88d93c2210528c7506dc235d74c
parentc2423fe6899aad89fe0ac2aa4b873cb79ec15bd0
[ARM GlobalISel] Fix selection of G_SELECT

G_SELECT uses a 1-bit scalar for the condition, and is currently
implemented with a plain CMPri against 0. This means that values such as
0x1110 are interpreted as true, when instead the higher bits should be
treated as undefined and therefore ignored. Replace the CMPri with a
TSTri against 0x1, which performs an implicit AND, yielding the expected
result.

llvm-svn: 357153
llvm/lib/Target/ARM/ARMInstructionSelector.cpp
llvm/test/CodeGen/ARM/GlobalISel/arm-instruction-select.mir
llvm/test/CodeGen/ARM/GlobalISel/arm-isel.ll
llvm/test/CodeGen/ARM/GlobalISel/thumb-select-select.mir