Commit Graph

8902 Commits

Author SHA1 Message Date
Saleem Abdulrasool 519a73111b RISCV: adjust relocation emission
Simplify and make the pair-wise relocation more precise.  If either of
the symbol references are textual, the relocation must be delayed.  If
the difference is across sections, delay it as well which partially
matches the behaviour of gas.  We unfortunately do not handle the case
where the difference references a symbol that is not yet defined.  In
such a case, we simply fail to resolve the difference, which should
hopefully not be too onerous (particularly since no other target
supports cross-section references and it is not clear if this was
intentional on the part of RISCV).

Differential Revision: https://reviews.llvm.org/D132262
Reviewed By: @MaskRay
2022-09-30 15:28:48 +00:00
Steven Wu 3716851a84 [MC] Properly disable debug-frame test on AppleSilicon Mac
Disable debug-frame tests on AppleSilicon Mac to improve some of the fix
in PR46647.

Reviewed By: aprantl

Differential Revision: https://reviews.llvm.org/D134896
2022-09-29 16:21:12 -07:00
Dmitry Preobrazhensky 485c539391 [AMDGPU][MC][GFX11] Disable non-null src0 for s_waitcnt_*cnt
Differential Revision: https://reviews.llvm.org/D134809
2022-09-29 19:56:03 +03:00
Muhammad Omair Javaid f1c74f80c8 [LLVM][MC] Disable cfi-version test for aarch64-pc-windows*
This patch disables MC/ELF/cfi-version.ll test as windows does not emit
.debug_frame needed by the test. This was previously disabled for arm64
but windows on arm uses aarch64-pc-windows* triple. Replacing arm64 with
aarch64 to accomodate windows aarch64 triple(s).

Reviewed By: DavidSpickett

Differential Revision: https://reviews.llvm.org/D134863
2022-09-29 14:38:00 +05:00
wanglei 036b170c24 [LoongArch] Produce a R_LARCH_32_PCREL relocation
LoongArchELFObjectWriter::getRelocType check IsPCRel for FK_Data_4
(which we produce a R_LARCH_32_PCREL relocation for if IsPCRel).

R_LARCH_32_PCREL is required for FDE relocation.

Differential Revision: https://reviews.llvm.org/D134715
2022-09-29 09:04:44 +08:00
James Y Knight 4f188ef89c [AVR] Fix useDeprecatedPositionallyEncodedOperands errors.
This is a follow-on to https://reviews.llvm.org/D134073.

It renames a few fields to have consistent names, as well as renaming
operands to match the field names.

The encoder behavior is unchanged by this cleanup, but a few
instructions were previously being disassembled incorrectly, and have
been corrected by this change. All of the affected instructions were
missing disassembly tests, which are now added.

Differential Revision: https://reviews.llvm.org/D134185
2022-09-25 17:55:09 -04:00
Craig Topper 52708be182 [RISCV] Remove support for the unratified Zbe, Zbf, and Zbm extensions.
These extensions do not appear to be on their way to ratification.
2022-09-22 13:04:41 -07:00
Saleem Abdulrasool 463da422f0 MC: make section classification a bit more thorough
This does *NOT* change the emitted section flags in any way.  This only
impacts the internal classification of sections.

Extend the section classification in LLVM for ELF targets.  This has one
important change: we now classify sections as text by default rather
than readonly.  This matches the behaviour for GAS better.

Ensure that any section that has a writable attribute set is not treated
as readonly.  We also special case any section named `.debug_` which is
reserved for DWARF as metadata.  In the case none of the attributes are
set (or because no attributes were provided), consult the section name
for classification.  We match the well known names and classify the
section accordingly.  Any remaining section is now classified as text.

This change allows us to classify sections in the MC layer more
precisely which is needed for subsequent changes for handling target
specific behaviour.

Re-apply the change that was reverted with additional changes to
classify section prefixes appropriately and differentiate the TLS
sections, addressing the FIXME and post-commit review comments by
@MaskRay.

Differential Revision: https://reviews.llvm.org/D133456
Reviewed By: @MaskRay
2022-09-22 16:26:50 +00:00
LiaoChunyu fcfa9c7fcd [RelocationResolver] Add R_RISCV_SET{16,32}
Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D134408
2022-09-22 14:05:03 +08:00
Craig Topper 182aa0cbe0 [RISCV] Remove support for the unratified Zbp extension.
This extension does not appear to be on its way to ratification.

Still need some follow up to simplify the RISCVISD nodes.
2022-09-21 21:22:42 -07:00
LiaoChunyu d22ea5be51 [RelocationResolver] Add R_RISCV_SET8
Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D134164
2022-09-22 11:49:33 +08:00
Jay Foad 5c7ee894f8 AMDGPU: Stop validating earlyclobber operands in assembler
This validation was introduced in D34003 for v_qsad/v_mqsad instructions
but it applies to all instructions with earlyclobber operands, which now
includes v_mad_i64/v_mad_u64.

