Commit Graph

9075 Commits

Author SHA1 Message Date
zhoujing 9b11eb8feb [NFC][fix] Fix test cases failure 2024-03-07 10:57:30 +08:00
zhoujing 63911b8554 [VENTUS][fix] fix operand order bugs in ternary operands instructions
Previous commit changed the order of operands in some three operands instructions, 09b6c28686
2023-08-15 13:53:13 +08:00
qinfan 09b6c28686 [VENTUS][fix]Fix Instruction errors and add test files
1.Fix errors in VALUrVV class(llvm/lib/Target/RISCV/VentusInstrInfoV.td) where two source operand positions were reversed,
this is differnt from the conventional RISCV instruction.
2.Fix errors in VALUrVF class, same as above.
3.The instructions associated with the above two errors are "vfnmadd.vv", "vfnmadd.vf", etc.
4.Add MC level FileCheck test files to test V instructions.
2023-08-11 17:27:47 +08:00
zhoujing 592d77cb76 [VENTUS][fix] Add vmslt(u)/vmsge(u) instructions' alias
Based on vspec-doc(https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc)
ans Ventus design documentation
2023-08-01 13:06:49 +08:00
zhoujing fabfe7b62c [VENTUS][RISCV][test] Update MC test case 2023-07-14 10:24:18 +08:00
zhoujing 3719c07dc0 [VENTUS][RISCV][fix] Modify JOIN instruction to use X0 rather than V0 2023-07-13 17:01:36 +08:00
zhoujing 77c0b15cff [VENTUS][RISCV][test&fix] Add more MC test and fix related bugs 2023-07-11 11:17:55 +08:00
zhoujing e7b96af8fa [VENTUS][RISCV][test] Add MC test for ventus customized instructions 2023-07-10 16:27:50 +08:00
Yeting Kuo 3a88121732 [RISCV] Support .variant_cc directive for the assembler.
The patch is split from D103435. The patch supported a new directive .variant_cc
that annotates function with STO_RISCV_VARIANT_CC. Symbols marked with
STO_RISCV_VARIANT_CC do not use standard calling conversion or use parameter not
passed in GPR/FPR.

Related: https://github.com/riscv/riscv-elf-psabi-doc/pull/190

