58070 Commits

Author SHA1 Message Date
Simon Pilgrim
449e3fad62
[X86] combineConcatVectorOps - add concatenation handling for X86ISD::VSHLD/VSHRD funnel shift nodes (#132915)
Concat the nodes if we can merge either of the operands for free.
2025-03-25 13:23:47 +00:00
Evgenii Kudriashov
975c208556
[X86][AVX10.2] Include changes for COMX and VGETEXP from rev. 2 (#132824)
Address missing changes:
- V[,U]COMXSD need to have XD (F3.0F –> F2.0F)
- V[,U]COMXS[S,H] need to have XS (F2.[0F,MAP5] -> F3.[0F,MAP5])
- VGETEXPBF16 needs to have T_MAP6 and NP (66.MAP5 -> NP.MAP6)

 Ref.: https://cdrdv2.intel.com/v1/dl/getContent/828965
2025-03-25 13:26:13 +01:00
Benjamin Maxwell
107260cc29
[AArch64][SME2] Don't preserve ZT0 around SME ABI routines (#132722)
This caused ZT0 to be preserved around `__arm_tpidr2_save` in functions
with "aarch64_new_zt0". The block in which `__arm_tpidr2_save` is called
is added by the SMEABIPass and may be reachable in cases where ZA has
not been enabled* (so using `str zt0` is invalid).

* (when za_save_buffer is null and num_za_save_slices is zero)
2025-03-25 10:09:25 +00:00
Akshat Oke
f8e908a0ed
[AMDGPU][NPM] Port SIInsertHardClauses to NPM (#130062) 2025-03-25 15:33:32 +05:30
Simon Pilgrim
6984cfea6c [X86] Ensure concat(blendi(),blendi()) -> vselect() uses legal select mask types
For 256-bit selections, we could be using sub-i8/vXi8 selection condition masks - extend these to i8 and then extract the lowest mask subvector

Fixes #132844
2025-03-25 09:14:08 +00:00
Ricardo Jesus
847e46ca01
[AArch64] Add initial support for -mcpu=olympus. (#132368)
This patch adds support for the NVIDIA Olympus core.

This does not add any special tuning decisions, and those may come
later.
2025-03-25 08:09:04 +00:00
tangaac
a6d366268d
[LoongArch] Pre-commit tests for vector shift (#132702) 2025-03-25 10:31:54 +08:00
joaosaffran
567b0f8923
[HLSL] Add support to branch/flatten attributes to switch (#131739)
closes: [#125754](https://github.com/llvm/llvm-project/issues/125754)

---------

Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-03-24 16:17:19 -07:00
David Green
06e2fd962a [AArch64] Regenerate complex-int-to-fp.ll. NFC 2025-03-24 20:35:22 +00:00
Justin Bogner
368c7f72b9
[DirectX] Match DXC's resource order in DX container (#130233)
DXC and the DXIL validator expect resources in a DX container to be
specifically ordered CBuffers, Samplers, SRVs, and then UAVs. Match this
behaviour so that we can pass the validator.

Fixes #130232.
2025-03-24 12:33:54 -07:00
Alex MacLean
10fd5b925f
[NVPTX] Auto-Upgrade !"align" metadata on return values to stackalign (#131726)
This commit follows up 0191307b by auto-upgrading !"align" metadata on
return values to stackalign. This allows us to remove all logic to check
the metadata from NVPTXUtilities.
2025-03-24 12:00:44 -07:00
Austin Kerbow
e75f586b81
[AMDGPU] Relax lds dma waitcnt with no aliasing pair (#131842)
If we cannot find any lds DMA instruction that is aliased by some load
from lds, we will still insert vmcnt(0). This is overly cautious since
handling inter-thread dependences is normally managed by the memory
model instead of the waitcnt pass, so this change updates the behavior
to be more inline with how other types of memory events are handled.
2025-03-24 10:38:47 -07:00
Jay Foad
02ed65912e
[AMDGPU] 4-align TTMP triples (#132759)
Follow up to e4284a7c70cd "[AMDGPU] 4-align SGPR triples".

Previously TTMP triples like ttmp[3:5] were aligned on a 3-TTMP boundary
which has no basis in hardware.

Aligning them on a 4-TTMP boundary matches what we do for SGPRs, which
reduces the number of extra register classes synthesized by TableGen,
bringing the total number down from 653 to 615.
2025-03-24 17:11:39 +00:00
Piotr Fusik
9b8bcd288a [RISCV][test] Add a test for vector hasAndNot 2025-03-24 17:54:18 +01:00
Craig Topper
2b82555ef4
[RISCV] Remove experimental from Sdext and Sdtrig which are ratified. (#132529)
They were ratified in February 2025.
2025-03-24 09:46:51 -07:00
Ana Mihajlovic
cdea46cc8c
[AMDGPU] Add pattern for inverse.ballot.i64 Wave32 (#132770) 2025-03-24 17:30:02 +01:00
Akshat Oke
f10dc76f03
[AMDGPU][NPM] Port SIInsertWaitcnts to NPM (#130061) 2025-03-24 21:36:45 +05:30
Simon Pilgrim
0237216f16
[DAG] canCreateUndefOrPoison - add EXTRACT_SUBVECTOR handling (#132745)
Similar to INSERT_SUBVECTOR - the index is constant and will be inbounds
2025-03-24 16:03:47 +00:00
Pavel Skripkin
0e63180fa3
Reapply "[Aarch64] [ISel] Don't save vaargs registers if vaargs are unused" (#131459)
This reapplies original commit e122483762b44c7f4386165099ff2a404705d7d4

Second try, but with win64 removed from the scope, since it was somehow
broken by original commit.

### Original PR description

If vaargs are not used there is no need to save them. LLVM already
implements such optimization for x86, as well as gcc [1].

Some ABI tests are kept almost as-is, except for stack offsets, by just
adding llvm.va_start. Only laapcs_vararg_frame.ll test was rewritten to
match new behavior.

[1] https://godbolt.org/z/GWWKr8xMd
2025-03-24 18:13:42 +03:00
Juan Manuel Martinez Caamaño
5634e7e2f0
[AMDGCN][SIWholeQuadMode] Rework splitBlock/lowerKillI1/lowerKillF32 to handle case when SI_KILL_I1_TERMINATOR -1 0 is not the unique terminator
The lowerKillI1 method wrongly handled cases where it inserted a
new S_BRANCH instruction when the kill was not the only terminator,
and then tried to split the block.

`SI_KILL_I1_TERMINATOR -1,0` doesn't have any effect. Instead of
lowering to an unconditional branch, we remove the instruction and
insert an unconditional branch only if the instruction is the last
terminator. No split is needed in this case (if the last terminator
has been reached, then the whole block was processed).

Also stop generating an unconditional branch in splitBlock: this
branch was redundant since TermMI is promoted to a
terminator that fallsthrough to the next block already.

Solves SWDEV-508819
2025-03-24 15:57:08 +01:00
Simon Pilgrim
02cf97f703
[X86] combineConcatVectorOps - always concatenate integer binops with duplicated operands (#132735)
Only a single operand will need to be concatenated, so treat it like an unaryop
2025-03-24 14:48:20 +00:00
Simon Pilgrim
03d8529d01 [X86] Add test coverage for i512 shift-by-constants
Based off #132601 - pass the i512 types inside 512-bit vectors

Shows several missed general codegen issues that will help in a lot more cases than just this.
2025-03-24 13:27:25 +00:00
Michael Maitland
f8416fcfec
[RISCV][VLOPT] Look through PHI instructions (#132236)
Similar to what we do for copies. We may reduce one of the PHI operands
and not the other, and thats perfectly okay.
2025-03-24 09:26:09 -04:00
Simon Pilgrim
d536d13427 [X86] x86-64-double-shifts-var.ll - regenerate with update_llc_test_checks script to show full codegen 2025-03-24 11:38:34 +00:00
Csanád Hajdú
e2e776c867
[AArch64] Always add PURECODE flag to empty .text if "+execute-only" is set (#132196)
Previously, the `SHF_AARCH64_PURECODE` section flag wasn't added to the
implicitly created `.text` section if the module didn't contain any
functions, because no other section had the flag set.

Now, the `SHF_AARCH64_PURECODE` is always added if the "+execute-only"
target feature is set for the module during compilation.
2025-03-24 11:19:26 +01:00
Pierre van Houtryve
c457c88951
[GlobalISel] Combine (sext (trunc x)) to (sext_inreg x) (#131622)
Split from #131312
2025-03-24 09:32:04 +01:00
Pierre van Houtryve
6e3c24fc0a
[DAG] Combine (sext (sext_in_reg x)) to (sext_in_reg (any_extend x)) (#132386) 2025-03-24 09:31:02 +01:00
Antonio Frighetto
ade2276517 [RegAllocFast] Ensure live-in vregs get reloaded after INLINEASM_BR spills
We have already ensured in 9cec2b246e719533723562950e56c292fe5dd5ad
that `INLINEASM_BR` output operands get spilled onto the stack, both
in the fallthrough path and in the indirect targets. Since reloads of
live-ins values into physical registers contextually happen after all
MIR instructions (and ops) have been visited, make sure such loads are
placed at the start of the block, but after prologues or `INLINEASM_BR`
spills, as otherwise this may cause stale values to be read from the
stack.

Fixes: #74483, #110251.
2025-03-24 09:19:53 +01:00
Antonio Frighetto
376aa741b5 [RegAllocFast] Introduce test for PR131350 (NFC) 2025-03-24 09:19:53 +01:00
MingYan
b75dad090c
[RISCV] Support VP_SPLAT mask operations (#132345)
When val is a constant, it will:
(vp.splat val, mask, vl) -> (select val, (riscv_vmset_vl vl),
(riscv_vmclr_vl vl))
Otherwise:
(vp.splat val, mask, vl) -> (vmsne_vl (vmv_v_x_vl (zext val), vl),
splat(zero), mask, vl)

---------

Co-authored-by: yanming <ming.yan@terapines.com>
2025-03-24 15:26:58 +08:00
tangaac
e3bd1f2b3f
[LoongArch] lower vector shuffle to zero or any extend (#129485) 2025-03-24 14:29:11 +08:00
Akshat Oke
174110bf3c
[CodeGen][NPM] Port LiveDebugValues to NPM (#131563) 2025-03-24 11:34:45 +05:30
Shoreshen
054e0b41a8
[AMDGPU] Add all type for bitcast on VReg_512 (#131775)
Add all types pattern for bitcast on VReg_512
2025-03-24 11:52:10 +08:00
tangaac
943a70717c
[LoongArch] Pre-commit test for vector sext, zext (#131742) 2025-03-24 10:35:18 +08:00
Justin Fargnoli
ff25115ca0
[NVPTX] cleanup & canonicalize mov (#129344)
Use a `multiclass` to define `mov` and canonicalize the `mov`
instruction to always use the `b<bit-size>` suffix.
2025-03-23 14:53:00 -07:00
Jonathan Cohen
7bda9caa49
Revert "[AArch64][MachineCombiner] Recombine long chains of accumulation instructions into a tree to increase ILP (#126060) (#132607)
This reverts commit c4caf949aa934a219e84d4ba0530bd535e698cdb.
2025-03-23 13:58:00 +02:00
Jonathan Cohen
c4caf949aa
[AArch64][MachineCombiner] Recombine long chains of accumulation instructions into a tree to increase ILP (#126060)
This pattern shows up often in media libraries. The optimization should only
kick in for O3. Currently only supports a single family of accumulation
instructions, but can easily be expanded to support additional
instructions in the future.
2025-03-23 13:25:35 +02:00
Craig Topper
112277eeaf
[RISCV] Add missing features to features-info.ll. NFC (#132530)
Use CHECK-NEXT so we can't forget any in the future.
2025-03-22 23:17:59 -07:00
Craig Topper
fb44c54d65
[RISCV] Add missing space to optimized-nf*-segment-load-store description. NFC (#132531) 2025-03-22 10:18:31 -07:00
Mikhail R. Gadelha
f138e36d52
[SelectionDAG][RISCV] Avoid store merging across function calls (#130430)
This patch improves DAGCombiner's handling of potential store merges by
detecting function calls between loads and stores. When a function call
exists in the chain between a load and its corresponding store, we avoid
merging these stores if the spilling is unprofitable.

We had to implement a hook on TLI, since TTI is unavailable in
DAGCombine. Currently, it's only enabled for riscv.

This is the DAG equivalent of PR #129258
2025-03-22 10:35:25 -03:00
Jesse Huang
20b5728b7b
[RISCV] Implement the implications of C extension (#132259)
Implement the following implications according to the [Zc
spec](https://github.com/riscvarchive/riscv-code-size-reduction/blob/main/Zc-specification/Zc.adoc#13-c)

> As C defines the same instructions as Zca, Zcf and Zcd, the rule is
that:
> * C always implies Zca
> * C+F implies Zcf (RV32 only)
> * C+D implies Zcd
2025-03-22 14:48:52 +08:00
Sudharsan Veeravalli
e7107973b8
Recommit "[RISCV] Add Qualcomm uC Xqcisync (Sync Delay) extension (#132184)" (#132520)
With a minor fix for the build failures.

Original message:

This extension adds nine instructions, eight for non-memory-mapped devices synchronization and delay instruction.

The current spec can be found at:
https://github.com/quic/riscv-unified-db/releases/tag/Xqci-0.7.0

This patch adds assembler only support.

Co-authored-by: Sudharsan Veeravalli quic_svs@quicinc.com
2025-03-22 11:07:48 +05:30
Kazu Hirata
fe7776eab8 Revert "[RISCV] Add Qualcomm uC Xqcisync (Sync Delay) extension (#132184)"
This reverts commit 3840f787a21a66686f5d8bf61877d41f3a65f205.

Multiple builtbot failures have been reported:
https://github.com/llvm/llvm-project/pull/132184
2025-03-21 20:28:11 -07:00
quic_hchandel
3840f787a2
[RISCV] Add Qualcomm uC Xqcisync (Sync Delay) extension (#132184)
This extension adds nine instructions, eight for non-memory-mapped
devices synchronization and delay instruction.

The current spec can be found at:
https://github.com/quic/riscv-unified-db/releases/tag/Xqci-0.7.0

This patch adds assembler only support.

Co-authored-by: Sudharsan Veeravalli <quic_svs@quicinc.com>
2025-03-22 07:57:07 +05:30
Alexey Karyakin
c0b2c10e9f
[hexagon] Bump the default version to v68 (#132304)
Set the default processor version to v68 when the user does not specify
one in the command line. This includes changes in the LLVM backed and
linker (lld). Since lld normally sets the version based on inputs, this
change will only affect cases when there are no inputs.

Fixes #127558
2025-03-21 20:08:45 -05:00
Phoebe Wang
df4257b038
[X86][AVX10.2] Remove YMM rounding from VCVT[,T]PS2I[,U]BS (#132426)
Ref: https://cdrdv2.intel.com/v1/dl/getContent/784343
2025-03-22 08:42:22 +08:00
metkarpoonam
718838d128
Hlsl asint16 intrinsic (#131900)
Implemented the asint16 function and added test cases for codegen, Sema,
and SPIR-V backend.
fixes https://github.com/llvm/llvm-project/issues/99184

---------

Co-authored-by: Ashley Coleman <ascoleman@microsoft.com>
2025-03-21 19:56:35 -04:00
Shilei Tian
f1ac2afe21
Reapply "[AMDGPU] Use COV6 by default (#118515)" (#130963)
This reverts commit 68bcba6d7a1cc18996c0bcb7c62267c62d2040d0.
2025-03-21 15:26:45 -04:00
Cassandra Beckley
0f400cb3ac
[SPIR-V] Don't add linkage attributes for input variables (#132301)
Fixes #131878
2025-03-21 14:52:31 -04:00
Akshay Deodhar
cb2ee1e64d
[NVPTX][NVPTXLowerArgs] Add NewPM interface for NVPTXLowerArgs (#128960)
Add a NewPM interface for NVPTXLowerArgs
2025-03-21 10:56:38 -07:00