In all these cases I do not think there is documentation saying that the
destination must not overlap the sources. Rather there are *some* cases
where the instruction may not function correctly if there is an overlap,
and we are using earlyclobber as a conservative way of preventing
codegen from generating those cases.

I think it is unhelpful for the assembler to enforce the earlyclobber
restriction because it prevents assembling cases where the programmer
knows that in fact the overlap is safe.

See also: https://github.com/llvm/llvm-project/issues/57610

Differential Revision: https://reviews.llvm.org/D134272
2022-09-21 21:46:59 +01:00
Craig Topper 70a64fe7b1 [RISCV] Remove support for the unratified Zbt extension.
This extension does not appear to be on its way to ratification.

Out of the unratified bitmanip extensions, this one had the
largest impact on the compiler.

Posting this patch to start a discussion about whether we should
remove these extensions. We'll talk more at the RISC-V sync meeting this
Thursday.

Reviewed By: asb, reames

Differential Revision: https://reviews.llvm.org/D133834
2022-09-20 20:26:48 -07:00
Philip Reames eda2af575f [RISCV][MC] Add support for experimental Zawrs extension
This implements experimental support for the Zawrs extension as specified here: https://github.com/riscv/riscv-zawrs/releases/download/V1.0-rc3/Zawrs.pdf. Despite the 1.0 version name, this has not been ratified and there was a major change to proposed specification between rc2 and rc3.  Once this is ratified, it'll move out of experimental status.

This change adds assembly support, but does not include C language or IR intrinsics. We can decide if we want them, and handle that in a separate patch.

Differential Revision: https://reviews.llvm.org/D133443
2022-09-20 10:15:11 -07:00
Joe Nash b982ba2a6e [AMDGPU][GFX11] Use VGPR_32_Lo128 for VOP1,2,C
Due to the encoding changes in GFX11, we had a hack in place that
    disables the use of VGPRs above 128. This patch removes the need for
    that hack.

    We introduce a new register class VGPR_32_Lo128 which is used for 16-bit
    operands of VOP1, VOP2, and VOPC instructions. This register class only has the
    low 128 VGPRs, but is otherwise identical to VGPR_32. Therefore, 16-bit VOP1,
    VOP2, and VOPC instructions are correctly limited to use the first 128
    VGPRs, while the other instructions can freely use all 256.

    We introduce new pseduo-instructions used on GFX11 which have the suffix
    t16 (True 16) to use the VGPR_32_Lo128 register class.

Reviewed By: foad, rampitec, #amdgpu

Differential Revision: https://reviews.llvm.org/D133723
2022-09-20 09:56:28 -04:00
Philip Reames ef253d9b47 [RISCV] Adding missing test from a4a29438f
This change was originally reviewed as part of what became a4a29438f, but apparently forgot to git-add it when applying the patch.  Oops.
2022-09-19 13:45:56 -07:00
Dmitry Preobrazhensky ef8feb6359 [AMDGPU][MC][NFC] Correct error message
Differential Revision: https://reviews.llvm.org/D134028
2022-09-16 18:22:08 +03:00
Jay Foad 3822a01e0b [AMDGPU] Add GFX11 ds_bvh_stack_rtn_b32 instruction
Differential Revision: https://reviews.llvm.org/D133928
2022-09-15 16:46:14 +01:00
Dmitry Preobrazhensky 405b19bb67 [AMDGPU][MC][GFX11] Add disassembler tests for v_readfirstlane_b32
Differential Revision: https://reviews.llvm.org/D133437
2022-09-15 18:18:33 +03:00
Dmitry Preobrazhensky b0eea8f440 [AMDGPU][MC][GFX11][NFC] Update disassembler tests for MIMG instructions
Differential Revision: https://reviews.llvm.org/D133411
2022-09-15 18:04:34 +03:00
Dmitry Preobrazhensky 0e868aff43 [AMDGPU][MC][GFX11] Add validation of constant bus limitations for VOPD
Differential Revision: https://reviews.llvm.org/D133881
2022-09-15 16:36:19 +03:00
Dmitry Preobrazhensky c89e60bf1f [AMDGPU][MC][GFX11] Add VOPD literals validation
Differential Revision: https://reviews.llvm.org/D133864
2022-09-15 16:29:53 +03:00
wanglei a65557d4b3 [LoongArch] Fixup value adjustment in applyFixup
A complete implementation of `applyFixup` for D132323.

