64100 Commits

Author SHA1 Message Date
Juan Manuel Martinez Caamaño
52ea06f884
[SPIRV] Add tests documenting incorrect lowering of load/store atomic (#185628)
This patch only adds the tests documenting the broken behavior, but does
not fix them.
2026-03-11 09:40:10 +01:00
Pengcheng Wang
8cfcf3384f
[RISCV] Combine vwaddu_wv+vabd(u) to vwabda(u)
Note that we only support SEW=8/16 for `vwabda(u)`.

Reviewers: mgudim, preames, mshockwave

Reviewed By: mshockwave

Pull Request: https://github.com/llvm/llvm-project/pull/184603
2026-03-11 15:00:11 +08:00
Pengcheng Wang
98eb2413ba
[RISCV] Add tests for vwaddu_wv+vabd(u) combine
Reviewers: lukel97, topperc, preames, mgudim, mshockwave

Pull Request: https://github.com/llvm/llvm-project/pull/184962
2026-03-11 14:54:52 +08:00
Pengcheng Wang
db7e0daa85
[RISCV][MC] Add support of Zvzip extension (#185614)
This adds the initial support of the `Zvzip` standard extension for
reordering structured data in vector registers.

Doc:

*
https://github.com/ved-rivos/riscv-isa-manual/blob/zvzip/src/zvzip.adoc
*
https://github.com/riscv/riscv-opcodes/blob/master/extensions/unratified/rv_zvzip.

Co-Authored-By: wangboyao <wangboyao@bytedance.com>

---------

Co-authored-by: wangboyao <wangboyao@bytedance.com>
2026-03-11 14:22:02 +08:00
hanbeom
f2f5845f19
[WebAssembly][FastISel] Fold AND mask operations into ZExt load (#183743)
FastISel emits separate load and AND instructions for bitmasking.
(before) %1:i32 = LOAD_I32 %addr; %2:i32 = AND_I32 %1, 255

Fold AND masks into ZExt loads by verifying operands with
maskTrailingOnes. A getFoldedLoadOpcode wrapper is implemented
to manage dispatching logic for better extensibility.
(after) %1:i32 = LOAD8_U_I32 %addr

Fixed: https://github.com/llvm/llvm-project/issues/180783
2026-03-11 11:30:48 +09:00
Derek Schuff
e950a806f0
[WebAssembly] Look through freeze nodes when folding vector load + ext (#185143)
When folding loads with extensions, the extension operand can be a freeze node
in addition to a load. We can look through it to do the desirability check.

Fixes #184676
2026-03-10 19:15:53 -07:00
Craig Topper
53a2fd99aa
[DAGCombiner] Combine (fshl A, B, S) | (fshr C, D, BW-S) --> (fshl (A|C), (B|D), S) (#180889)
This is similar to the FSHL/FSHR handling in
hoistLogicOpWithSameOpcodeHands.
Here the opcodes aren't exactly the same, but the operations are
equivalent.

Fixes regressions from #180888
2026-03-10 18:53:40 -07:00
YunQiang Su
757a0f85c8
SelectionDAG: Use ISD::AssertNoFPClass for Load with nofpclass metadata (#184952)
1. Use ISD::AssertNoFPClass if LoadInst has !nofpclass metadata.
2. Strip ISD::AssertNoFPClass when try to combine load with bitcast
    in DAGCombiner::visitBITCAST.
2026-03-11 08:14:27 +08:00
yonghong-song
cf8833e4cc
[BPF] Fix CORE optimization bug in BPFMISimplifyPatchable (#183446)
Commit ffd57408efd4 ("[BPF] Enable relocation location for
load/store/shifts") enabled CORE relocation for load/store/shirts. In
particular, the commit did optimization to have load/store/shift insn
itself having the relocation. For the load and store, the optimization
has the following:
  rX = *(rY + <relocation>) and *(rX + <relocation>) = rY

There is no value-range check for the above '<relocation>'. For example,
if the original `<relocation>` is 0x10006 due to a large struct, the
insn encoding of `<relocaiton>` will be truncated into '6' and incorrect
result will happen.

This patch fixed the issue by checking the value range of
'<relocation>'. If the `<relocation>` is more than INT16_MAX,
optimization will be skipped.

Even llvm side is fixed, libbpf side may still have issues with the
current approach since libbpf may change the value of <relocation>. If
the <relocation> value is more than INT16_MAX, libbpf will either fail
or need to patch insns.

Let us say we have
  rX = *(rY + <relocation>) and *(rX + <relocation>) = rY

libbpf will modify `<relocation>` value depending on the actual offset
in kernel data structure. If `<relocation>` is more than INT16_MAX, more
than one insn will be necessary. llvm can add nop instructions for patch
purpose (see [1]).

The following are major patching cases:
  case 1: rX = *(rY + <relocation>) // rX and rY are different
    rX = <relocation>
    rX += rY
    rX = *(rX + 0)
  case 2: rX = *(rX + <relocation>)
    rX += <relocation>
    rX = *(rX + 0)
  case 3: *(rX + <relocation>) = imm
    rX += <relocation>
    *(rX + 0) = imm
    rX -= <relocation>
  case 4: *(rX + <relocation>) = rY // rX and rY are different
    rX += <relocation>
    *(rX + 0) = rY
    rX -= <relocation>
  case 5: *(rX + <relocation>) = rX
    // We are not able to resolve this issue.

A llvm option (-disable-bpf-core-optimization) is implemented to
disable bpf core optimizaiton, which means the relocation will not
be in load/store insns. This can workaround the above case 5.

[1] https://github.com/llvm/llvm-project/compare/main...yonghong-song:llvm-project:fix-core-overflow-debug
2026-03-10 16:42:57 -07:00
Sietze Riemersma
8d0c686c55
[HLSL][DXIL][SPIRV] Added WaveActiveBitOr HLSL intrinsic (#165156)
Adds the WaveActiveBitOr intrinsic from issue #99167. This intrinsic
required a bit more work than the last intrinsics that I have done.

There are some peculiarities, which I verified with dxcompiler:
- WaveActiveBitOr only works on uint and uint64_t, no other types are
allowed
- There is no 16 bit version of WaveActiveBitOr

Followed the checklist:
- [x] Implement WaveActiveBitOr clang builtin,
- [x] Link WaveActiveBitOr clang builtin with hlsl_intrinsics.h
- [x] Add sema checks for WaveActiveBitOr to
CheckHLSLBuiltinFunctionCall in SemaChecking.cpp
- [x] Add codegen for WaveActiveBitOr to EmitHLSLBuiltinExpr in
CGBuiltin.cpp
- [x] Add codegen tests to
clang/test/CodeGenHLSL/builtins/WaveActiveBitOr.hlsl
- [x] Add sema tests to
clang/test/SemaHLSL/BuiltIns/WaveActiveBitOr-errors.hlsl
- [x] Create the int_dx_WaveActiveBitOr intrinsic in
IntrinsicsDirectX.td
- [x] Create the DXILOpMapping of int_dx_WaveActiveBitOr to 120 in
DXIL.td
- [x] Create the WaveActiveBitOr.ll and WaveActiveBitOr_errors.ll tests
in llvm/test/CodeGen/DirectX/
- [x] Create the int_spv_WaveActiveBitOr intrinsic in IntrinsicsSPIRV.td
- [x] In SPIRVInstructionSelector.cpp create the WaveActiveBitOr
lowering and map it to int_spv_WaveActiveBitOr in
SPIRVInstructionSelector::selectIntrinsic.
- [x] Create SPIR-V backend test case in
llvm/test/CodeGen/SPIRV/hlsl-intrinsics/WaveActiveBitOr.ll

offload test: https://github.com/llvm/offload-test-suite/pull/487
2026-03-10 18:30:37 -04:00
Deric C.
9d65b65a9a
[HLSL][Matrix] Add half type overloads to mul and exercise them (#185506)
PR #184882 was missing `half` type-specific overloads for `mul`. 
This PR introduces `half` type-specific overloads for `mul` and
additional codegen tests for the half type.
Also added f16 tests for the lowering of llvm.matrix.multiply.

The offload test suite already has a `mul.fp16` test for exercising half
types at runtime, so no change is needed there.

Assisted-by: claude-opus-4.6
2026-03-10 15:11:10 -07:00
Craig Topper
a4244bcc1c
[LegalizeTypes] Emit FSHL/FSHR from ExpandShiftByConstant when Legal. (#180888)
This avoids needing to combine the SHL/SHR/OR pattern later.
    
This improves code quality on RISC-V where our slx/srx instructions
clobber the destination register but we don't have an immediate form.
We can't recover the original direction from the SHL/SHR/OR pattern
and we can't commute it during the TwoAddressInstruction pass like X86
due to the shift amount being in a register.
2026-03-10 15:04:37 -07:00
Aiden Grossman
67094a4e64
[X86] Fix assertion when lowering FP_ROUND (#185562)
443ce5569ee9854cfef1139cf6b9cf05165e0902 caused us to start hitting
assertions with non-standard vector widths (<3 x float>) in this case
now that node types are actually enforced. There was a place in
X86ISelLowering.cpp where we just passed along a 64-bit integer whereas
other places constructing a CVTPS2PH node specifically construct a new
integer.
2026-03-10 21:24:48 +00:00
Syadus Sefat
b50cf35d57
[AMDGPU][GlobalIsel] Add register bank legalization rules for amdgcn atomic fminmax num (#184564)
This patch adds register bank legalization rules for amdgcn global/flat
atomic fmin/fmax num operations in the AMDGPU GlobalISel pipeline.
2026-03-10 14:53:32 -05:00
Diego Novillo
79c9dadc0f
[SPIR-V] Add lowering for G_FPOWI (#185454)
This fixes an assertion I was hitting in the fragment density map sample
in Vulkan Samples. In starfield.frag.hlsl, we have

float starCol = pow((rnd - threshhold) / (1.0 - threshhold), 16.0);

The optimizer recognizes 16.0 as a whole number and converts the call to
`llvm.powi`. The backend goes on to fail with:

fatal error: error in backend: cannot select: %46:fid(s64) = nnan ninf
nsz arcp afn reassoc G_FPOWI %44:fid, %45:iid(s64) (in function:
_Z9starFieldDv3_f)

On Vulkan, there is no integer-exponent for pow. This patch lowers it by
converting the exponent to float and calling GLSL.std.450's Pow.

---------

Co-authored-by: Steven Perron <stevenperron@google.com>
2026-03-10 15:34:36 -04:00
ambergorzynski
30f13b12a0
[AMDGPU] New test for untested line in AMDGPUMarkLastScratchLoad (#185430)
[This
line](af15474262/llvm/lib/Target/AMDGPU/AMDGPUMarkLastScratchLoad.cpp (L121))
in the AMDGPU backend is uncovered by the existing test suite (checked
using coverage, and by asserting that no tests in the existing test
suite fails if we insert an `abort()` at this line).

We propose a test that covers this line. We demonstrate the test by
inserting an `abort()` at that line in commit
[#3cb65cf](3cb65cf445).
Running all tests shows that only our proposed test fails in the
presence of the abort. We'll remove the abort before merging.

This is the only test that fails in the presence of the abort (our new
test) -- it will pass once we remove the abort:
`CodeGen/AMDGPU/mark-last-scratch-load.ll`
2026-03-10 20:04:02 +01:00
eleviant
52be4b696d
[AArch64][PAC] Don't skip global legalization for AUTH_TCRETURN (#182513)
The 77bcab835aca1 folds llvm.ptrauth.resign intrinsic in case intrinsic
discriminant and key match those in call ptrauth bundle. However
assertion is now fired in AArch64AsmPrinter when PAC is enabled and
we're tail calling a global, because AUTH_TCRETURN expects address to be
stored in register.
2026-03-10 19:21:21 +01:00
Fangrui Song
961e25144f
[X86] Accept 'a' modifier for 'p' constraint in inline asm (#185590)
GCC supports the %a modifier with the p constraint (e.g., %a0), while
Clang rejected it. The 'a' modifier means "print as address", which on
a 'p' constraint memory operand is what the default path already does.

Like GCC, reject 'a' with other memory constraints (e.g. 'm').

Close https://github.com/llvm/llvm-project/issues/185343
2026-03-10 17:55:59 +00:00
Paul Walker
084aa5a672
[LLVM][CodeGen][SVE] Implement isel for maximumnum/minimumnum. (#185074)
Patch to add custom lowering for FCANONICALIZE, FMAXNUM_IEEE, and
FMINNUM_IEEE, all of which are required when relying on default
expansion of FMAXIMUMNUM and FMINIMUMNUM.
    
The lowering is very simple because AArch64's FMAXNM and FMINNM
instructions are IEEE754-2008 compliant, with the implementation
effectively follow the same path take for NEON.

NOTE: Bfloat support will be provided separately.
2026-03-10 14:46:43 +00:00
Jonas Paulsson
56a4315ee0
[SystemZ] Add a SystemZ specific pre-RA scheduling strategy. (#135076)
This is a relatively simple strategy as it is omitting any heuristics for
liveness and register pressure reduction. This works well as the SystemZ ISel
scheduler is using Sched::RegPressure which gives a good input order to begin
with.

It is trying harder with biasing phys regs than GenericScheduler as it also
considers other instructions such as immediate loads directly into phys-regs
produced by the register coalescer. This can hopefully be refactored into 
MachineScheduler.cpp.

It has a latency heuristic that is slightly different from the one in
GenericScheduler: It is activated for a specific type of region that have
many "data sequences" consisting of SUs connected only with a single
data-edge that are next to each other in the input order. This is only 3% of
all the scheduling regions, but when activated it is applied on all the
candidates (not just once per cycle). At the same time it is a bit more
careful by checking not only the SU Height against the scheduled latency but
also its Depth against the remaining latency.

It reuses the GenericScheduler handling of weak edges to help copy
coalescing.

It also helps with compare zero elimination as it tries to put a CC-defining
instruction that produces the compare source value above the compare before
any other instruction clobbering CC or the value.

This work was started after observing heavy spilling in Cactus, which was
actually *caused* by GenericScheduler - disabling it (no pre-RA scheduling)
remedied it and gave a 7% improvement in performance on that benchmark. Many
different versions have been tried which has evolved into this initial
simplistic MachineSchedStrategy that does relatively little and yet achieves
double-digit improvements on Cactus and Imagick compared to GenericSched
(which is OTOH 3% better on Blender). There will hopefully be more
improvements added later on as there seems to be potential for it.

It would be very interesting to have other OOO targets try this as well and
perhaps make this available in MachineScheduler.cpp

(A first attempt with improving the pre-RA scheduling was made with #90181,
which however did not materialize in anything actually useful.)
2026-03-10 15:38:05 +01:00
Arseniy Obolenskiy
2133002b8f
[AMDGPU] Poison invalid globals after emitting error in LowerBufferFatPointers pass (#184662)
After the change from `report_fatal_error` to `Ctx.emitError` in #142014
there is a necessity to remove unsupported globals. Otherwise there is a
secondary crash during ISel when processing them

Fixes SWDEV-511241
2026-03-10 15:35:27 +01:00
Brian Cain
4fffee0375
[Hexagon] Fix 64-bit funnel shift miscompilation with register shift amounts (#183669)
64-bit regpair shift amounts are treated as signed 7-bits, so a
complement
shift amount of 64 (when the primary amount is 0) is sign-extended to
-64,
reversing the shift direction and producing incorrect results. This
affected
any 64-bit rotate or funnel shift where the runtime shift amount could
be 0
(making the complement 64) or >= 64.
    
Fix by masking the shift amount to [0, 63] and computing the complement
as
(m - 64), which is always in [-64, -1]. Using lsl/lsr (logical shift)
instructions with this negative amount causes the hardware to reverse
the
shift direction while zero-filling vacated positions:
    
fshl(a, b, amt) = (a << m) | lsl(b, m - 64) // lsl reverses to lsr
fshr(a, b, amt) = (b >> m) | lsr(a, m - 64) // lsr reverses to lsl
    
where m = amt & 63. The logical shift instructions (lsl/lsr) are used
instead of arithmetic (asl) because asl with a negative amount performs
an
arithmetic right shift that sign-extends, which would corrupt the result
for negative source values.
    
When m = 0, the complement amount is -64 (magnitude 64), which shifts
all
64 bits out and produces zero, so the complement term vanishes as
required.
2026-03-10 09:16:46 -05:00
Yaxun (Sam) Liu
1813603933
[AMDGPU] Fix GFX1250 hazard: S_SET_VGPR_MSB dropped (#184904)
[AMDGPU] Fix GFX1250 hazard: S_SET_VGPR_MSB dropped after
S_SETREG_IMM32_B32 (MODE)

On GFX1250, S_SET_VGPR_MSB immediately after S_SETREG_IMM32_B32
targeting
the MODE register is silently dropped by hardware.

AMDGPULowerVGPREncoding may insert S_SET_VGPR_MSB after a setreg(MODE)
in
Case 2 (size > 12) when imm32[12:19] doesn't match current VGPR MSBs, or
when the next VALU instruction needs different MSBs. Fix by inserting
S_NOP
between the setreg and S_SET_VGPR_MSB to prevent the hazard.

The fix handles two scenarios:
- Case 2 mismatch: S_NOP is inserted directly before S_SET_VGPR_MSB in
  handleSetregMode.
- Case 2 match followed by a VALU with different MSBs: a flag
  (NeedNopBeforeSetVGPRMSB) is set, and setMode inserts S_NOP before the
  next S_SET_VGPR_MSB.

Also adds vcmpx-permlane-vgpr-msb-gfx1250.mir to verify that VGPR
lowering
must run after the hazard recognizer: fixVcmpxPermlaneHazards creates
V_MOV_B32 using high VGPRs that need correct S_SET_VGPR_MSB from the
lowering pass.
2026-03-10 09:35:45 -04:00
Matt Arsenault
278dba37d0
AMDGPU: Fix dead checks in test (#185613) 2026-03-10 11:20:04 +00:00
Dmitry Sidorov
19a5a3536e
[SPIR-V] Add overload of getConstraintType for inline asm lowering (#185422)
Without the overload constrain lowering would go with a default path
which would later result in a crash in case if for example AMDGPU asm is
inlined (for example v_ would be Unknown).

Overload sets ConstraintType to be always RegClass for SPIR-V.
2026-03-10 12:09:26 +01:00
Simon Pilgrim
5e4f1e7b48
[X86] Add i128 funnel shift coverage to match i256/i512 tests (#185612) 2026-03-10 10:47:51 +00:00
Simon Pilgrim
04abe44524
[X86] Enable i256 fshl/fshr lowering on avx512 targets (#185455)
If freely foldable to vector, concat the i256 halves as v4i64 -> v8i64 and use the existing i512 shift lowering

Part of #184828
2026-03-10 10:08:02 +00:00
Ramkumar Ramachandra
c1f3cb73a0
[RISCV] Make zvknha a subset of zvknhb (#178680)
zvknha is a strict subset of zvknhb. Treat it as such.

Ref:
https://github.com/riscv/riscv-isa-manual/blob/main/src/vector-crypto.adoc#zvknh
2026-03-10 08:40:49 +00:00
Fangrui Song
c889454f1d
[MC] Rename PrivateGlobalPrefix to InternalSymbolPrefix. NFC (#185164)
The "private global" terminology, likely came from
llvm/lib/IR/Mangler.cpp, is misleading: "private" is the opposite of
"global", and these prefixed symbols are not global in the object file
format sense (e.g. ELF has STB_GLOBAL while these symbols are always
STB_LOCAL). The term "internal symbol" better describes their purpose:
symbols for internal use by compilers and assemblers, not meant to be
visible externally.

This rename is a step toward adopting the "internal symbol prefix"
terminology agreed with GNU as
(https://sourceware.org/pipermail/binutils/2026-March/148448.html).
2026-03-10 01:03:27 -07:00
Matt Arsenault
8ec961e1a9
Reapply "AMDGPU: Annotate group size ABI loads with range metadata (#185420)" (#185588)
This reverts commit d5685ac6db0ae4cbca1745f18d8f2f7dc7d673a5.

Fix off by one error. The end of the range is open.
2026-03-10 07:41:26 +00:00
Aaron Smull
a682073ae7
Fixing upper lane return source for X86 intrinsics (#185329)
Closes https://github.com/llvm/llvm-project/issues/184245
2026-03-10 14:58:54 +08:00
paperchalice
a266f60ddf
[SelectionDAG] Remove NoNaNsFPMath uses (#183448)
This pr removes the rest uses in LLVMCodeGen.
2026-03-10 14:06:42 +08:00
Jim Lin
48473ddcc7
[RISCV] Handle sign_extend of i32 in insert_vector_elt for RV32 (#185548)
On RV32 with <N x i64> vectors, inserting a value that is a
sign_extend of an i32 only uses the lower 32 bits, so it can be
lowered without scalar legalization, same as i32 constants.
2026-03-10 13:12:55 +08:00
Sietze Riemersma
5464d68290
[HLSL][DXIL][SPRIV] Added WaveActiveProduct intrinsic (#184645)
From issue #99165, adds the implementation of WaveActiveProduct. This
time with the new types for SPIRVTypeInst

- [x] Implement WaveActiveProduct clang builtin,
- [x] Link WaveActiveProduct clang builtin with hlsl_intrinsics.h
- [x] Add sema checks for WaveActiveProduct to
CheckHLSLBuiltinFunctionCall in SemaChecking.cpp
- [x] Add codegen for WaveActiveProduct to EmitHLSLBuiltinExpr in
CGBuiltin.cpp
- [x] Add codegen tests to
clang/test/CodeGenHLSL/builtins/WaveActiveProduct.hlsl
- [x] Add sema tests to
clang/test/SemaHLSL/BuiltIns/WaveActiveProduct-errors.hlsl
- [x] Create the int_dx_WaveActiveProduct intrinsic in
IntrinsicsDirectX.td
- [x] Create the DXILOpMapping of int_dx_WaveActiveProduct to 119 in
DXIL.td
- [x] Create the WaveActiveProduct.ll and WaveActiveProduct_errors.ll
tests in llvm/test/CodeGen/DirectX/
- [x] Create the int_spv_WaveActiveProduct intrinsic in
IntrinsicsSPIRV.td
- [x] In SPIRVInstructionSelector.cpp create the WaveActiveProduct
lowering and map it to int_spv_WaveActiveProduct in
SPIRVInstructionSelector::selectIntrinsic.
- [x] Create SPIR-V backend test case in
llvm/test/CodeGen/SPIRV/hlsl-intrinsics/WaveActiveProduct.ll
2026-03-10 00:48:40 -04:00
Craig Topper
cf2d59925c
[RISCV] Make Zbc imply Zbkc. (#185543)
Zbkc contains 2 of the 3 instructions from Zbc. Making Zbc imply Zbkc
will make the __riscv_zbkc define be set when Zbc is enabled.

This does not change the diagnostics printed by the assembler.

There's a PR to add this rule to the ISA manual too
https://github.com/riscv/riscv-isa-manual/pull/2524
2026-03-09 21:29:39 -07:00
Luo Yuanke
41ef3d083a
[FastISel] Lower call instruction with illegal type returned (#180322)
Fix issue https://github.com/llvm/llvm-project/issues/179100
When lowering the call instruction with illegal type returned, we should
bail out and transfer the lowering to DAG. Otherwise the return value is
not promoted to proper type, but DAG would assume it has been promoted.

---------

Co-authored-by: Yuanke Luo <ykluo@birentech.com>
2026-03-10 11:56:31 +08:00
Brandon Wu
351d900e6c
[llvm][RISCV] Use zilsd for callee-saved register spill/restore on RV32 (#184794)
When the Zilsd extension is enabled on RV32, use SD_RV32/LD_RV32
instructions to spill and restore pairs of callee-saved GPRs instead of
saving 2 separate 32 bit data.
Note that we need to ensure stack slot to be aligned.
2026-03-10 03:17:35 +00:00
Matt Arsenault
3545e51093
Revert "AMDGPU: Annotate group size ABI loads with range metadata (#185420)" (#185521)
This reverts commit 76daf31b4000623d5c9548348a859ea3ed8712e1.

Bot failure.
2026-03-10 01:04:02 +00:00
AbdallahRashed
367569e667
[SelectionDAG] Use ExpandIntRes_CLMUL to expand vector CLMUL via narrower legal types (#184468)
Reuse the ExpandIntRes_CLMUL identity to expand vector
CLMUL/CLMULR/CLMULH on wider element types (vXi16, vXi32, vXi64) by
decomposing into half-element-width operations that eventually reach a
legal CLMUL type.

Three generic strategies in expandCLMUL:
1. Halve: halve element width (e.g. v8i16 -> v8i8 on AArch64)
2. promote to double : zext to wider type if CLMUL is legal there (e.g.
x86)
3. Count widen: pad with undef to double element count (e.g. v4i16 ->
v8i16)

A helper canNarrowCLMULToLegal() guides strategy selection and prevents
circular expansion in the CLMULH bitreverse path.

Also add Custom BITREVERSE lowering for v4i16/v8i16 on AArch64 using
REV16+RBIT, which the CLMULH expansion relies on.

Fixes #183768
2026-03-09 23:21:44 +00:00
Derek Schuff
1324ea1b22
[WebAssembly] Fold any/alltrue SIMD boolean reductions with eqz (#184704)
Existing ISel patterns match setne/seteq following SIMD boolean reductions
any_true and all_true, and drop the ones that are redundant (because the
reductions always return 1 or 0). This adds patterns to also produce eqz
instructions instead of a comparison with a const.
2026-03-09 22:54:25 +00:00
Daniel Paoliello
90978e484f
[arm64ec] Fix missing sret return in Arm64EC entry thunks for large struct returns (#185452)
When an Arm64EC function returns a struct by value that is too large for
x64's `RAX` (>8 bytes), the entry thunk synthesizes a hidden sret
pointer parameter for the x64 side. However, this
parameter was never marked with the sret attribute, so ISel did not copy
its value into `x8` (the Arm64EC mapping of `RAX`) on return. This
caused the x64 caller to see a garbage pointer in `RAX` instead of the
return buffer address.

The change adds the sret attribute to the thunk's synthesized pointer
parameter, so that `LowerFormalArguments` saves it and `LowerReturn`
restores it to `x8` before the tail call to `__os_arm64x_dispatch_ret`.

Fixes #185390
2026-03-09 14:33:45 -07:00
David Green
13f523867e [AArch64][GlobalISel] Add test coverage to movi64_sve.ll. NFC 2026-03-09 21:32:58 +00:00
Aiden Grossman
91ef9274ec [CodeGen] Fix 4f094816ef7d2811b36ee328bac3b418dfd021cc
Missed fixing some stuff up due to files still being left around in my
build directory.
2026-03-09 20:44:49 +00:00
Aiden Grossman
4f094816ef [CodeGen] Fix prefetch-targets-error.mir
\#184194 introduced this test which was failing in some configurations
as it would try and write output to the test directory by having
incorrectly specified -o flags.
2026-03-09 20:36:03 +00:00
Rahman Lavaee
3e2069d128 Fix https://lab.llvm.org/buildbot/#/builders/154/builds/28782 2026-03-09 19:59:53 +00:00
Rahman Lavaee
4aa1f211ca
Centralize prefetch target storage in MachineFunction. (#184194)
### Prefetch Symbol Resolution

Based on this
[suggestion](https://discourse.llvm.org/t/rfc-code-prefetch-insertion/88668/29?u=rlavaee),
we must identify if a prefetch target is defined in the current module
to avoid **undefined symbol errors**. Since this occurs during
sequential **CodeGen**, we must rely on function names rather than IR
Module APIs.

**Key Changes:**
* **`MachineFunction` Integration:** Added a `PrefetchTargets` field
(with serialization) to track all targets associated with a function.
* **Guaranteed Emission:** All prefetch targets are now emitted
regardless of basic block or callsite index matches to ensure the symbol
exists.
* **Fallback Placement:** Targets with non-matching callsite indices are
emitted at the end of the block to resolve the reference.
2026-03-09 12:15:38 -07:00
Lukacma
66137feee6
[AArch64] Add partial reduce patterns for new fdot instructions (#184659)
This patch enables generation of new dot instruction added in under
FEAT_F16F32DOT from partial reduce nodes.
2026-03-09 18:44:55 +00:00
Matt Arsenault
76daf31b40
AMDGPU: Annotate group size ABI loads with range metadata (#185420)
We previously did the same for the grid size when annotated.
The group size is easier, so it's weird that this wasn't implemented
first.
2026-03-09 19:11:59 +01:00
Maryam Moghadas
f7a48fbefa
[PowerPC] Add AMO load with Compare and Swap Not Equal (#178061)
This commit adds support for lwat/ldat atomic operations with function
code 16 (Compare and Swap Not Equal) via 4 clang builtins:

__builtin_amo_lwat_csne for 32-bit unsigned operations 
__builtin_amo_ldat_csne for 64-bit unsigned operations
 __builtin_amo_lwat_csne_s for 32-bit signed operations 
__builtin_amo_ldat_csne_s for 64-bit signed operations
2026-03-09 13:50:08 -04:00
Kai Nacke
7fd291b400
[GOFF] Set reference to ADA (#179734)
Function symbols must have a reference to the ADA, because this becomes
the value of the r5 register when the function is called. Simply get the
value from the begin symbol of the section.
2026-03-09 13:31:05 -04:00