llvm-6502/lib/Target/ARM64
James Molloy 737c2ac4fc [ARM64-BE] Implement the crazy bitcast handling for big endian vectors.
Because we've canonicalised on using LD1/ST1, every time we do a bitcast
between vector types we must do an equivalent lane reversal.

Consider a simple memory load followed by a bitconvert then a store.
  v0 = load v2i32
  v1 = BITCAST v2i32 v0 to v4i16
       store v4i16 v2

In big endian mode every memory access has an implicit byte swap. LDR and
STR do a 64-bit byte swap, whereas LD1/ST1 do a byte swap per lane - that
is, they treat the vector as a sequence of elements to be byte-swapped.
The two pairs of instructions are fundamentally incompatible. We've decided
to use LD1/ST1 only to simplify compiler implementation.

LD1/ST1 perform the equivalent of a sequence of LDR/STR + REV. This makes
the original code sequence:  v0 = load v2i32

  v1 = REV v2i32                  (implicit)
  v2 = BITCAST v2i32 v1 to v4i16
  v3 = REV v4i16 v2               (implicit)
       store v4i16 v3

But this is now broken - the value stored is different to the value loaded
due to lane reordering. To fix this, on every BITCAST we must perform two
other REVs:

  v0 = load v2i32
  v1 = REV v2i32                  (implicit)
  v2 = REV v2i32
  v3 = BITCAST v2i32 v2 to v4i16
  v4 = REV v4i16
  v5 = REV v4i16 v4               (implicit)
       store v4i16 v5

This means an extra two instructions, but actually in most cases the two REV
instructions can be combined into one. For example:
  (REV64_2s (REV64_4h X)) === (REV32_4h X)

There is also no 128-bit REV instruction. This must be synthesized with an
EXT instruction.

Most bitconverts require some sort of conversion. The only exceptions are:
  a) Identity conversions -  vNfX <-> vNiX
  b) Single-lane-to-scalar - v1fX <-> fX or v1iX <-> iX

Even though there are hundreds of changed lines, I have a fairly high confidence
that they are somewhat correct. The changes to add two REV instructions per
bitcast were pretty mechanical, and once I'd done that I threw the resulting
.td at a script I wrote which combined the two REVs together (and added
an EXT instruction, for f128) based on an instruction description I gave it.