Initial authored by: HsiangKai

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D138352
2022-12-05 12:13:43 +08:00
Nico Weber 2c313d9915 [loongarch] fix syntax error in script
At least on macOS with zsh, the test failed with

    line 1: syntax error near unexpected token `&'

previously.
2022-12-03 07:49:43 -05:00
Matt Arsenault a74c5707be Fix some test files with executable permissions 2022-12-02 17:12:03 -05:00
Paul Robinson 5336b1ed75 [lit][AIX] Convert llvm tests to use 'target={{.*}}-aix{{.*}}'
Part of the project to eliminate special handling for triples in lit
expressions.

Differential Revision: https://reviews.llvm.org/D137436
2022-12-02 09:42:34 -08:00
Fangrui Song b3ed72ed48 [MC][AsmParser] Remove "in directive" from diagnostics
This part is not useful (all the custom parsing deals with directives) and does
not appear in the majority of diagnostics.

While updating diagnostics, change "unexpected token" to more useful
diagnostics, e.g. "expected comma", "expected end of directive".
2022-12-01 22:04:27 +00:00
Maryam Moghadas c19f905fed [PowerPC] Implement xscmpeqqp, xscmpgeqp, xscmpgtqp instructions
This patch adds 3 Power10 VSX Scalar compare for quad precision
instructions including xscmpeqqp, xscmpgeqp, xscmpgtqp

Reviewed By: amyk

Differential Revision: https://reviews.llvm.org/D138592
2022-12-01 15:01:49 -06:00
Mitch Phillips 850defb861 Add assembler plumbing for sanitize_memtag
Extends the Asm reader/writer to support reading and writing the
'.memtag' directive (including allowing it on internal global
variables). Also add some extra tooling support, including objdump and
yaml2obj/obj2yaml.

Test that the sanitize_memtag IR attribute produces the expected asm
directive.

Uses the new Aarch64 MemtagABI specification
(https://github.com/ARM-software/abi-aa/blob/main/memtagabielf64/memtagabielf64.rst)
to identify symbols as tagged in object files. This is done using a
R_AARCH64_NONE relocation that identifies each tagged symbol, and these
relocations are tagged in a special SHT_AARCH64_MEMTAG_GLOBALS_STATIC
section. This signals to the linker that the global variable should be
tagged.

Reviewed By: fmayer, MaskRay, peter.smith

Differential Revision: https://reviews.llvm.org/D128958
2022-12-01 10:50:34 -08:00
Paul Robinson f4eb87f403 [NVPTX] Convert tests to check 'target=nvptx.*'
Part of the project to eliminate special handling for triples in lit
expressions.
2022-12-01 09:01:48 -08:00
WANG Xuerui 28b4838a33 [Object] Add some more LoongArch support
Add ELFObjectFileBase::getLoongArchFeatures, and return the proper ELF
relative reloc type for LoongArch.

Reviewed By: MaskRay, SixWeining

Differential Revision: https://reviews.llvm.org/D138016
2022-12-01 19:16:51 +08:00
Eli Friedman d98f74a470 [AArch64] Make sure we don't emit packed unwind for .seh_save_any_reg_p
Obvious oversight in implementation in D135417.

Differential Revision: https://reviews.llvm.org/D138955
2022-11-30 13:47:35 -08:00
Paul Robinson 57b1c0250d [Windows] Canonicalize on 'target=.*-windows'
Part of the project to eliminate special handling for triples in lit
expressions.
2022-11-30 12:07:27 -08:00
Tomas Matheson 7fea6f2e0e [AArch64] Assembly support for VMSA
Virtual Memory System Architecture (VMSA)

This is part of the 2022 A-Profile Architecture extensions and adds support for
the following:

 - Translation Hardening Extension (FEAT_THE)
 - 128-bit Page Table Descriptors (FEAT_D128)
 - 56-bit Virtual Address (FEAT_LVA3)
 - Support for 128-bit System Registers (FEAT_SYSREG128)
 - System Instructions that can take 128-bit inputs (FEAT_SYSINSTR128)
 - 128-bit Atomic Instructions (FEAT_LSE128)
 - Permission Indirection Extension (FEAT_S1PIE, FEAT_S2PIE)
 - Permission Overlay Extension (FEAT_S1POE, FEAT_S2POE)
 - Memory Attribute Index Enhancement (FEAT_AIE)

New instructions added:
 - FEAT_SYSREG128 adds MRRS and MSRR.
 - FEAT_SYSINSTR128 adds the SYSP instruction and TLBIP aliases.
 - FEAT_LSE128 adds LDCLRP, LDSET, and SWPP instructions.
 - FEAT_THE adds the set of RCW* instructions.

Specs for individual instructions can be found here:
https://developer.arm.com/documentation/ddi0602/2022-09/Base-Instructions/

Contributors:
  Keith Walker
  Lucas Prates
  Sam Elliott
  Son Tuan Vu
  Tomas Matheson

Differential Revision: https://reviews.llvm.org/D138920
2022-11-30 13:37:02 +00:00
Dmitry Preobrazhensky f2d589ea46 [AMDGPU][MC][GFX11] Disable non-VGPR src operands for VOP3_DPP variants of fmac instructions
Differential Revision: https://reviews.llvm.org/D138710
2022-11-30 14:48:00 +03:00
Paul Robinson df3f5f7149 [Windows] Convert tests to check 'target=<triple>'
Part of the project to eliminate special handling for triples in lit
expressions.
2022-11-29 10:33:21 -08:00
Jay Foad dca1a3f29e [AMDGPU] Add error line number checking
Differential Revision: https://reviews.llvm.org/D138916
2022-11-29 16:33:43 +00:00
Mateja Marjanovic 595a08847a [AMDGPU] Add support for new LLVM vector types
Add VReg, AReg and SReg on AMDGPU for bit widths: 288, 320, 352 and 384.

Differential Revision: https://reviews.llvm.org/D138205
2022-11-29 17:02:04 +01:00
Dmitry Preobrazhensky 9b8eb5fa8e [AMDGPU][MC][GFX11] Correct op_sel handling for permlane*16
Differential Revision: https://reviews.llvm.org/D137969
2022-11-29 18:45:22 +03:00
Dmitry Preobrazhensky 869fc7eabd [AMDGPU][MC][MI100+] Enable VOP3 variants of dot2c/dot4c/dot8c opcodes
Differential Revision: https://reviews.llvm.org/D138494
2022-11-29 17:38:18 +03:00
Jay Foad 7ab83a7046 [AMDGPU] Better more consistent error check lines
Checking for : before @LINE avoids the unlikely possibility that the
expected error line number happens to be a suffix of the actual one.
2022-11-29 12:55:36 +00:00
Simon Tatham e45cbf9923 [ARM,MVE] Update MVE_VMLA_qr for architecture change.
In revision B.q and before of the Armv8-M architecture reference
manual, the vector/scalar forms of the `vmla` and `vmlas` instructions
came in signed and unsigned integer forms, such as `vmla.s8 q0,q1,r2`
or `vmlas.u32 q3,q4,r5`.

Revision B.r has changed this. There are no longer signed and unsigned
versions of these instructions, since they were functionally identical
anyway. Now there is just `vmla.i8` (or `i16` or `i32`, and similarly
for `vmlas`). Bit 28 of the instruction encoding, which was previously
0 for signed or 1 for unsigned, is now expected to be 0 always.

This change updates LLVM to the new version of the architecture. The
obsoleted encodings for unsigned integers are now decoding errors, and
only the still-valid encoding is ever emitted. This shouldn't break
any existing assembly code, because the old signed and unsigned
versions of the mnemonic are still accepted by the assembler (which is
standard practice anyway for all signedness-agnostic MVE integer
instructions).

Reviewed By: dmgreen, lenary

Differential Revision: https://reviews.llvm.org/D138827
2022-11-29 08:47:00 +00:00
Sander de Smalen 7f01737687 [AArch64][AsmParser] SME: Allow h/v suffix to be upper-case. 2022-11-28 11:42:43 +00:00
Fangrui Song 270f63b84a MC: Convert tests to opaque pointers 2022-11-27 20:10:29 -08:00
Ayke van Laethem 3b2b83ce2f
[AVR] Add $ separator string (like avr-gcc)
avr-gcc uses the $ symbol as an assembly separator instead of the more
common %% syntax. We need it in LLVM too to be compatible.

Differential Revision: https://reviews.llvm.org/D138535
2022-11-27 15:28:17 +01:00
Tomas Matheson a6aaa969f7 [AArch64] Assembly support for FEAT_LRCPC3
This patch implements assembly support for the 2022 A-Profile Architecture
extension FEAT_LRCPC3. FEAT_LRCPC3 is AArch64 only and introduces new
variants of load/store instructions with release consistency ordering.

Specs for individual instructions can be found here:
https://developer.arm.com/documentation/ddi0602/2022-09/Base-Instructions/

This feature is optionally available from v8.2a and therefore not enabled by
default.

Contributors:
  Lucas Prates
  Sam Elliot
  Son Tuan Vu
  Tomas Matheson

Differential Revision: https://reviews.llvm.org/D138579
2022-11-25 18:59:07 +00:00
Dmitry Preobrazhensky a0a0dc6f8b [AMDGPU][MC] Refactor MC Code Emitter to avoid using magic values
Differential Revision: https://reviews.llvm.org/D138594
2022-11-25 18:02:00 +03:00
Archibald Elliott 605e22b7d4 [AArch64] Add Missing System Registers
The following system registers have been missing upstream:
- ID_DFR1_EL1
- AMCG1IDR_EL0 (present when FEAT_AMUv1p1 implemented - optional from v8.6-a)
- HAFGRTR_EL2 (present when FEAT_AMUv1 and FEAT_FGT are implemented)

With regards to HAFGRTR_EL2, this is only present when you have both
extensions. As FEAT_FGT is part of a later architecture, we group it
with those registers. In all honesty, this is a good example of the
kinds of place where just enabling all system registers all the time
would be easiest.

Differential Revision: https://reviews.llvm.org/D138553
2022-11-24 17:47:48 +00:00
Lucas Prates b0d4045dab [AArch64] Add support for v8.9-A/v9.4-A Debug and PMU extensions
This adds support for the 2022 Debug and PMU extensions that are part of
the v8.9-A and v9.4-A architecture versions. This includes:

* New archtecture extension for the v9.4-A Instrumentation Extension
  (FEAT_ITE), including 'trcit' instruction and system registers
* New system registers for:
  * 2022 Debug features (FEAT_Debugv8p9)
  * 2022 Performance Monitors Extension features (FEAT_PMUv3p9)
  * PMU Snapshot extension (FEAT_PMUv3_SS)
  * PMU Fixed-function instruction counter (FEAT_PMUv3_ICNTR)
  * System Performance Monitors Extension (FEAT_SPMU)
  * Synchornous-exception-based event profiling (FEAT_SEBEP)
  * Fine Grained Traps Extension (FEAT_FGT2)
  * SPE Data Source filtering (FEAT_SPE_FDS)

More information on the new extensions can be found on:
* https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/arm-a-profile-architecture-2022
* https://developer.arm.com/downloads/-/exploration-tools

Changes by Son Tuan Vu, Sam Elliott and me.

Reviewed By: tmatheson

Differential Revision: https://reviews.llvm.org/D138556
2022-11-24 16:15:11 +00:00
Ivan Kosarev fce7a7aa9f [AMDGPU][AsmParser] Refine parsing instruction operands.
Eliminates the need for working around optional and token operands being
mistakenly parsed as expressions.

Reviewed By: dp

Differential Revision: https://reviews.llvm.org/D138492
2022-11-24 10:50:26 +00:00
WuXinlong 0dbc52a0ab Add MC support of RISCV Zcd Extension
This patch add the instructions of Zcd extension.

Zcd is a subset of C Ext which include the double-precision floating-point instructions (c.fld, c.fldsp, c.fsd, c.fsdsp).

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D134177
2022-11-24 05:48:06 +08:00
WuXinlong 16bf359a3f Add MC support of RISCV Zcf Extension
This patch add the instructions of Zcf extension.

Zcf is a subset of C Ext which include the single-precision floating-point instructions.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D134176
2022-11-23 15:09:02 +08:00
Ties Stuij cb261e30fb [AArch64][clang] implement 2022 General Data-Processing instructions
This patch implements the 2022 Architecture General Data-Processing Instructions

They include:

Common Short Sequence Compression (CSSC) instructions
- scalar comparison instructions
  SMAX, SMIN, UMAX, UMIN (32/64 bits) with or without immediate
- ABS (absolute), CNT (count non-zero bits), CTZ (count trailing zeroes)
- command-line options for CSSC

Associated with these instructions in the documentation is the Range Prefetch
Memory (RPRFM) instruction, which signals to the memory system that data memory
accesses from a specified range of addresses are likely to occur in the near
future. The instruction lies in hint space, and is made unconditional.

Specs for the individual instructions can be found here:
https://developer.arm.com/documentation/ddi0602/2022-09/Base-Instructions/

contributors to this patch:
- Cullen Rhodes
- Son Tuan Vu
- Mark Murray
- Tomas Matheson
- Sam Elliott
- Ties Stuij

Reviewed By: lenary

Differential Revision: https://reviews.llvm.org/D138488
2022-11-22 14:23:12 +00:00
Piotr Sobczak de767db633 [AMDGPU] Add encoding tests for SALU_CYCLE_2/3
Add missing assembler/disassembler tests for INSTID_SALU_CYCLE_2
and INSTID_SALU_CYCLE_3 which are possible arguments in S_DELAY_ALU.

Differential Revision: https://reviews.llvm.org/D138482
2022-11-22 11:41:59 +01:00
WuXinlong 219417b2c6 [RISCV] Add CodeGen support and MC testcase of RISCV Zca Extension
This patch add the support of RISCV Zca ext

`Zca` is a subset of C extension instructions that are compatible with the Zc extension.

So this patch implements Zca code generation with reference to the C extension and sets the 2-byte alignment for the Zca extension, just like C extension does.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D130483
2022-11-22 17:22:26 +08:00
Thomas Lively ae96b5bd2d [WebAssembly] Update relaxed-simd instruction names
Including builtin and intrinsic names. These should be the final names for the
proposal.
https://github.com/WebAssembly/relaxed-simd/blob/main/proposals/relaxed-simd/Overview.md

Reviewed By: aheejin, maratyszcza

Differential Revision: https://reviews.llvm.org/D138249
2022-11-21 12:40:15 -08:00
Maryam Moghadas bd68070481 [PowerPC] Add new load/store with length instructions to Future CPU.
This patch adds 8 news load and store with length instructions including
lxvrl, lxvrll, stxvrl, stxvrll, lxvprl, lxvprll, stxvprl, stxvprll.

Reviewed By: stefanp, amyk, saghir

Differential Revision: https://reviews.llvm.org/D136992
2022-11-21 13:22:27 -06:00
Caroline Concatto c0414518f1 [AArch64][NFC] SME2 Add missing tests for usvdot and sumlall instructions 2022-11-21 17:36:53 +00:00
wanglei f873c50caa [LoongArch] AsmParser support for the li.[wd] pseudo instructions
The `li.[wd]` pseudo instructions are used to load an immediate value
into a GPR. These expand directly during asm parsing. As the result,
only real MC instructions are emitted to the MCStreamer. The actual
expansion to real instructions is similar to the expansion performed by
the GAS.

Note: The `li.w` always treats the imm operand as a 32-bit signed value.

Reviewed By: SixWeining

Differential Revision: https://reviews.llvm.org/D138086
2022-11-21 16:33:47 +08:00
wanglei a7ec7f6d77 [LoongArch] Support parsing la* pseudo instructions
This patch makes `IAS` compatible with `GAS`. It accepts `la*` pseudo
instructions, and expands `la{,.local,.global}` into different
instructions according to different features.

```
 Default:
     la = la.global = la.got
     la.local = la.pcrel
 With feature "+la-global-with-pcrel":
     la = la.global = la.pcrel
 With feature "+la-global-with-abs":
     la = la.global = la.abs
 With feature "+la-local-with-abs":
     la.local = la.abs
 With features "+la-global-with-pcrel,+la-global-with-abs"(disorder):
     la = la.global = la.pcrel
