519 Commits

Author SHA1 Message Date
Jakub Kuderski
4c21d0cb14
[ADT] Prepare to deprecate variadic StringSwitch::Cases. NFC. (#166020)
Update all uses of variadic `.Cases` to use the initializer list
overload instead. I plan to mark variadic `.Cases` as deprecated in a
followup PR.

For more context, see https://github.com/llvm/llvm-project/pull/163117.
2025-11-02 00:12:33 +00:00
Mikołaj Piróg
5322fb6268
[X86] Remove AMX-TRANSPOSE (#165556)
Per Intel Architecture Instruction Set Extensions Programming Reference
rev. 59 (https://cdrdv2.intel.com/v1/dl/getContent/671368), Revision
History entry for revision -59, AMX-TRANSPOSE was removed
2025-10-31 12:50:21 +01:00
Jens Reidel
331b3eb489
[PowerPC] Take ABI into account for data layout (#149725)
Prior to this change, the data layout calculation would not account for
explicitly set `-mabi=elfv2` on `powerpc64-unknown-linux-gnu`, a target
that defaults to `elfv1`.

This is loosely inspired by the equivalent ARM / RISC-V code.

`make check-llvm` passes fine for me, though AFAICT all the tests
specify the data layout manually so there isn't really a test for this
and I am not really sure what the best way to go about adding one would
be.

Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2025-10-31 10:30:53 +01:00
Kazu Hirata
817aff6960
[llvm] Use nullptr instead of 0 or NULL (NFC) (#165396)
Identified with modernize-use-nullptr.
2025-10-28 16:15:01 -07:00
Albert Huang
aa550cdc5f
[ARM] [AArch32] Add support for Arm China STAR-MC3 CPU (#163709)
STAR-MC3 is an Armv8.1m CPU.
Technical specificationa available at:
https://www.armchina.com/download/Documents/TRM?infoId=240
2025-10-27 08:55:28 +00:00
Jonathan Thackray
7ac2900718
[ARM][AArch64] Introduce the Armv9.7-A architecture version (#163154)
This introduces the Armv9.7-A architecture version, including the
relevant command-line option for -march.

More details about the Armv9.7-A architecture version can be found at:
   * https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/arm-a-profile-architecture-developments-2025
   * https://developer.arm.com/documentation/109697/2025_09/2025-Architecture-Extensions
   * https://developer.arm.com/documentation/ddi0602/2025-09/

Co-authored-by: Caroline Concatto <caroline.concatto@arm.com>
2025-10-23 23:12:58 +01:00
Stanislav Mekhanoshin
9b5bc98743
[AMDGPU] Add intrinsics for v_[pk]_add_{min|max}_* instructions (#164731) 2025-10-22 17:46:33 -07:00
Min-Yih Hsu
90bc75043c
[RISCV][MC] Introduce XSfvfexp* and XSfvfbfexpa* extensions and their MC supports (#164349)
XSfvfbfexp16e, XSfvfexp16e, and XSfvfexp32e are SiFive's vector
exponential instruction extensions of BFloat16, F16, and F32,
respectively. Spec:
https://www.sifive.com/document-file/exponential-function-instruction-xsfvfexp32e-xsfvf

XSfvfexpa and XSfvfexpa64e are SiFive's vector exponential approximation
instruction extensions where the former supports F16 and F32 and the
latter covers F64. These instructions approximate 2 raised to a
fractional power. Spec:
https://www.sifive.com/document-file/exponential-approximation-instruction-xsfvfexpa-ex

This patch adds their corresponding features and MC supports.

---------

Co-authored-by: Jesse Huang <jesse.huang@sifive.com>
Co-authored-by: Craig Topper <craig.topper@sifive.com>
2025-10-21 18:27:21 -07:00
Petr Hosek
7b190b79d9
[Clang][LLVM] Support for Fuchsia on ARM (#163848)
This introduces the support for 32-bit ARM Fuchsia target which uses the
aapcs-linux ABI defaulting to thumbv8a as the target.
2025-10-21 11:08:30 -07:00
Mikołaj Piróg
8c826066e9
[X86] Remove USER_MSR from DMR (#164232)
Per Intel Architecture Instruction Set Extensions Programming Reference
rev. 59 (https://cdrdv2.intel.com/v1/dl/getContent/671368), table 1-2,
DMR doesn't support USER_MSR (URDMSR and UWRMSR instructions)
2025-10-20 18:14:41 +02:00
Jakub Kuderski
d86da4efee
[ADT] Prepare for deprecation of StringSwitch cases with 4+ args. NFC. (#164173)
Update `.Cases` and `.CasesLower` with 4+ args to use the
`initializer_list` overload. The deprecation of these functions will
come in a separate PR.

For more context, see: https://github.com/llvm/llvm-project/pull/163405.
2025-10-20 12:03:46 -04:00
Craig Topper
e501a1f15e
[RISCV] Make Zalrsc+Zaamo imply A. (#163890) 2025-10-16 19:07:23 -07:00
Jake Egan
67636d7df4
[llvm][AIX] Fix triple OS version on PASE (#163392)
The OS version is added to the triple with the value returned by uname.
However, PASE uses different versioning from AIX, so the uname value
needs to be mapped to AIX first.
2025-10-16 13:40:37 -04:00
Mikołaj Piróg
22a2a82054
[X86] Add support for Nova Lake (#163552)
Add support for Nova Lake, per Intel Architecture Instruction Set
Extensions Programming Reference rev. 59
(https://cdrdv2.intel.com/v1/dl/getContent/671368)
2025-10-16 14:58:23 +02:00
Justin Bogner
bf5f441731
[DirectX] Add 32- and 64-bit 3-element vectors to DataLayout (#160955)
This explicitly adds two 3-element vectors to the DataLayout so that
they'll be element-aligned. We need to do this more generally for
vectors, but this unblocks some very common cases.

Workaround for #123968
2025-10-15 13:33:05 -06:00
Kazu Hirata
f2306b6304
[llvm] Replace LLVM_ATTRIBUTE_UNUSED with [[maybe_unused]] (NFC) (#163507)
This patch replaces LLVM_ATTRIBUTE_UNUSED with [[maybe_unused]].  Note
that this patch adjusts the placement of [[maybe_unused]] to comply
with the C++17 language.
2025-10-15 06:54:14 -07:00
Jakub Kuderski
2ed7baafc3
[ADT] Migrate StringSwitch Cases with 6+ arguments to new overload. NFC. (#163549)
Switch to the `.Cases({S0, S1, ...}, Value)` overload instead, and the
manually-enumerated overloads with 6+ arguments are getting deprecated
in https://github.com/llvm/llvm-project/pull/163405.

This pre-commits API updates ahead of the deprecation to make potential
reverts cleaner. This was already reviewed in #163405.
2025-10-15 09:27:37 -04:00
Mikołaj Piróg
0e6557d71c
[X86] Add support for Wildcat Lake (#163214)
Add support for Wildcat Lake, per Intel Architecture Instruction Set
Extensions Programming Reference rev. 59
(https://cdrdv2.intel.com/v1/dl/getContent/671368)
2025-10-15 10:36:20 +02:00
Mikołaj Piróg
69e0fd6d8d
[X86] Remove PREFETCHI from PTL (#163196)
Per Intel Architecture Instruction Set Extensions Programming Reference
rev. 59 (https://cdrdv2.intel.com/v1/dl/getContent/671368), table 1-2,
PTL doesn't have support for PREFETCHI.
2025-10-14 12:47:27 +02:00
Brandon Wu
50aac2cd93
[RISCV] Add XSfmm pseudo instruction and vset* insertion support (#143068)
This patch supports the naive vset* insertion. If the state(tm, tn, tk,
sew, widen) changes, it emits all of the vset* instructions that are
needed, partial compatibility is not supported yet.

This is follow up patch for:
https://github.com/llvm/llvm-project/pull/133031
Co-authored-by: Piyou Chen <piyou.chen@sifive.com>
Co-authored-by: Craig Topper <craig.topper@sifive.com>
2025-10-13 15:06:31 +00:00
Matt Arsenault
853760bca6
AMDGPU: Use ELF mangling in data layout (#163011)
Closes #95219
2025-10-13 03:01:45 +00:00
Arjun Ramesh
7e7c923b58
[WebAssembly] Support for new target wasm32-linux-muslwali (#162581)
Add toolchain support for the
[WALI](https://doc.rust-lang.org/rustc/platform-support/wasm32-wali-linux.html)
target as per its corresponding
[RFC](https://discourse.llvm.org/t/rfc-new-wasm-linux-target-support/88203)
2025-10-10 14:54:25 -07:00
Shilei Tian
9e8dda1034
[NFC] Change spelling of cluster feature to "clusters" (#162103) 2025-10-06 15:55:39 +00:00
Shilei Tian
bea0225c30
[AMDGPU] Make cluster a target feature (#162040)
This replaces the original arch check.
2025-10-06 05:05:53 +00:00
Joseph Huber
0fa3061c4e
Revert "[ELF][LLDB] Add an nvsass triple (#159459)" (#159879)
Summary:
This patch has broken the `libc` build bot. I could work around that but
the changes seem unnecessary.

This reverts commit 9ba844eb3a21d461c3adc7add7691a076c6992fc.
2025-09-19 20:13:48 -05:00
Walter Erquinigo
9ba844eb3a
[ELF][LLDB] Add an nvsass triple (#159459)
When handling CUDA ELF files via objdump or LLDB, the ELF parser in LLVM
needs to distinguish if an ELF file is sass or not, which requires a
triple for sass to exist in llvm. This patch includes all the necessary
changes for LLDB and objdump to correctly identify these files with the
correct triple.
2025-09-19 14:14:20 -04:00
Matt Arsenault
cc680fc50c
X86: Avoid using isArch64Bit for 64-bit checks (#157412)
Just directly check x86_64. isArch64Bit just adds extra
steps around this.
2025-09-19 12:49:13 +00:00
Jim Lin
e747223c03
[RISCV] Implement MC support for Zvfofp8min extension (#157014)
This patch adds MC support for Zvfofp8min
https://github.com/aswaterman/riscv-misc/blob/main/isa/zvfofp8min.adoc.
2025-09-19 07:49:31 +00:00
Stanislav Mekhanoshin
e556dc0b23
[AMDGPU] Add gfx1251 subtarget (#159430) 2025-09-17 13:02:02 -07:00
Umesh Kalvakuntla
b3a1c77782
[X86] Fixes for AMD znver5 enablement (#159237)
- cpuid bit for prefetchi is different from Intel
(https://docs.amd.com/v/u/en-US/24594_3.37)
 - Fix cpu family model numbers
2025-09-17 13:25:45 +08:00
Stanislav Mekhanoshin
a3762fb240
[AMDGPU] Add missing bf16-pk-insts feature to gfx1250 (#159167) 2025-09-16 13:58:40 -07:00
Reid Kleckner
f3efbce4a7
[llvm] Move data layout string computation to TargetParser (#157612)
Clang and other frontends generally need the LLVM data layout string in
order to generate LLVM IR modules for LLVM. MLIR clients often need it
as well, since MLIR users often lower to LLVM IR.

Before this change, the LLVM datalayout string was computed in the
LLVM${TGT}CodeGen library in the relevant TargetMachine subclass.
However, none of the logic for computing the data layout string requires
any details of code generation. Clients who want to avoid duplicating
this information were forced to link in LLVMCodeGen and all registered
targets, leading to bloated binaries. This happened in PR #145899,
which measurably increased binary size for some of our users.

By moving this information to the TargetParser library, we
can delete the duplicate datalayout strings in Clang, and retain the
ability to generate IR for unregistered targets.

This is intended to be a very mechanical LLVM-only change, but there is
an immediately obvious follow-up to clang, which will be prepared
separately.

The vast majority of data layouts are computable with two inputs: the
triple and the "ABI name". There is only one exception, NVPTX, which has
a cl::opt to enable short device pointers. I invented a "shortptr" ABI
name to pass this option through the target independent interface.
Everything else fits. Mips is a bit awkward because it uses a special
MipsABIInfo abstraction, which includes members with codegen-like
concepts like ABI physical registers that can't live in TargetParser. I
think the string logic of looking for "n32" "n64" etc is reasonable to
duplicate. We have plenty of other minor duplication to preserve
layering.

---------

Co-authored-by: Matt Arsenault <arsenm2@gmail.com>
Co-authored-by: Sergei Barannikov <barannikov88@gmail.com>
2025-09-11 11:05:29 -07:00
Gergely Futo
e790c97f65
[RISCV] Make "target-feature +i" explicit (#157835)
Add "target-feature +i" for RV32I/RV64I.

Current behavior:
RV32E/RV64E: "target-feature +e" "target-feature -i"
RV32I/RV64I: "target-feature -e"

Adding "target-feature +i" explicitly makes the behavior consistent.
2025-09-11 08:49:06 +02:00
Finn Plummer
ad491118df
[HLSL][DirectX] Add support for rootsig as a target environment (#156373)
This pr implements support for a root signature as a target, as specified
[here](https://github.com/llvm/wg-hlsl/blob/main/proposals/0029-root-signature-driver-options.md#target-root-signature-version).

This is implemented in the following steps:
1. Add `rootsignature` as a shader model environment type and define
`rootsig` as a `target_profile`. Only valid as versions 1.0 and 1.1
2. Updates `HLSLFrontendAction` to invoke a special handling of
constructing the `ASTContext` if we are considering an `hlsl` file and
with a `rootsignature` target
3. Defines the special handling to minimally instantiate the `Parser`
and `Sema` to insert the `RootSignatureDecl`
4. Updates `CGHLSLRuntime` to emit the constructed root signature decl
as part of `dx.rootsignatures` with a `null` entry function
5. Updates `DXILRootSignature` to handle emitting a root signature
without an entry function
6. Updates `ToolChains/HLSL` to invoke `only-section=RTS0` to strip any
other generated information

Resolves: https://github.com/llvm/llvm-project/issues/150286.

##### Implementation Considerations
Ideally we could invoke this as part of `clang-dxc` without the need of
a source file. However, the initialization of the `Parser` and `Lexer`
becomes quite complicated to handle this.

Technically, we could avoid generating any of the extra information that
is removed in step 6. However, it seems better to re-use the logic in
`llvm-objcopy` without any need for additional custom logic in
`DXILRootSignature`.
2025-09-09 09:14:58 -06:00
Farzon Lotfi
16661b5d6c
[DirectX] Add isinf f16 emulation for SM6.8 and lower (#156932)
fixes #156068

- We needed to add a new sub arch to the target tripple so we can test
that emulation does not happen when targeting SM6.9
- The HLSL toolchain needed to be updated to handle the conversion of
strings to enums for the new sub arch.
- The emulation is done in DXILIntrinsicExpansion.cpp and needs to be
able to convert both llvm.is.fpclass and lvm.dx.isinf to the proper
emulation
- test updates in TargetParser/TripleTest.cpp, isinf.ll, is_fpclass.ll,
and DXCModeTest.cpp
2025-09-05 14:02:48 -04:00
Phoebe Wang
94b164c218
[X86][AVX10] Remove EVEX512 and AVX10-256 implementations (#157034)
The 256-bit maximum vector register size control was removed from AVX10
whitepaper, ref: https://cdrdv2.intel.com/v1/dl/getContent/784343

We have warned these options in LLVM21 through #132542. This patch
removes underlying implementations in LLVM22.
2025-09-05 14:08:59 +00:00
Owen Anderson
3b2796cc43
[Triple] Add target triple support for CheriotRTOS. (#155374)
For context, CheriotRTOS is a custom RTOS co-designed for the CHERIoT
CHERI-enabled RISCV32E platform. It uses a custom ABI and linkage model,
necesitating representing it in the target triple.
2025-09-02 10:54:34 +08:00
Jim Lin
717771e13d
[RISCV] Implement MC support for Zvfbfa extension (#151106)
This patch adds MC support for Zvfbfa
https://github.com/aswaterman/riscv-misc/blob/main/isa/zvfbfa.adoc

Since Zvfbfa implies Zve32f, vector floating-point instructions can be
used directly with Zvfbfa extension.
2025-08-28 01:36:10 +00:00
Stanislav Mekhanoshin
9cca295dcc
[AMDGPU] More radical feature initialization refactoring (#155222)
Factoring in flang, just have a single fillAMDGPUFeatureMap
function doing it all as an external interface and returing
an error.
2025-08-27 01:21:14 -07:00
Stanislav Mekhanoshin
8c6b7af50e
[AMDGPU] Refactor insertWaveSizeFeature (#154850)
If a wavefrontsize32 or wavefrontsize64 is the only possible value
insert it into feature list by default and use that value as an
indication that another wavefront size is not legal.
2025-08-27 00:30:15 -07:00
David Tenty
63195d3d7a
[NFC][CMake] quote ${CMAKE_SYSTEM_NAME} consistently (#154537)
A CMake change included in CMake 4.0 makes `AIX` into a variable
(similar to `APPLE`, etc.)
ff03db6657

However, `${CMAKE_SYSTEM_NAME}` unfortunately also expands exactly to
`AIX` and `if` auto-expands variable names in CMake. That means you get
a double expansion if you write:

`if (${CMAKE_SYSTEM_NAME}  MATCHES "AIX")`
which becomes:
`if (AIX  MATCHES "AIX")`
which is as if you wrote:
`if (ON MATCHES "AIX")`

You can prevent this by quoting the expansion of "${CMAKE_SYSTEM_NAME}",
due to policy
[CMP0054](https://cmake.org/cmake/help/latest/policy/CMP0054.html#policy:CMP0054)
which is on by default in 4.0+. Most of the LLVM CMake already does
this, but this PR fixes the remaining cases where we do not.
2025-08-20 12:45:41 -04:00
Phoebe Wang
99a1d5f7fa
[X86][APX] Remove CF feature from APXF and Diamond Rapids (#153751)
Due to it results in more losses than gains.
2025-08-20 03:07:56 +00:00
Owen Anderson
4f683b10b5
[RISCV] When resolving extension implications, handle the default I/E case after implications are resolved. (#154353)
This is needed to handle the scenario of an extension that implies
FeatureStdExtE, as is the case for the
downstream FeatureVendorXCheriot used for Cheriot support.
2025-08-20 09:59:23 +08:00
Pawan Nirpal
a5ba6067d6
[Clang][NFC] Use Hex Encoding for Intel CPU CPUID family (#153004)
Use Hex Encoding for CPUID family to match number format with Intel ISE
rev.58:
https://cdrdv2.intel.com/v1/dl/getContent/671368
2025-08-14 18:36:34 +02:00
Andrei Safronov
48da8489f2
[Xtensa] Add esp32/esp8266 cpus implementation. (#152409)
Add Xtensa esp32 and esp8266 cpus. Implement target parser to recognise
Xtensa hardware features.
2025-08-12 15:17:36 +03:00
Daniel Paoliello
7694856fdd
Fix TargetParserTests for big-endian hosts (#152407)
The new `sys::detail::getHostCPUNameForARM` for Windows (#151596) was
implemented using a C++ bit-field, which caused the associated unit
tests to fail on big-endian machines as it assumed a little-endian
layout.

This change switches from the C++ bit-field to LLVM's `BitField` type
instead.
2025-08-06 16:50:28 -07:00
Daniel Paoliello
a418fa7cdc
[win][aarch64] Add support for detecting the Host CPU on Arm64 Windows (#151596)
Uses the `CP 4000` registry keys under
`HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\*` to get the
Implementer and Part, which is then provided to a modified form of
`getHostCPUNameForARM` to map to a CPU.

On my local Surface Pro 11 `llc --version` reports:
```
> .\build\bin\llc.exe --version
LLVM (http://llvm.org/):
  LLVM version 22.0.0git
  Optimized build with assertions.
  Default target: aarch64-pc-windows-msvc
  Host CPU: oryon-1
```
2025-08-06 11:39:41 -07:00
zGoldthorpe
d7074b63ed
[Clang][AMDGPU] Add builtins for some buffer resource atomics (#149216)
This patch exposes builtins for atomic `add`, `max`, and `min` operations that
operate over buffer resource pointers.
2025-08-05 11:04:15 -06:00
Alex Voicu
06458fff87
[AMDGCNSPIRV][NFC] Add missing target features to AMDGCNSPIRV (#152057)
`gfx1250` bring-up omitted updating the `amdgcnspirv` feature list, this
fixes that oversight.
2025-08-05 15:29:48 +01:00
Matt Arsenault
e848959cb5
ARM: Remove CPU from computeTargetABI (#151983)
The target CPU is a subtarget / function level concept, which
should not influence the module level ABI decisions. No tests fail
so it appears nothing is relying on this.
2025-08-05 10:21:50 +09:00