This was much less prone to error than doing it all manually, plus my brain
would not just have melted but would have vapourised.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208194 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-07 11:28:53 +00:00
..
AsmParser AArch64/ARM64: make NEON vector list parsing a bit more robust 2014-05-06 12:50:51 +00:00
Disassembler AArch64/ARM64: implement diagnosis of unpredictable loads & stores 2014-05-06 14:15:14 +00:00
InstPrinter ARM64: refactor NEON post-indexed loads & stores (MC). 2014-05-02 14:54:21 +00:00
MCTargetDesc AArch64/ARM64: implement remaining TLS relocations (purely MC). 2014-04-30 16:13:26 +00:00
TargetInfo
Utils [ARM64] Conditionalize CPU specific system registers on subtarget features 2014-05-01 10:25:36 +00:00
ARM64.h
ARM64.td Fix typo. 2014-05-05 21:50:57 +00:00
ARM64AddressTypePromotion.cpp [C++11] Add 'override' keywords and remove 'virtual'. Additionally add 'final' and leave 'virtual' on some methods that are marked virtual without overriding anything and have no obvious overrides themselves. ARM64 edition 2014-04-29 07:58:25 +00:00
ARM64AdvSIMDScalarPass.cpp [C++11] Add 'override' keywords and remove 'virtual'. Additionally add 'final' and leave 'virtual' on some methods that are marked virtual without overriding anything and have no obvious overrides themselves. ARM64 edition 2014-04-29 07:58:25 +00:00
ARM64AsmPrinter.cpp AArch64/ARM64: support indexed loads/stores on vector types. 2014-05-02 14:54:15 +00:00
ARM64BranchRelaxation.cpp [C++11] Add 'override' keywords and remove 'virtual'. Additionally add 'final' and leave 'virtual' on some methods that are marked virtual without overriding anything and have no obvious overrides themselves. ARM64 edition 2014-04-29 07:58:25 +00:00
ARM64CallingConv.h
ARM64CallingConvention.td [ARM64] Handle fp128 for parameter passing on stack 2014-04-25 12:07:03 +00:00
ARM64CleanupLocalDynamicTLSPass.cpp [C++11] Add 'override' keywords and remove 'virtual'. Additionally add 'final' and leave 'virtual' on some methods that are marked virtual without overriding anything and have no obvious overrides themselves. ARM64 edition 2014-04-29 07:58:25 +00:00
ARM64CollectLOH.cpp [C++11] Add 'override' keywords and remove 'virtual'. Additionally add 'final' and leave 'virtual' on some methods that are marked virtual without overriding anything and have no obvious overrides themselves. ARM64 edition 2014-04-29 07:58:25 +00:00
ARM64ConditionalCompares.cpp AArch64/ARM64: expunge CPSR from the sources 2014-04-30 13:14:14 +00:00
ARM64DeadRegisterDefinitionsPass.cpp [C++11] Add 'override' keywords and remove 'virtual'. Additionally add 'final' and leave 'virtual' on some methods that are marked virtual without overriding anything and have no obvious overrides themselves. ARM64 edition 2014-04-29 07:58:25 +00:00
ARM64ExpandPseudoInsts.cpp [C++11] Add 'override' keywords and remove 'virtual'. Additionally add 'final' and leave 'virtual' on some methods that are marked virtual without overriding anything and have no obvious overrides themselves. ARM64 edition 2014-04-29 07:58:25 +00:00
ARM64FastISel.cpp [ARM64] Correctly select ANDWri in FastISel. 2014-05-03 17:27:06 +00:00
ARM64FrameLowering.cpp
ARM64FrameLowering.h [C++11] Add 'override' keywords and remove 'virtual'. Additionally add 'final' and leave 'virtual' on some methods that are marked virtual without overriding anything and have no obvious overrides themselves. ARM64 edition 2014-04-29 07:58:25 +00:00
ARM64InstrAtomics.td
ARM64InstrFormats.td AArch64/ARM64: add more specific diagnostic for invalid vector lanes 2014-05-06 12:50:44 +00:00
ARM64InstrInfo.cpp AArch64/ARM64: expunge CPSR from the sources 2014-04-30 13:14:14 +00:00
ARM64InstrInfo.h AArch64/ARM64: expunge CPSR from the sources 2014-04-30 13:14:14 +00:00
ARM64InstrInfo.td [ARM64-BE] Implement the crazy bitcast handling for big endian vectors. 2014-05-07 11:28:53 +00:00
ARM64ISelDAGToDAG.cpp AArch64/ARM64: support indexed loads/stores on vector types. 2014-05-02 14:54:15 +00:00
ARM64ISelLowering.cpp [ARM64-BE] Make big endian (scalar) argument passing work correctly. 2014-05-07 11:28:36 +00:00
ARM64ISelLowering.h Implememting named register intrinsics 2014-05-06 16:51:25 +00:00
ARM64LoadStoreOptimizer.cpp [C++11] Add 'override' keywords and remove 'virtual'. Additionally add 'final' and leave 'virtual' on some methods that are marked virtual without overriding anything and have no obvious overrides themselves. ARM64 edition 2014-04-29 07:58:25 +00:00
ARM64MachineFunctionInfo.h
ARM64MCInstLower.cpp
ARM64MCInstLower.h
ARM64PerfectShuffle.h
ARM64PromoteConstant.cpp [C++11] Add 'override' keywords and remove 'virtual'. Additionally add 'final' and leave 'virtual' on some methods that are marked virtual without overriding anything and have no obvious overrides themselves. ARM64 edition 2014-04-29 07:58:25 +00:00
ARM64RegisterInfo.cpp AArch64/ARM64: expunge CPSR from the sources 2014-04-30 13:14:14 +00:00
ARM64RegisterInfo.h [C++11] Add 'override' keywords and remove 'virtual'. Additionally add 'final' and leave 'virtual' on some methods that are marked virtual without overriding anything and have no obvious overrides themselves. ARM64 edition 2014-04-29 07:58:25 +00:00
ARM64RegisterInfo.td AArch64/ARM64: expunge CPSR from the sources 2014-04-30 13:14:14 +00:00
ARM64SchedA53.td
ARM64SchedCyclone.td
ARM64Schedule.td
ARM64SelectionDAGInfo.cpp
ARM64SelectionDAGInfo.h
ARM64StorePairSuppress.cpp
ARM64Subtarget.cpp [ARM64] Prefer generation of bzero on Darwin only 2014-05-01 13:11:59 +00:00
ARM64Subtarget.h [C++11] Add 'override' keywords and remove 'virtual'. Additionally add 'final' and leave 'virtual' on some methods that are marked virtual without overriding anything and have no obvious overrides themselves. ARM64 edition 2014-04-29 07:58:25 +00:00
ARM64TargetMachine.cpp [C++11] Add 'override' keywords and remove 'virtual'. Additionally add 'final' and leave 'virtual' on some methods that are marked virtual without overriding anything and have no obvious overrides themselves. ARM64 edition 2014-04-29 07:58:25 +00:00
ARM64TargetMachine.h
ARM64TargetObjectFile.cpp
ARM64TargetObjectFile.h
ARM64TargetTransformInfo.cpp
CMakeLists.txt
LLVMBuild.txt
Makefile