Makes `LoongArchAsmBackend::shouldForceRelocation` to determine
if the relocation types must be forced.

This patch also adds range and alignment checks for `b*` instructions'
operands, at which point the offset to a label is known.

Differential Revision: https://reviews.llvm.org/D132818
2022-09-15 21:00:22 +08:00
Antonio Frighetto c63e05dc07 [AArch64InstPrinter] Introduce register markup tags emission
AArch64 assembly syntax emission now leverages markup tags for registers, if enabled.

Reviewed By: MaskRay, david-arm

Differential Revision: https://reviews.llvm.org/D129870
2022-09-13 20:52:02 -07:00
Fangrui Song ab1c259613 [RISCV] Assemble `call foo` to R_RISCV_CALL_PLT
R_RISCV_CALL/R_RISCV_CALL_PLT distinction isn't necessary. R_RISCV_CALL has been
deprecated as a resolution to
https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/98 .

ld.lld and mold treat the two relocation types the same. GNU ld has a custom
handling for undefined weak functions which is unnecessary: calling an
unresolved undefined weak function is UB and GNU ld can handle the case without
a relocation error (such a function call is usually guarded by a zero value
check and should be allowed).

This patch assembles `call foo` to use R_RISCV_CALL_PLT instead of the
deprecated R_RISCV_CALL.

Note: the code generator still differentiates `call foo` and (maybe preemptible)
`call foo@plt`, but the difference is purely aesthetic.

Note: D105429 does not support R_RISCV_CALL_PLT correctly. Changed the test to
force R_RISCV_CALL for now.

Reviewed By: kito-cheng

Differential Revision: https://reviews.llvm.org/D132530
2022-09-13 18:47:55 -07:00
Dmitry Preobrazhensky 6d63a531e2 [AMDGPU][MC][GFX11][NFC] Update disassembler tests for VOPD instructions
Differential Revision: https://reviews.llvm.org/D133414
2022-09-09 13:10:55 +03:00
Dmitry Preobrazhensky c07ea46f21 [AMDGPU][MC][GFX11][NFC] Update disassembler tests for VOP3P instructions
Differential Revision: https://reviews.llvm.org/D133412
2022-09-09 13:06:44 +03:00
Fangrui Song b090ef9e4f [test] Fix compress-debug-sections-zlib-unavailable.s 2022-09-08 09:32:13 -07:00
David Spickett e428baf001 [LLVM][ARM] Remove options for armv2, 2A, 3 and 3M
Fixes #57486

These pre v4 architectures are not specifically supported
by codegen. As demonstrated in the linked issue.

GCC has not supported 3M since GCC 9 and presumably
2 and 2A earlier than that. So we are aligned in that sense.

(see https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2abd6e34fcf3bd9f9ffafcaa47cdc3ed443f9add)

This removes the options and associated testing.

The Pre_v4 build attribute remains mainly because its absence
would be more confusing. It will not be used other than to
complete the list of build attributes as shown in the ABI.

https://github.com/ARM-software/abi-aa/blob/main/addenda32/addenda32.rst#3352the-target-related-attributes

Reviewed By: nickdesaulniers, peter.smith, rengolin

Differential Revision: https://reviews.llvm.org/D133109
2022-09-08 09:49:48 +00:00
Fangrui Song fbf5e87219 [MC] Support writing ELFCOMPRESS_ZSTD compressed debug info sections
and add --compress-debug-sections=zstd to llvm-mc for testing.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D130724
2022-09-08 01:00:06 -07:00
Nikita Popov 0444b40ed3 Revert "[Support] Add llvm::compression::{getReasonIfUnsupported,compress,decompress}"
This reverts commit 19dc3cff0f.
This reverts commit 5b19a1f8e8.
This reverts commit 9397648ac8.
This reverts commit 10842b4475.

Breaks the GCC build, as reported here:
https://reviews.llvm.org/D130506#3776415
2022-09-08 09:33:12 +02:00
Fangrui Song 9397648ac8 [MC] Support writing ELFCOMPRESS_ZSTD compressed debug info sections
and add --compress-debug-sections=zstd to llvm-mc for testing.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D130724
2022-09-08 00:03:40 -07:00
Philip Reames a4a29438f4 [RISCV][MC] Add minimal support for Ztso extension
This is a minimalist implementation which simply adds the extension (in the experimental namespace since its not ratified), and wires up the setting of the required ELF header flag. Future changes will include codegen changes to exploit the stronger memory model.

This is intended to implement v0.1 of the proposed specification which can be found in Chapter 25 of https://github.com/riscv/riscv-isa-manual/releases/download/draft-20220723-10eea63/riscv-spec.pdf.