```
Note: To keep consistent with `GAS` behavior, the "la" can only have
      one register operand.

Reviewed By: SixWeining

Differential Revision: https://reviews.llvm.org/D138021
2022-11-21 15:33:30 +08:00
wanglei bfa3551dd3 [LoongArch] Implement assembler branches pseudo instructions
These instructions always output the canonical mnemonic. The GNU tools
emit the canonical mnemonic for the branch pseudo instructions as well
(e.g. "bgt" will be recognised by the assembler but never printed by
objdump).

Reviewed By: xen0n

Differential Revision: https://reviews.llvm.org/D138100
2022-11-18 16:54:20 +08:00
Dmitry Preobrazhensky e468b1b740 [AMDGPU][GFX11] Refactor VOPD operands handling
Differential Revision: https://reviews.llvm.org/D137952
2022-11-16 16:29:12 +03:00
Youling Tang b18cdeac79 [MC][LoongArch] Fix needsRelocateWithSymbol() implementation
LoongArch should be `section plus offset`, so use the generic implementation
of `llvm/lib/MC/MCELFObjectTargetWriter.cpp` to return `false` directly, like
x86 and aarch64.

```
$ cat test.c
static int __attribute__((section(".text.another"))) test(int a, int b)
{
	return a + b;
}
static int a = 1, b = 2;

