Skip to content

Commit

Permalink
[ARM] Fix vcvtb/t.f16 input liveness
Browse files Browse the repository at this point in the history
The `vcvtb.f16.f32 Sd, Sn` (and vcvtt.f16.f32) instruction convert a f32
into a f16, writing either the top or bottom halves of the register.
That means that half of the input register Sd is used in the output.
This wasn't being modelled in the instructions, leading later analyses
to believe that the registers were dead where they were not, generating
invalid scheduling

Fix that be specifying the input Sda register for the instructions too,
allowing them to be set for cases like vector inserts. Most of the
changes are plumbing through the constraint string, cstr.

Differential Revision: https://reviews.llvm.org/D126118
  • Loading branch information
davemgreen committed May 25, 2022
1 parent 730dc4e commit 18cb3b3
Show file tree
Hide file tree
Showing 8 changed files with 238 additions and 229 deletions.
26 changes: 13 additions & 13 deletions llvm/lib/Target/ARM/ARMInstrFormats.td
Expand Up @@ -1589,9 +1589,9 @@ class VFPXI<dag oops, dag iops, AddrMode am, int sz,
}

class VFPAI<dag oops, dag iops, Format f, InstrItinClass itin,
string opc, string asm, list<dag> pattern>
string opc, string asm, string cstr, list<dag> pattern>
: VFPI<oops, iops, AddrModeNone, 4, IndexModeNone, f, itin,
opc, asm, "", pattern> {
opc, asm, cstr, pattern> {
let PostEncoderMethod = "VFPThumb2PostEncoder";
}

Expand Down Expand Up @@ -1751,8 +1751,8 @@ class AXSI4<dag oops, dag iops, IndexMode im, InstrItinClass itin,
// Double precision, unary
class ADuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
string asm, list<dag> pattern>
: VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
string asm, string cstr, list<dag> pattern>
: VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, cstr, pattern> {
// Instruction operands.
bits<5> Dd;
bits<5> Dm;
Expand Down Expand Up @@ -1804,7 +1804,7 @@ class ADuInp<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
class ADbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
dag iops, InstrItinClass itin, string opc, string asm,
list<dag> pattern>
: VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
: VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, "", pattern> {
// Instruction operands.
bits<5> Dd;
bits<5> Dn;
Expand Down Expand Up @@ -1862,8 +1862,8 @@ class ADbInp<bits<5> opcod1, bits<2> opcod2, bit opcod3, dag oops, dag iops,
// Single precision, unary, predicated
class ASuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
string asm, list<dag> pattern>
: VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
string asm, string cstr, list<dag> pattern>
: VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, cstr, pattern> {
// Instruction operands.
bits<5> Sd;
bits<5> Sm;
Expand Down Expand Up @@ -1916,14 +1916,14 @@ class ASuIn<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
string asm, list<dag> pattern>
: ASuI<opcod1, opcod2, opcod3, opcod4, opcod5, oops, iops, itin, opc, asm,
pattern> {
"", pattern> {
list<Predicate> Predicates = [HasVFP2,DontUseNEONForFP];
}

// Single precision, binary
class ASbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
InstrItinClass itin, string opc, string asm, list<dag> pattern>
: VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
: VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, "", pattern> {
// Instruction operands.
bits<5> Sd;
bits<5> Sn;
Expand Down Expand Up @@ -2000,7 +2000,7 @@ class ASbIn<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops,
class AHuI<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
bit opcod5, dag oops, dag iops, InstrItinClass itin, string opc,
string asm, list<dag> pattern>
: VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, pattern> {
: VFPAI<oops, iops, VFPUnaryFrm, itin, opc, asm, "", pattern> {
list<Predicate> Predicates = [HasFullFP16];

// Instruction operands.
Expand Down Expand Up @@ -2056,7 +2056,7 @@ class AHuInp<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<2> opcod4,
// Half precision, binary
class AHbI<bits<5> opcod1, bits<2> opcod2, bit op6, bit op4, dag oops, dag iops,
InstrItinClass itin, string opc, string asm, list<dag> pattern>
: VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, pattern> {
: VFPAI<oops, iops, VFPBinaryFrm, itin, opc, asm, "", pattern> {
list<Predicate> Predicates = [HasFullFP16];

// Instruction operands.
Expand Down Expand Up @@ -2116,7 +2116,7 @@ class AHbInp<bits<5> opcod1, bits<2> opcod2, bit opcod3, dag oops, dag iops,
class AVConv1I<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
dag oops, dag iops, InstrItinClass itin, string opc, string asm,
list<dag> pattern>
: VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, pattern> {
: VFPAI<oops, iops, VFPConv1Frm, itin, opc, asm, "", pattern> {
let Inst{27-23} = opcod1;
let Inst{21-20} = opcod2;
let Inst{19-16} = opcod3;
Expand Down Expand Up @@ -2149,7 +2149,7 @@ class AVConv1In<bits<5> opcod1, bits<2> opcod2, bits<4> opcod3, bits<4> opcod4,
class AVConvXI<bits<8> opcod1, bits<4> opcod2, dag oops, dag iops, Format f,
InstrItinClass itin,
string opc, string asm, list<dag> pattern>
: VFPAI<oops, iops, f, itin, opc, asm, pattern> {
: VFPAI<oops, iops, f, itin, opc, asm, "", pattern> {
let Inst{27-20} = opcod1;
let Inst{11-8} = opcod2;
let Inst{4} = 1;
Expand Down

0 comments on commit 18cb3b3

Please sign in to comment.