Commit graph

294 commits

Author SHA1 Message Date
陈子昂
33c7ef4a63
[Clang][RISCV] Add packed pair byte intrinsics (#212589)
Add the 32-bit byte forms and the 64-bit byte/halfword forms of the
P-extension packed pair intrinsics to riscv_packed_simd.h using generic
shufflevector IR.

Extend the existing packed pair shuffle lowering to recognize the mixed
even/odd forms and select ppaireo/ppairoe in addition to ppaire/ppairo.

Add Clang CodeGen, LLVM CodeGen, and intrinsic header tests for the new
forms.
2026-07-30 02:24:02 +08:00
Matt Arsenault
1ad3b9eff9
cross-project-tests: Migrate amdgpu tests to use subarch triples (#210115) 2026-07-24 17:38:34 +02:00
TelGome
58cebee609
[RISCV][P-ext] Support Packed "Q-format" Multiplication (#211236) 2026-07-23 17:15:50 +08:00
Ben Dunbobbin
49d568a8d6
[DTLTO] Forward loop interchange to DTLTO remote compilations (#208591)
Recent upstream LLVM changes enabled `LoopInterchangePass` by default
through `PipelineTuningOptions`. TLTO observes that state directly from
the LTO config, but DTLTO was not forwarding the equivalent Clang option
to the remote compiler. As a result, TLTO could run loop interchange
pass while DTLTO did not, producing codegen differences for
configurations that exposed profitable/legally interchangeable loops.
Note that this was a pre-existing issue, the change in default has
simply exposed it.

Forward `C.PTO.LoopInterchange` as `-floop-interchange` when
constructing the common DTLTO remote compiler options. Extend the
testing to check that the SN-DBS remote command line includes the
forwarded option.

The code for forwarding such options is only intended as a temporary
measure. A more comprehensive solution is in discussion here:
https://discourse.llvm.org/t/synchronizing-lto-code-generation-configuration-between-clang-and-lld-dtlto
2026-07-21 19:27:15 +01:00
Hongyu Chen
b9b454166e
[RISCV][P-ext] Generalize lowerVECTOR_SHUFFLEAsRV32PNarrowingShift (#210522)
The previous implementation only matches
`shuffle(extract_subvector(src), extract_subvector(src), mask)`.
This patch generalizes it to `shuffle(a, b, mask)`, so we can now lower
it to `PNSRL(concat(a,b), element_bits)` if it is a deinterleave
shuffle. And we use `foldConcatVector` to handle the original pattern
with `extract_subvector`.
2026-07-20 08:51:25 +00:00
TelGome
5497f466e4
[RISCV][P-ext] Support Packed Narrowing Zip (#210040) 2026-07-20 10:35:49 +08:00
陈子昂
f6d9ec41d3
[RISCV] Add packed narrowing convert intrinsics (#210389)
Add RISC-V P-extension packed narrowing convert header APIs for `pncvt`
and `pncvth`.

The new APIs lower through generic IR: RV32 uses truncate / logical
shift plus truncate forms, while RV64 uses existing packed unzip shuffle
forms. This reuses the existing backend lowering and TableGen aliases
rather than adding intrinsic-specific lowering.

Tests cover Clang IR generation and cross-project header assembly checks
for RV32/RV64 spec-listed mnemonics.
2026-07-18 22:39:38 +08:00
Hongyu Chen
714d124d0a
Revert "[RISCV][P-ext][NFC] Add cross-project tests for packed zip/unzip intrinsics" (#210401)
Reverts llvm/llvm-project#209575
2026-07-17 18:47:55 +00:00
Hongyu Chen
60846c8b0c
[RISCV][P-ext][NFC] Add cross-project tests for packed zip/unzip intrinsics (#209575) 2026-07-18 00:18:34 +08:00
Ben Dunbobbin
c012610ab9
[DTLTO] Add remote compiler option forwarding coverage (#208589)
Add a cross-project DTLTO test that checks the existing LTO
configuration state serialized into the remote Clang command line. The
test uses the validate.py distributor to inspect the generated DTLTO
JSON.

Cover all the existing forwarded options.

Add paired negative checks for optional flags so the test also verifies
they are not emitted when the corresponding configuration state is not
set.
2026-07-16 09:56:40 +01:00
Ben Dunbobbin
12ce00a865
[DTLTO] terminology - use extract rather than serialize (#208468)
Change the terminology used for DTLTO from "serialization" to
"extraction" for improved clarity.

Update the DTLTO time-trace scope and tests to match the new wording,
and rename/update related LLD and cross-project DTLTO cache tests.

I have also improved some unrelated wording in the comments and removed
a redundant comment block from the DTLTO class comment.

This terminology improvement was agreed in
https://github.com/llvm/llvm-project/pull/204104. Note that the
documentation already uses this terminology, see:
https://llvm.org/docs/DTLTO.html.
2026-07-14 13:29:27 +01:00
SiHuaN
ada4f7cffc
[RISCV][P-ext] Improve RV64 v2i16 reverse codegen (#208664)
On RV64, v2i16 is widened to v4i16 before shuffle lowering. Recognize
the widened low-half reverse and select ppairoe.h directly instead of
rev16 followed by srli.
2026-07-13 22:22:38 +08:00
陈子昂
af812fc18a
[Clang][RISCV][P-ext] Support packed widening convert intrinsics (#208394)
This patch implements all packed widening convert intrinsics using
general vector operations. Low widening conversions use
`__builtin_convertvector`, while high-half conversions use general
shuffles.

The generated code for high-half conversions is correct but not yet
optimal.
2026-07-12 17:39:47 +08:00
Hongyu Chen
88d548a2b9
[RISCV][P-ext][NFC] Add tests for packed reverse intrinsics (#208484) 2026-07-10 00:37:31 +08:00
TelGome
2df2a51c75
[RISCV][P-ext] Support Packed Saturating Absolute Value. (#207978) 2026-07-09 10:10:29 +08:00
SiHuaN
35678db1b4
[Clang][RISCV] packed absolute difference sum intrinsics (#207936)
Add the __riscv_pabdsumu/pabdsumau_* header wrappers over new
__builtin_riscv_* builtins, lowering to the
llvm.riscv.pabdsumu/pabdsumau intrinsics.
2026-07-08 16:40:13 +08:00
TelGome
29fa6a8247
[RISCV][P-ext] Support Packed Merge. (#207110) 2026-07-06 09:29:30 +08:00
Stephen Tozer
17e7497629
[Dexter] Switch to using script-mode by default (#204369)
This patch changes the default mode of Dexter from heuristic-mode to
script-mode. The --use-script argument is replaced with --use-heuristic,
some comments/docs/error messages are updated accordingly, and tests
have their flags switched accordingly.
2026-07-03 09:19:30 +01:00
Stephen Tozer
2870ebbcb5
[CrossProjectTests] Fixup expect in ctor.cpp to accept multiple steps (#207337)
In the test `ctor.cpp`, Dexter tests that when we step into the
constructor used in the test, the value of `this` isn't irretrievable.
To protect against a rotten pass it also checked that we stepped once,
but this caused failures on some platforms where we would step twice on
the constructor - this patch resolves the issue by accepting any
non-zero value for the number of steps.
2026-07-03 08:51:22 +01:00
Stephen Tozer
db5740f1a6
[Dexter] Update lldb-based dexter-tests to use script-mode (#204367)
This patch replaces uses of heuristic-mode Dexter in the dexter-tests
suite with uses of the script-mode, for tests that use DAP (via
lldb-dap). The updates are largely straightforward but occasionally
non-trivial, and in some cases some slight modifications have been made
to keep the "spirit" of the test intact.
2026-07-02 19:27:35 +01:00
Stephen Tozer
cb54896ff4
[Dexter] Add additional variable metrics, sanitize lldb-dap function names (#204366)
This patch makes some required changes prior to switching over to using
the script model by default, to keep the tests in `dexter-tests` working
and meaningful.

In addition to the existing metrics, we split the "missing_vars" metric
into 3 - adding "irretrievable" and "optimized_out", so that we can
specifically test those properties in the output.

We also add some function name sanitizing to lldb-dap, to account for
the fact that some function names get presented with a suffix " [opt]",
which causes the script to fail.
2026-07-02 18:26:58 +01:00
Stephen Tozer
b43a0db74e
[Dexter] Document the structured script model (#204365)
This patch adds documentation for the script model to the Dexter README,
shunting heuristic-mode information into a separate doc, creating a new
doc for script-mode, and linking to both (with a brief summary of the
differences) from the base README.
2026-07-02 17:56:11 +01:00
Stephen Tozer
142d555b62
[Dexter] Add ability to check float values within a range (#204161)
Adds a new node type, !float, which can be used to match debugger ouptut
as
float values rather than as strings, optionally allowing a range to be
specified for inexact matches. This new node allows a list of values to
be
given, effectively a shorthand for a list of individual !float nodes.
2026-07-02 16:13:33 +01:00
Stephen Tozer
938751d785
[Dexter] Allow matching lists of values for aggregate members (#204160)
This patch slightly extends the matching of aggregate members to allow
for lists of expected values for individual functioning the same as
lists of expected values for scalar values. This is accomplished by
recursively calling `get_expect_match` instead of `DebuggerExpectMatch`,
which contains logic for matching against all possible expected values
and selecting the best match (and committing any associated context
changes, e.g. modified address labels).
2026-07-02 13:12:05 +01:00
Stephen Tozer
9db1a29384
[Dexter] Add !type and !type/all nodes to test variable types (#204159)
This patch adds the second kind of variable expect, !type, which tests
the type of a variable as reported by the debugger. As with !value, this
is a string comparison of the debugger output with the script expected
value - this means that even if two types are identical (e.g. typedef),
a !type node will only match the one that the debugger displays by
default.

Script writing and aggregates work the same for !type as for !value, and
the metrics reported are largely similar, with the exception that
"unexpected", "seen", and "missing" metrics are reported separately for
values and types.
2026-07-02 10:35:38 +01:00
Stephen Tozer
41f826f54c
[Dexter] Add condition check to state nodes (#203847)
This patch enables the ability for state nodes to check conditions,
meaning they will be active only if the condition is met.

Condition evaluation is somewhat language specific; we directly check
whether the value of the evaluated expression is "true"
(case-insensitive), which works for the languages we actually use Dexter
with, but may require generalizing in future.

We also cache conditions as they are evaluated; each time we step, we
clear all cached conditions for the current frame and any expired
frames, but we keep the cached conditions for any frames rootwards from
the current frame; this prevents us from unexpectedly exiting out of a
callee frame because of debug info not surviving a stack unwind; if the
early exit is desired, an !and{at_frame_idx, condition} under the lower
frame may suffice.
2026-07-01 15:11:17 +01:00
Stephen Tozer
19f4c9913d
[Dexter] Enable after_hit_count for state nodes (#203846)
The after_hit_count attribute for a state node causes it to become
active only after it would have become active N times. This uses the
existing logic for incrementing hit counts, i.e. after the node becomes
"active", we will not add another hit count until it stops being active
for at least one step. Since state nodes with after_hit_count do not
become active before reaching the required hit count, this requires us
to keep track of an "early" set of state nodes, meaning nodes that would
be active if not for their after_hit_count.
2026-07-01 14:20:41 +01:00
Stephen Tozer
3b44af9503
[Dexter] Add support for writing !step values (#203845)
Following from the previous patch, this patch adds support to Dexter for
generating expected values for !step nodes. This is relatively limited:
the kind of !step which this is most well-suited to this is !step
exactly, as the !step order of ignoring extra lines is redundant (all
lines are added as expected values), and !step never can't know what
lines could have been stepped on but weren't without some extra work
(e.g. finding viable breakpoint locations in the enclosing state node).
2026-07-01 12:38:34 +01:00
Stephen Tozer
f9ddebc5c6
[Dexter] Add !step node for testing stepping behaviour (#203844)
This patch adds a node for generating metrics based on lines stepped on.
The new node has 3 versions: !step exactly, !step order, and !step
never, which check an expected list of line numbers against the actual
line numbers seen while the expect is active. "exactly" and "order" both
check that the list of line numbers appear in-order in the debugger
while the expect is in scope; "exactly" treats any seen line numbers
outside of this list as incorrect, while "order" ignores them. "never"
does not have an order, but treats any line numbers from the list that
are seen in the debugger as being incorrect.
2026-07-01 11:14:46 +01:00
Stephen Tozer
7f73dd43b1
[Dexter] Add at_frame_idx to check values in frames above current (#203505)
This patch adds a new attribute for !and nodes, `at_frame_idx`, which
matches against frames above its parent node; for example, in the
script:

```
!where {function: foo}:
  !where {function: bar}:
    !and {at_frame_idx: 1}:
      !value x: 0
```

The `!value x` node checks the value of 'x' in 'foo' while the debugger
is inside 'bar'. Use of this attribute comes with some restrictions: a
!where node can never be nested under a !and{at_frame_idx} node, and
neither can another !and{at_frame_idx} node.
2026-07-01 09:27:47 +01:00
Stephen Tozer
0bd538ad4c
[Dexter] Add for_hit_count for state nodes (#203359)
This patch adds the ability for state nodes to use a `for_hit_count:
<int>` field to limit the number of times that a given state node will
be active.

The hit count for each state node increments each time it is _entered_,
meaning it must be inactive (not matching any frame on the stack) in the
prior step; for example, if a `!where {lines}` node covers the entirety
of a loop, repeated iterations of that loop will not increment the
hit_count - only once the line range is existed and entered again will
the hit_count increment.
2026-06-30 20:56:02 +01:00
Stephen Tozer
242d4b60fe
[Dexter] Write expects for variables in Debugger scopes (#203254)
Following on from the previous patch, this patch adds support for
writing expects from !value/all nodes, generating separate expects for
each variable in the requested debugger scope, for each continuous range
of lines it is live for.

NB: As with the other patch that implements script-writing features,
each test in this patch has a corresponding "expected" file, which is
almost identical (including the `RUN` lines), and exists to be `diff`'d
against the output of Dexter's script generation.
2026-06-30 19:56:47 +01:00
Stephen Tozer
ede433bf09
[Dexter] Allow fetching "scopes" from the debugger (#202802)
To further improve Dexter's script writing ability, this patch starts
implementing the ability for Dexter to fetch all variables with in a
given "scope", as defined by the DAP "scopes" request. This allows the
test to collect all available variables without needing to specify them
explicitly in the script, aiding in fast script
generation/re-generation.

This patch does not add any script-writing functionality, but adds the
!value/all Node, which fetches all variable values from the given scope,
and enables fetching these values from DAP-based debuggers.
2026-06-30 18:56:30 +01:00
Stephen Tozer
19a0860da1
Reapply "[Dexter] Add rewriting for aggregate variables (#202800)" (#206535)
This reverts commit 5bf495456b9898c45c437b8dadae21417d04a9a5.

Reapply the original patch after the underlying issue was fixed in PR
#206732.
2026-06-30 16:55:06 +01:00
Stephen Tozer
57414efcaa
[Dexter] Avoid incorrect state matching against frames below main (#206732)
This patch fixes an error that caused some Dexter test failures, driven
by two separate causes. The first issue is that frames below main were
appearing in the program stacktrace; while Dexter tries to filter frames
below main during the stacktrace collection step based on a pre-written
list, this list may not be comprehensive enough, as the symbol
"___lldb_unnamed_symbol_2a150" has also appeared. In order to guard
against this and future cases that might appear, this patch adds a check
to Dexter for "presentationHint: deemphasize" in the DAP response; this
is added by LLDB (and other dap-based debuggers) as a hint that the
frame is not user source, and should be a generally useful way of
avoiding evaluating frames that are not wanted.

The second issue is a mismatch between the breakpoint-setting logic and
the state-matching logic: the former allows root !where nodes to omit
the "file" field, using the script file as a default file. The state
matching logic does not perform any checking for an omitted file.
Together, this means that we may correctly set breakpoints for e.g.
"test.cpp:10", but when we go to match against frames, the !where node
may match against some other line-10 that appears below (e.g. as a
caller of) the frame at test.cpp:10. This patch copies the default_file
logic to state matching, meaning that we will only match against the
intended frame.
2026-06-30 15:57:48 +01:00
Stephen Tozer
6befe13812
[Dexter] Require lldb-dap for Dexter and log when Dexter is disabled (#206734)
For some time, Dexter tests have been run using lldb-dap when it is
available rather than just lldb/lldb-server. However, the cross project
test dependencies have not been updated since then, meaning that
lldb-dap is not automatically built by check-cross-project. The
Dexter-specific lit config then skips the Dexter tests if lldb-dap is
unavailable, which leads to some check-cross-project builds never
running the Dexter tests. This patch adds lldb-dap to the build
dependencies, and also adds a small log message to inform when the
Dexter tests are skipped; most cases where we skip the Dexter test were
already logged, and this addition expands that to cover all cases.
2026-06-30 15:08:10 +01:00
SiHuaN
6600ad0949
[Clang][RISCV] packed reduction sum intrinsics (#206441)
Add the __riscv_predsum/predsumu_* header wrappers over new
__builtin_riscv_* builtins, lowering to the llvm.riscv.predsum/predsumu
intrinsics.
2026-06-30 11:51:57 +08:00
Stephen Tozer
cdef97000c
Revert "[Dexter] Add rewriting for aggregate variables (#202800)" (#206495)
This reverts commit 2cf48dca33.

The original commit is failing sometimes in pre-commit CI for linux
builds, possibly due to some unspecified environmental dependency.
2026-06-29 14:56:07 +01:00
Stephen Tozer
bb9f0817a9
[Dexter] Add !address node (#202801)
Adds a node type for Dexter that allows checking abstract labels instead
of concrete addresses. Each address node has a label and optional
offset, and the first time during evaluation that a given address label
is matched against a valid pointer value, the address label will be
assigned a value that matches the seen address (adjusting for any
offset). From that point, the resolved address value will be used for
the remainder of the test evaluation.
2026-06-29 13:25:31 +01:00
Stephen Tozer
2cf48dca33
[Dexter] Add rewriting for aggregate variables (#202800)
Following on from the previous patch, this patch allows Dexter to write
disaggregated expected values for aggregate variables. Dexter eagerly
tries to disaggregate whenever subvalues are available, but will
fallback to the root/parent value if all available subvalues are
unavailable.

NB: Each test in this patch has a corresponding "expected" file, which
is almost identical (including the `RUN` lines), and exists to be
`diff`'d against the output of Dexter's script generation.
2026-06-29 11:43:04 +01:00
Ben Dunbobbin
fe5f49f84f
[DTLTO] Do not serialize inputs that hit in the ThinLTO cache (#204104)
To handle bitcode inputs that are not in individual files on disk, such
as members of non-thin archives, DTLTO serializes those inputs to
temporary individual bitcode files.

This patch changes LLVM to serialize only uncached input modules and any
modules they import from.

For a link of Clang 22 (debug build with sanitizers and
instrumentation), I performed measurements with and without this patch
for an optimized toolchain (PGO non-LTO, based on recent main commit
c264e07c2f). The measurements were run on:
- Windows 11 Pro build 26200, AMD Family 25 at approximately 4.5 GHz,
  16 cores / 32 threads, and 64 GB RAM.
- Ubuntu 24.04.3 LTS, Ryzen 9 5950X with 32 threads, and 62 GiB RAM.

There was no difference in serialization time when the cache was
disabled.

When the cache was enabled and all compilations hit in the cache,
serialization was eliminated, as was the time spent deleting the
previously serialized temporary files, which are no longer created. Mean
wall-clock time improved by about 10% on both machines in this scenario.
2026-06-26 16:03:36 +01:00
Stephen Tozer
384cecd5b2
Reapply "[Dexter] Add ability to rewrite scripts to fill-in unknown values" (#206034)
Reverts llvm/llvm-project#205657

The original commit was causing pre-merge CI to fail for AArch64, as one
of the tests expects stepping behaviour that is seen on not seen on
AArch64 targets; the test suite containing the failing test is meant to
be configured to not run for AArch64, but the unsupported label was not
being applied, due to an error in the unsupported check. This patch
fixes the unsupported check in scripts/lit.local.cfg, which should
prevent further errors.
2026-06-26 15:35:13 +01:00
Jan Svoboda
c0cbb8ac9e
Revert "[Dexter] Add ability to rewrite scripts to fill-in unknown values" (#205657)
Reverts llvm/llvm-project#202799 to fix the failing
cross-project-tests::debuginfo-tests/dexter/feature_tests/scripts/rewriting/rewrite_expect_list.cpp
test and unblock pre-commit CI.
2026-06-24 19:57:20 +00:00
Stephen Tozer
25a6b5be68
[Dexter] Add ability to rewrite scripts to fill-in unknown values (#202799)
This patch adds a feature to Dexter that allows scripts to be passed to
Dexter with missing expected values (`null` values in YAML), which
Dexter will attempt to "fill-in" with expected values that match the
debugger's actual output. The result is written to a file with the same
name as the original test file, in the directory given by
--results-directory if one is present; all content outside of the Dexter
script itself is preserved exactly as-is.

NB: Each test in this patch has a corresponding "expected" file, which
is almost identical (including the `RUN` lines), and exists to be
`diff`'d against the output of Dexter's script generation.
2026-06-24 16:55:25 +01:00
SiHuaN
70c54ff1d5
[Clang][RISCV] packed exchanged add/sub intrinsics (#205251)
Add the `__riscv_{pas,psa,psas,pssa,paas,pasa}_x_*` header wrappers over
new `__builtin_riscv_*` builtins.
2026-06-23 17:24:54 +08:00
TelGome
b02659ab5c
[RISCV][P-ext] Support Packed Absolute Value and Absolute Difference (#203840)
This pr support RISC-V P extension intrinsics [Packed Absolute Value and
Absolute
Difference](https://github.com/riscv/riscv-p-spec/blob/master/P-ext-intrinsics.adoc#packed-absolute-value-and-absolute-difference)
2026-06-18 22:32:00 +08:00
Stephen Tozer
d08ca31f48
[Dexter] Add !then node (#202546)
In order to exercise more control over stepping in Dexter tests, this
patch adds the `!then` node which can be used to step out of a function
or exit the current test. Unlike expect nodes, !then nodes appear as
direct singular children of a state node:

!where {lines: 10}: !then finish

The two currently available commands are "step_out" and "finish".
step_out performs a debugger "step out" command, skipping over all
!wheres in the current frame and not stepping into any lower !wheres.
The finish command ends the debugger session immediately after finishing
the current step.
2026-06-17 15:43:24 +01:00
Stephen Tozer
4cb6eee15d
[Dexter] Add support for aggregate expects in the debugger (#202545)
Allows aggregate expects to be written in Dexter scripts, in the form:

```
!value expect:
  member1: 0
  member2:
    submember1: 1
    submember2: 2
```

This uses the "variables" feature provided in the DAP interface to
recursively fetch sub-variables from each evaluated variable, and
modifies the DebuggerExpectMatch class to also be recursive, containing
submatches for each expected aggregate member value.

Some key concepts that are affected by this are the "match_result",
which has changed from a bool to a 3-way result ("FALSE", "TRUE",
"PARTIAL"), where "PARTIAL" means that at least one submatch was TRUE
and at least one was FALSE. We also add a `match_distance`, which is
used as a measure of correctness. The match distance ranges from 0.0 to
1.0: a total match has a distance of 0.0, a total mismatch has 1.0, and
a partial match's distance is equal to the average distance of its
immediate children.
2026-06-16 16:25:46 +01:00
Stephen Tozer
53d18800ed
Reapply "[Dexter] Add label nodes for line references" (#203938)
This reverts commit
2a789821b0.

The original commit previously caused pre-merge check failures for Linux
AArch64 cross-project-tests, due to the stepping behaviour being
slightly different to x86_64. The tests have been adjusted to be less
brittle to exact stepping behaviour, but this reapply also disables the
tests for ARM targets as there is not currently the infrastructure to
reliably test them, meaning we may end up with latent failures.
2026-06-16 13:03:33 +01:00
Stephen Tozer
2a789821b0
Revert "[Dexter] Add label nodes for line references" (#203920)
Reverts llvm/llvm-project#202544

Commit appears to be causing failures in the pre-merge checks for
AArch64 specifically, though this is not entirely consistent. Reverting
to fix pre-merge checks immediately, will aim to reland with either a
fix or disabling tests for AArch64.
2026-06-15 16:09:51 +01:00