aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/Targets
AgeCommit message (Collapse)AuthorFilesLines
8 days[Driver] Enable __float128 support on X86 on Hurd (#160045)Brad Smith1-1/+13
13 days[AMDGPU] Add gfx1251 subtarget (#159430)Stanislav Mekhanoshin1-0/+1
2025-09-15[Dwarf] Support heterogeneous DW_{OP,AT}s needed for AMDGPU CFI (#153883)Scott Linder1-8/+5
These are defined in the user range until standard versions of them get adopted into dwarf, which is expected in DWARF6. Some of these amount to reservations currently as no code to use them is included. It would be very helpful to get them committed to avoid conflicts necessitating encoding changes while we are in the process of upstreaming. --------- Co-authored-by: Juan Martinez Fernandez <juamarti@amd.com> Co-authored-by: Emma Pilkington <Emma.Pilkington@amd.com>
2025-09-15Revert "[HIP][Clang] Remove __AMDGCN_WAVEFRONT_SIZE macros" (#158566)Fabian Ritter1-0/+6
Reverts llvm/llvm-project#157463 The PR breaks buildbots with old ROCm versions, so revert it and reapply when buildbots are updated.
2025-09-15[HIP][Clang] Remove __AMDGCN_WAVEFRONT_SIZE macros (#157463)Fabian Ritter1-6/+0
Remove definitions, test uses, and documentation of the macros, which were deprecated in November 2024 with PR #112849 / #115507. Where required, the wavefront size should instead be queried via means provided by the HIP runtime: the (non-constexpr) `warpSize` variable in device code, or `hipGetDeviceProperties` in host code. This change passed AMD-internal testing. Implements SWDEV-522062.
2025-09-14[Clang][Cygwin] Cygwin x86_64 should accept __stdcall (#158385)Tomohiro Kashiwada1-0/+23
Cygwin should support calling convention attributes `__cdecl`, `__stdcall`, `__thiscall`, and `__fastcall`, even though they have no effect in x86_64, as done in MinGW. Originally reported in https://cygwin.com/pipermail/cygwin/2025-September/258782.html --------- Co-authored-by: Jeremy Drake <github@jdrake.com>
2025-09-14[Clang][Cygwin] Use correct mangling rule (#158404)Tomohiro Kashiwada1-0/+2
In https://github.com/llvm/llvm-project/commit/45ca613c135ea7b5fbc63bff003f20bf20f62081, whether to mangle names based on calling conventions according to Microsoft conventions was refactored to a bool in the TargetInfo. Cygwin targets also require this mangling, but were missed, presumably due to lack of test coverage of these targets. This commit enables the name mangling for Cygwin, and also enables test coverage of this mangling on Cygwin targets.
2025-09-11[clang][SPIRV] Set program address space for Intel-flavored SPIR-V (#135251)Nick Sarnie1-0/+11
Technically, SPIR-V should use addrspace(4) for generic pointers. We already set the default AS in TargetInfo to 4, but that's not enough for all cases. Also set the program address space to 4 to fix the remaining cases. AMD already does this for their SPIR-V target, do it for Intel's SPIR-V target. I need this for OpenMP offloading to SPIR-V. There are a couple of places I need to change in the OMP FE to check the program AS, I'll do that in a follow-up PR. --------- Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
2025-09-09[Clang][RISCV] Loosen the requirement of -fcf-protection=return to zimop ↵Jesse Huang1-1/+1
(#152252) Following https://github.com/llvm/llvm-project/pull/152251 We can now loosen the requirement of `-fcf-protection=return` from Zicfiss to Zimop
2025-09-05[X86][AVX10] Remove EVEX512 and AVX10-256 implementations (#157034)Phoebe Wang2-86/+14
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-08-28[NVPTX] Support i256 load/store with 256-bit vector load (#155198)Alex MacLean1-6/+7
2025-08-27[AMDGPU] More radical feature initialization refactoring (#155222)Stanislav Mekhanoshin1-2/+1
Factoring in flang, just have a single fillAMDGPUFeatureMap function doing it all as an external interface and returing an error.
2025-08-27[AMDGPU] Refactor insertWaveSizeFeature (#154850)Stanislav Mekhanoshin1-1/+1
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-25[clang][SPIRV] Default AS generic for Intel-flavored SPIR-V (#153647)Nick Sarnie1-2/+5
Use the generic AS as the default AS for Intel-flavored SPIR-V. Nobody is using the `spirv64-intel` triple right now as far as I know, I'm planning to use it for OpenMP offload and we will definitely need generic AS as default there. Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
2025-08-22[Driver] DragonFly does not support C11 threads (#154886)Brad Smith1-0/+3
2025-08-20[X86][APX] Remove CF feature from APXF and Diamond Rapids (#153751)Phoebe Wang1-2/+1
Due to it results in more losses than gains.
2025-08-19[PowerPC] Add BCDCOPYSIGN and BCDSETSIGN Instruction Support (#144874)Aditi Medhane1-0/+2
Support the following BCD format conversion builtins for PowerPC. - `__builtin_bcdcopysign` – Conversion that returns the decimal value of the first parameter combined with the sign code of the second parameter. ` - `__builtin_bcdsetsign` – Conversion that sets the sign code of the input parameter in packed decimal format. > Note: This built-in function is valid only when all following conditions are met: > -qarch is set to utilize POWER9 technology. > The bcd.h file is included. ## Prototypes ```c vector unsigned char __builtin_bcdcopysign(vector unsigned char, vector unsigned char); vector unsigned char __builtin_bcdsetsign(vector unsigned char, unsigned char); ``` ## Usage Details `__builtin_bcdsetsign`: Returns the packed decimal value of the first parameter combined with the sign code. The sign code is set according to the following rules: - If the packed decimal value of the first parameter is positive, the following rules apply: - If the second parameter is 0, the sign code is set to 0xC. - If the second parameter is 1, the sign code is set to 0xF. - If the packed decimal value of the first parameter is negative, the sign code is set to 0xD. > notes: > The second parameter can only be 0 or 1. > You can determine whether a packed decimal value is positive or negative as follows: > - Packed decimal values with sign codes **0xA, 0xC, 0xE, or 0xF** are interpreted as positive. > - Packed decimal values with sign codes **0xB or 0xD** are interpreted as negative. --------- Co-authored-by: Aditi-Medhane <aditi.medhane@ibm.com>
2025-08-18[Clang] Rename HasLegalHalfType -> HasFastHalfType (NFC) (#153163)Nikita Popov10-14/+14
This option is confusingly named. What it actually controls is whether, under the default of `-ffloat16-excess-precision=standard`, it is beneficial for performance to perform calculations on float (without intermediate rounding) or not. For `-ffloat16-excess-precision=none` the LLVM `half` type will always be used, and all backends are expected to legalize it correctly.
2025-08-15[clang][LoongArch] Ensure `target("lasx")` implies LSX support (#153542)Ami-zhang1-0/+2
Currently, `__attribute__((target("lasx")))` does not automatically enable LSX support, causing Clang to fail with `-mno-lsx`. Since LASX depends on LSX, enabling LASX should implicitly enable LSX to avoid clang error. Fixes #149512. Depends on #153541
2025-08-11[AVR] Only specify one legal int string in data layout (#153010)Nikita Popov1-2/+1
There should not be both `n8` and `n16:8`. This is a single list of legal integers. Additionally, this should use the standard order in increasing size `n8:16`.
2025-08-09[AVR] Fix Avr indvar detection and strength reduction (missed optimization) ↵Tom Vijlbrief1-1/+2
(#152028) Fix https://github.com/llvm/llvm-project/issues/151080
2025-08-05[AMDGCNSPIRV][NFC] Match AMDGPU's `__builtin_va_list` type (#152044)Alex Voicu1-0/+4
AMDGCN flavoured SPIRV should math AMDGPU TI as much as possible, and the va_list difference was spurious.
2025-08-01[clang][ARM] Fix setting of MaxAtomicInlineWidth. (#151404)Eli Friedman1-8/+13
2f497ec3a0056f15727ee6008211aeb2c4a8f455 updated the backend's rules for when lock-free atomics are available, but we never made a corresponding change to the frontend. Fix it to be consistent. This only affects targets older than v7.
2025-07-31[CUDA] add support for targeting sm_103/sm_121 with CUDA-12.9 (#151587)Artem Belevich1-2/+10
2025-07-30[WebAssembly] Add gc target feature to addBleedingEdgeFeatures (#151294)Hood Chatham2-12/+13
Also alphebetize feature list, add `-mgc` and `-mno-gc` flags, and add some missing feature tests. Reland of #151107. https://github.com/llvm/llvm-project/pull/150201#discussion_r2237982637
2025-07-29Revert "[WebAssembly] Add gc target feature to addBleedingEdgeFeatures" ↵ronlieb2-13/+12
(#151268) Reverts llvm/llvm-project#151107
2025-07-29[WebAssembly] Add gc target feature to addBleedingEdgeFeatures (#151107)Hood Chatham2-12/+13
See suggestion here: https://github.com/llvm/llvm-project/pull/150201#discussion_r2237982637
2025-07-29[AMDGPU] Allow readonly features to be written to IR when there is no target ↵Changpeng Fang1-2/+5
(#148141) Fixes: SWDEV-541399
2025-07-29[Clang][ARM][Sema] Reject bad sizes of __builtin_arm_ldrex (#150419)Simon Tatham2-12/+7
Depending on the particular version of the AArch32 architecture, load/store exclusive operations might be available for various subset of 8, 16, 32, and 64-bit quantities. Sema knew nothing about this and was accepting all four sizes, leading to a compiler crash at isel time if you used a size not available on the target architecture. Now the Sema checking stage emits a more sensible diagnostic, pointing at the location in the code. In order to allow Sema to query the set of supported sizes, I've moved the enum of LDREX_x sizes out of its Arm-specific header into `TargetInfo.h`. Also, in order to allow the diagnostic to specify the correct list of supported sizes, I've filled it with `%select{}`. (The alternative was to make separate error messages for each different list of sizes.)
2025-07-25[WebAssembly,clang] Add __builtin_wasm_test_function_pointer_signature (#150201)Hood Chatham2-0/+17
Tests if the runtime type of the function pointer matches the static type. If this returns false, calling the function pointer will trap. Uses `@llvm.wasm.ref.test.func` added in #147486. Also adds a "gc" wasm feature to gate the use of the ref.test instruction.
2025-07-23[NFC][Clang][FMV] Make FMV priority data type future proof. (#150079)Alexandros Lamprineas6-12/+14
FMV priority is the returned value of a polymorphic function. On RISC-V and X86 targets a 32-bit value is enough. On AArch64 we currently need 64 bits and we will soon exceed that. APInt seems to be a suitable replacement for uint64_t, presumably with minimal compile time overhead. It allows bit manipulation, comparison and variable bit width.
2025-07-22Adding Loongarch64 to OpenBSD parts (#149737)Slava "nerfur" Voronzoff1-0/+1
Adding Loongarch64 to OpenBSD parts
2025-07-22[Clang][ARM] Fix __ARM_FEATURE_LDREX on Armv8-M (#149538)Simon Tatham1-1/+3
The Armv8-M architecture doesn't have the LDREXD and STREXD instructions, for exclusive load/store of a 64-bit quantity split across two registers. But the `__ARM_FEATURE_LDREX` macro was set to a value that claims it does, because the case for Armv8 was missing a check for M profile. The Armv7 case got it right, so I've just made the two cases the same.
2025-07-21[Mips] Correctly define IntPtrType (#145158)Hervé Poussineau1-3/+3
Mips was the only architecture having PtrDiffType = SignedInt and IntPtrType = SignedLong This fixes a problem on mipsel-windows-gnu triple, where uintptr_t was wrongly defined as unsigned long instead of unsigned int, leading to problems in compiler-rt. compiler-rt/lib/interception/interception_type_test.cpp:24:17: error: static assertion failed due to requirement '__sanitizer::is_same<unsigned long, unsigned int>::value': 24 | COMPILER_CHECK((__sanitizer::is_same<__sanitizer::uptr, ::uintptr_t>::value)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compiler-rt/lib/interception/../sanitizer_common/sanitizer_internal_defs.h:369:44: note: expanded from macro 'COMPILER_CHECK' 369 | #define COMPILER_CHECK(pred) static_assert(pred, "") | ^~~~ compiler-rt/lib/interception/interception_type_test.cpp:25:17: error: static assertion failed due to requirement '__sanitizer::is_same<long, int>::value': 25 | COMPILER_CHECK((__sanitizer::is_same<__sanitizer::sptr, ::intptr_t>::value)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compiler-rt/lib/interception/../sanitizer_common/sanitizer_internal_defs.h:369:44: note: expanded from macro 'COMPILER_CHECK' 369 | #define COMPILER_CHECK(pred) static_assert(pred, "") | ^~~~ compiler-rt/lib/interception/interception_type_test.cpp:27:17: error: static assertion failed due to requirement '__sanitizer::is_same<long, int>::value': 27 | COMPILER_CHECK((__sanitizer::is_same<::PTRDIFF_T, ::ptrdiff_t>::value)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compiler-rt/lib/interception/../sanitizer_common/sanitizer_internal_defs.h:369:44: note: expanded from macro 'COMPILER_CHECK' 369 | #define COMPILER_CHECK(pred) static_assert(pred, "")
2025-07-17[SPIR] Set MaxAtomicInlineWidth minimum size to 32 for spir32 and 64 for ↵Wenju He1-0/+6
spir64 (#148997) Set MaxAtomicInlineWidth the same way as SPIR-V targets in 3cfd0c0d3697. This PR fixes build warning in scoped atomic built-in in #146814: `warning: large atomic operation may incur significant performance penalty; ; the access size (2 bytes) exceeds the max lock-free size (0 bytes) [-Watomic-alignment]`
2025-07-15Remove Native Client support (#133661)Brad Smith4-169/+0
Remove the Native Client support now that it has finally reached end of life.
2025-07-09[Clang] Respect MS layout attributes during CUDA/HIP device compilation ↵Yaxun (Sam) Liu9-22/+33
(#146620) This patch fixes an issue where Microsoft-specific layout attributes, such as __declspec(empty_bases), were ignored during CUDA/HIP device compilation on a Windows host. This caused a critical memory layout mismatch between host and device objects, breaking libraries that rely on these attributes for ABI compatibility. The fix introduces a centralized hasMicrosoftRecordLayout() check within the TargetInfo class. This check is aware of the auxiliary (host) target and is set during TargetInfo::adjust if the host uses a Microsoft ABI. The empty_bases, layout_version, and msvc::no_unique_address attributes now use this centralized flag, ensuring device code respects them and maintains layout consistency with the host. Fixes: https://github.com/llvm/llvm-project/issues/146047
2025-07-08[AMDGPU][Clang] Support bfloat16 arithmetic. (#147541)Ivan Kosarev1-0/+1
Co-authored-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2025-07-08[Clang][Wasm] Set __float128 alignment to 64 for emscripten (#146494)Nikita Popov1-0/+1
https://reviews.llvm.org/D104808 set the alignment of long double to 64 bits. This is also the alignment specified in the LLVM data layout. However, the alignment of __float128 was left at 128 bits. I assume that this was just an oversight, rather than an intentional divergence. The C ABI document currently does not make any statement about `__float128`: https://github.com/WebAssembly/tool-conventions/blob/main/BasicCABI.md
2025-07-03[AArch64] Add option -msve-streaming-vector-bits= . (#144611)Eli Friedman4-8/+28
This is similar to -msve-vector-bits, but for streaming mode: it constrains the legal values of "vscale", allowing optimizations based on that constraint. This also fixes conversions between SVE vectors and fixed-width vectors in streaming functions with -msve-vector-bits and -msve-streaming-vector-bits. This rejects any use of arm_sve_vector_bits types in streaming functions; if it becomes relevant, we could add arm_sve_streaming_vector_bits types in the future. This doesn't touch the __ARM_FEATURE_SVE_BITS define.
2025-07-01[Clang] Remove AArch64TargetInfo::setArchFeatures (#146107)Sander de Smalen2-76/+0
When compiling with `-march=armv9-a+nosve` we found that Clang still defines the `__ARM_FEATURE_SVE2` macro, which is explicitly set in `setArchFeatures` when compiling for armv9-a. After some experimenting, I found out that the list of features passed into `AArch64TargetInfo::handleTargetFeatures` has already been expanded and takes into account `+no[feature]` and has already expanded features like `armv9-a`. From that I conclude that `setArchFeatures` is no longer required.
2025-07-01[Clang] Partially fix m68k alignments (#144740)Nikita Popov1-0/+1
As the data layout a few lines further up specifies, the int, long and pointer alignment should be 16 instead of the default of 32. The long long alignment is also incorrect, but that would require a change to the data layout as well. Comparison with GCC, which consistently uses 2 byte alignment: https://gcc.godbolt.org/z/K3x6a7dEf At least based on some spot checks, the changes to bit field layout also make use match GCC now. This was found by https://github.com/llvm/llvm-project/pull/144720.
2025-07-01[Clang][LoongArch] Fixed incorrect _BitInt(N>64) alignment (#145297)Ami-zhang1-0/+1
This patch makes determining alignment and width of BitInt to be target ABI specific and makes it consistent with [Procedure Call Standard for the LoongArch™ Architecture] for LoongArch target (https://github.com/loongson/la-abi-specs/blob/release/lapcs.adoc).
2025-06-28[Clang][LoongArch] Match GCC behaviour when parsing FPRs in asm clobbers ↵Yao Zi1-32/+40
(#138391) There're four possible formats to refer a register in inline assembly, 1. Numeric name without dollar sign ("f0") 2. Numeric name with dollar sign ("$f0") 3. ABI name without dollar sign ("fa0") 4. ABI name with dollar sign ("$fa0") LoongArch GCC accepts 1 and 2 for FPRs before r15-8284[1] and all these formats after the chagne. But Clang supports only 2 and 4 for FPRs. The inconsistency has caused compatibility issues, such as QEMU's case[2]. This patch follows 0bbf3ddf5fea ("[Clang][LoongArch] Add GPR alias handling without `$` prefix") and accepts FPRs without dollar sign prefixes as well to keep aligned with GCC, avoiding future compatibility problems. Link: https://gcc.gnu.org/cgit/gcc/commit/?id=d0110185eb78f14a8e485f410bee237c9c71548d [1] Link: https://lore.kernel.org/qemu-devel/20250314033150.53268-3-ziyao@disroot.org/ [2]
2025-06-27Revert "[Hexagon] NFC: Reduce the amount of version-specific code" (#146193)Brian Cain2-18/+28
Reverts llvm/llvm-project#145812
2025-06-27[Hexagon] NFC: Reduce the amount of version-specific code (#145812)Alexey Karyakin2-28/+18
There is a lot of redundant code that needs to be modified when new Hexagon versions are added. Reduce the amount of this redundancy. - compute ELF flags and attributes based on version feature names; - simplify EnableHVX option handling by using arch features instead of arch version enums; - simplify completeHVXFeatures() by using features; - delete several unused or redundant functions and constants: isCPUValid, getCpu, getHexagonCPUSuffix; - do not set HexagonArchVersion in initializeSubtargetDependencies, it is set in ParseSubtargetFeatures; Signed-off-by: Alexey Karyakin <akaryaki@quicinc.com>
2025-06-26[SystemZ][zOS] disable _Float16 support on z/OS (#145532)Sean Perry1-2/+2
The new half float type (aka _Float16 ) isn't supported on z/OS.
2025-06-25[PowerPC] Support for Packed BCD conversion builtins (#142723)Himadhith1-0/+6
Support the following packed BCD builtins for PowerPC. ``` __builtin_national2packed - Conversion of National format to Packed decimal format. __builtin_packed2national - Conversion of Packed decimal format to national format. __builtin_packed2zoned - Conversion of Packed decimal format to Zoned decimal format. __builtin_zoned2packed - Conversion of Zoned decimal format to Packed decimal format. ``` ### Prototypes: `vector unsigned char __builtin_national2packed(vector unsigned char a, unsigned char b);` `vector unsigned char __builtin_packed2zoned(vector unsigned char, unsigned char);` `vector unsigned char __builtin_zoned2packed(vector unsigned char, unsigned char);` The condition for the 2nd parameter is consistent over all the 3 prototypes (0 or 1 only). `vector unsigned char __builtin_packed2national(vector unsigned char);` Co-authored-by: himadhith <himadhith.v@ibm.com> Co-authored-by: Tony Varghese <tonypalampalliyil@gmail.com>
2025-06-20[clang] Add managarm support (#144791)no921-0/+30
This is a repost of the quickly reverted #139271. The failing buildbot tests have been fixed and pass on my machine now.
2025-06-19[clang] Migrate away from ArrayRef(std::nullopt) (NFC) (#144982)Kazu Hirata1-1/+1
ArrayRef has a constructor that accepts std::nullopt. This constructor dates back to the days when we still had llvm::Optional. Since the use of std::nullopt outside the context of std::optional is kind of abuse and not intuitive to new comers, I would like to move away from the constructor and eventually remove it. This patch takes care of the clang side of the migration.