OSDN Git Service

[ARM] Make fullfp16 instructions not conditionalisable.
authorSimon Tatham <simon.tatham@arm.com>
Mon, 25 Feb 2019 10:39:53 +0000 (10:39 +0000)
committerSimon Tatham <simon.tatham@arm.com>
Mon, 25 Feb 2019 10:39:53 +0000 (10:39 +0000)
commit0f4e225b8129fa39aabbdfd2c401e7861c175b9a
tree1c598fa68ff338ba43fc9a5306a3c3794d11df85
parent5e1169bafb3bc06cf5ee076fcb38770f1e43fe21
[ARM] Make fullfp16 instructions not conditionalisable.

More or less all the instructions defined in the v8.2a full-fp16
extension are defined as UNPREDICTABLE if you put them in an IT block
(Thumb) or use with any condition other than AL (ARM). LLVM didn't
know that, and was happy to conditionalise them.

In order to force these instructions to count as not predicable, I had
to make a small Tablegen change. The code generation back end mostly
decides if an instruction was predicable by looking for something it
can identify as a predicate operand; there's an isPredicable bit flag
that overrides that check in the positive direction, but nothing that
overrides it in the negative direction.

(I considered the alternative approach of actually removing the
predicate operand from those instructions, but thought that it would
be more painful overall for instructions differing only in data type
to have different shapes of operand list. This way, the only code that
has to notice the difference is the if-converter.)

So I've added an isUnpredicable bit alongside isPredicable, and set
that bit on the right subset of FP16 instructions, and also on the
VSEL, VMAXNM/VMINNM and VRINT[ANPM] families which should be
unpredicable for all data types.

I've included a couple of representative regression tests, both of
which previously caused an fp16 instruction to be conditionalised in
ARM state and (with -arm-no-restrict-it) to be put in an IT block in
Thumb.

Reviewers: SjoerdMeijer, t.p.northover, efriedma

Reviewed By: efriedma

Subscribers: jdoerfert, javed.absar, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D57823

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354768 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Target/Target.td
lib/Target/ARM/ARMInstrFormats.td
lib/Target/ARM/ARMInstrVFP.td
lib/Target/ARM/AsmParser/ARMAsmParser.cpp
lib/Target/ARM/Disassembler/ARMDisassembler.cpp
test/CodeGen/ARM/fp16-no-condition.ll [new file with mode: 0644]
test/MC/ARM/fullfp16-nopred.s [new file with mode: 0644]
test/MC/Disassembler/ARM/fullfp16-arm-nopred.txt [new file with mode: 0644]
test/MC/Disassembler/ARM/fullfp16-thumb-nopred.txt [new file with mode: 0644]
utils/TableGen/CodeGenInstruction.cpp