diff options
author | Mikhail Maltsev <mikhail.maltsev@arm.com> | 2018-04-04 08:54:19 +0000 |
---|---|---|
committer | Mikhail Maltsev <mikhail.maltsev@arm.com> | 2018-04-04 08:54:19 +0000 |
commit | 68f35bcc85a1662eb57deca23a379b9de129dc0f (patch) | |
tree | c91149654de012028ee0b23c78b18fbbed473145 /llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp | |
parent | 7949b3b1dcbdbd815dd28122871761f742b08278 (diff) | |
download | bcm5719-llvm-68f35bcc85a1662eb57deca23a379b9de129dc0f.tar.gz bcm5719-llvm-68f35bcc85a1662eb57deca23a379b9de129dc0f.zip |
[ARM] Do not convert some vmov instructions
Summary:
Patch https://reviews.llvm.org/D44467 implements conversion of invalid
vmov instructions into valid ones. It turned out that some valid
instructions also get converted, for example
vmov.i64 d2, #0xff00ff00ff00ff00 ->
vmov.i16 d2, #0xff00
Such behavior is incorrect because according to the ARM ARM section
F2.7.7 Modified immediate constants in T32 and A32 Advanced SIMD
instructions, "On assembly, the data type must be matched in the table
if possible."
This patch fixes the isNEONmovReplicate check so that the above
instruction is not modified any more.
Reviewers: rengolin, olista01
Reviewed By: rengolin
Subscribers: javed.absar, kristof.beyls, rogfer01, llvm-commits
Differential Revision: https://reviews.llvm.org/D44678
llvm-svn: 329158
Diffstat (limited to 'llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index 9d9d21c7711..532fd7e7eda 100644 --- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -1868,8 +1868,7 @@ public: ((Value & 0xffffffffff00ffff) == 0xffff); } - bool isNEONReplicate(unsigned Width, unsigned NumElems, bool Inv, - bool AllowMinusOne) const { + bool isNEONReplicate(unsigned Width, unsigned NumElems, bool Inv) const { assert((Width == 8 || Width == 16 || Width == 32) && "Invalid element width"); assert(NumElems * Width <= 64 && "Invalid result width"); @@ -1888,8 +1887,6 @@ public: uint64_t Mask = (1ull << Width) - 1; uint64_t Elem = Value & Mask; - if (!AllowMinusOne && Elem == Mask) - return false; if (Width == 16 && (Elem & 0x00ff) != 0 && (Elem & 0xff00) != 0) return false; if (Width == 32 && !isValidNEONi32vmovImm(Elem)) @@ -1904,7 +1901,7 @@ public: } bool isNEONByteReplicate(unsigned NumBytes) const { - return isNEONReplicate(8, NumBytes, false, true); + return isNEONReplicate(8, NumBytes, false); } static void checkNeonReplicateArgs(unsigned FromW, unsigned ToW) { @@ -1918,14 +1915,15 @@ public: template<unsigned FromW, unsigned ToW> bool isNEONmovReplicate() const { checkNeonReplicateArgs(FromW, ToW); - bool AllowMinusOne = ToW != 64; - return isNEONReplicate(FromW, ToW / FromW, false, AllowMinusOne); + if (ToW == 64 && isNEONi64splat()) + return false; + return isNEONReplicate(FromW, ToW / FromW, false); } template<unsigned FromW, unsigned ToW> bool isNEONinvReplicate() const { checkNeonReplicateArgs(FromW, ToW); - return isNEONReplicate(FromW, ToW / FromW, true, true); + return isNEONReplicate(FromW, ToW / FromW, true); } bool isNEONi32vmov() const { |