int foo()
{
	test(a, b);
	return 0;
}

$ gcc -c test.c
$ readelf -Wr test.o

Relocation section '.rela.text' at offset 0x2a0 contains 5 entries:
    Offset             Info             Type               Symbol's Value  Symbol's Name + Addend
0000000000000010  0000000300000047 R_LARCH_PCALA_HI20     0000000000000000 .data + 0
0000000000000014  0000000300000048 R_LARCH_PCALA_LO12     0000000000000000 .data + 0
0000000000000018  0000000300000047 R_LARCH_PCALA_HI20     0000000000000000 .data + 4
000000000000001c  0000000300000048 R_LARCH_PCALA_LO12     0000000000000000 .data + 4
0000000000000028  0000000500000042 R_LARCH_B26            0000000000000000 .text.another + 0

Relocation section '.rela.eh_frame' at offset 0x318 contains 2 entries:
    Offset             Info             Type               Symbol's Value  Symbol's Name + Addend
000000000000001c  0000000500000063 R_LARCH_32_PCREL       0000000000000000 .text.another + 0
000000000000003c  0000000200000063 R_LARCH_32_PCREL       0000000000000000 .text + 0
```

Reviewed By: SixWeining, MaskRay

Differential Revision: https://reviews.llvm.org/D137384
2022-11-16 15:52:30 +08:00
Joe Nash 38f47d90db [AMDGPU][MC][NFC] Rename VOP3 VOPC test files
D136149 and D136148 renamed the MC test files for VOP3 promoted from VOP1 and
VOP2 in a consistent way. Do the same for VOP3 coming from VOPC.

Reviewed By: dp

Differential Revision: https://reviews.llvm.org/D137950
2022-11-14 13:27:38 -05:00