AArch64: Unify relocation restrictions between MOVK/MOVN/MOVZ.
authorPeter Collingbourne <peter@pcc.me.uk>
Thu, 18 Jul 2019 16:51:53 +0000 (16:51 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Thu, 18 Jul 2019 16:51:53 +0000 (16:51 +0000)
commit76427f849fc94ca36e11b0a9d648fa0bba1e22b9
tree2fee8634fdefdbfea0ef681a404ff57a7af90495
parentcb2d8e912512305fb5c45cf0f35f654f713dfa7c
AArch64: Unify relocation restrictions between MOVK/MOVN/MOVZ.

There doesn't seem to be a practical reason for these instructions to have
different restrictions on the types of relocations that they may be used
with, notwithstanding the language in the ELF AArch64 spec that implies that
specific relocations are meant to be used with specific instructions.

For example, we currently forbid the first instruction in the following
sequence, despite it currently being used by clang to generate a global
reference under -mcmodel=large:

movz x0, #:abs_g0_nc:foo
movk x0, #:abs_g1_nc:foo
movk x0, #:abs_g2_nc:foo
movk x0, #:abs_g3:foo

Therefore, allow MOVK/MOVN/MOVZ to accept the union of the set of relocations
that they currently accept individually.

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

llvm-svn: 366461
llvm/lib/Target/AArch64/AArch64InstrFormats.td
llvm/lib/Target/AArch64/AArch64InstrInfo.td
llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
llvm/test/MC/AArch64/basic-a64-diagnostics.s