Differential Revision: https://reviews.llvm.org/D133239
2022-09-07 09:30:57 -07:00
Dmitry Preobrazhensky efa65ef281 [AMDGPU][MC][GFX11][NFC] Update disassembler tests for VOP3 instructions
Differential Revision: https://reviews.llvm.org/D133350
2022-09-07 13:55:27 +03:00
Dmitry Preobrazhensky a95b45d380 [AMDGPU][MC][GFX11][NFC] Update disassembler tests for VOP3.DPP8 instructions
Differential Revision: https://reviews.llvm.org/D133353
2022-09-07 13:51:31 +03:00
Dmitry Preobrazhensky c777c8f022 [AMDGPU][MC][GFX11][NFC] Update disassembler tests for VOP3.DPP16 instructions
Differential Revision: https://reviews.llvm.org/D133356
2022-09-07 13:47:55 +03:00
Dmitry Preobrazhensky 973fec78e9 [AMDGPU][MC][GFX11][NFC] Update assembler tests for VOPD instructions
Differential Revision: https://reviews.llvm.org/D133205
2022-09-07 13:42:59 +03:00
Dmitry Preobrazhensky 00165c3bbb [AMDGPU][MC][GFX11][NFC] Update assembler tests for MIMG instructions
Differential Revision: https://reviews.llvm.org/D133322
2022-09-06 13:39:14 +03:00
Eli Friedman 63335afb4e [ARM64EC 2/?] Add target triple, and allow targeting it.
Part of patchset to add initial support for ARM64EC.

Per discussion on review, using the triple arm64ec-pc-windows-msvc. The
parsing works the same way as Apple's alternate Arm ABI "arm64e".

Differential Revision: https://reviews.llvm.org/D125412
2022-09-05 12:27:10 -07:00
wanglei bf47954703 [LoongArch] Add more fixups and relocations
This patch makes the assembler support all modifiers defined in gnu-as.
Also changes some diagnostic information.

Differential Revision: https://reviews.llvm.org/D132633
2022-09-05 14:55:18 +08:00
wanglei 14e8741f32 [LoongArch][test] Replace bashism `|&` to `2>&1 |` (NFC)
The bash syntax `|&` is unsupported on other shells.

Differential Revision: https://reviews.llvm.org/D133187
2022-09-02 18:10:54 +08:00
Fangrui Song 1b726f0a4c [AArch64InstPrinter] Add some `<reg:...>` for llvm-mc --mdis output 2022-09-01 21:34:56 -07:00
Antonio Frighetto f0c50447f6 [X86InstPrinter] Introduce markup tags emission
x86 assembly syntax emission now leverages markup tags, if enabled.

Differential Revision: https://reviews.llvm.org/D129869
2022-09-01 21:04:35 -07:00
Antonio Frighetto 4e99079774 [AArch64InstPrinter] Introduce immediate markup tags emission
AArch64 assembly syntax emission now leverages markup tags for immediates, if enabled.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D129871
2022-09-01 20:58:42 -07:00
Antonio Frighetto cbb2141f7f [MipsInstPrinter] Introduce markup tags emission
MIPS assembly syntax emission now leverages markup tags, if enabled.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D129867
2022-09-01 20:52:09 -07:00
Sam Clegg 92920c4fe3 [MC][WebAssembly] Allow accurate errors in doBeforeLabelEmit
Although we only currently have one error produced in this function I am
working on changes right now that add some more.  This change makes the
error location more accurate.

Differential Revision: https://reviews.llvm.org/D133016
2022-09-01 01:26:33 -07:00
Sam Clegg c5c4ba37b1 [WebAssembly][MC] Avoid the need for .size directives for functions
Warn if `.size` is specified for a function symbol.  The size of a
function symbol is determined solely by its content.

I noticed this simplification was possible while debugging #57427, but
this change doesn't fix that specific issue.

Differential Revision: https://reviews.llvm.org/D132929
2022-08-31 14:28:56 -07:00
Dmitry Preobrazhensky f4319bcb0e [AMDGPU][MC][GFX11][NFC] Update asm tests for VOP3P instructions
Differential Revision: https://reviews.llvm.org/D132876
2022-08-30 17:04:09 +03:00
Dmitry Preobrazhensky 8bd92c83bc [AMDGPU][MC][GFX11][NFC] Add tests for opcode promotions and forced suffices
Differential Revision: https://reviews.llvm.org/D132869
2022-08-30 16:59:29 +03:00
Dmitry Preobrazhensky 5c58e533e7 [AMDGPU][MC][GFX11][NFC] Add missing asm tests for VOPC and VOPC.DPP instructions
Differential Revision: https://reviews.llvm.org/D132690
2022-08-30 16:54:58 +03:00