[libc] Avoid mask round trip through the stack in AVX-512 bcmp (#233423)
`neq<__m512i>` folds the 64-bit `vpcmpneqb` mask into 32 bits by OR-ing
its two halves. InstCombine turns that into two `extractelement`s of
`bitcast <64 x i1> to <2 x i32>`. VectorCombine (`foldExtractExtract`)
then rewrites them as a `<2 x i32>` shuffle + `or`. X86 can only lower
that bitcast by spilling the mask register and reloading it into an xmm
register. The 16-byte reload overlaps the 8-byte store, so it can't be
store-forwarded, and every 64-byte block of the bcmp loop pays a
store-forwarding stall.
```asm
; before (per 64 B block)
vpcmpneqb %zmm1, %zmm0, %k0
kmovq %k0, -8(%rsp)
vmovdqa -8(%rsp), %xmm0 ; store-forwarding stall
vpshufd $85, %xmm0, %xmm1
vpor %xmm0, %xmm1, %xmm0
vmovd %xmm0, %eax
[23 lines not shown]
simd_aarch64 (Linux): Unsplit statement expression
The `get_ftr()` macro splits statement expression tokens between a macro
and its callers, which is unhygienic and gets flagged by clang due to
`-Wcompound-token-split-by-macro`. With `--enable-debug` the warning is
an error, which breaks the build.
Move the parentheses around the expression into the macro so it forms a
complete statement expression.
Fixes: cef125313548 ("Add SHA2 SIMD feature tests for Linux")
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: Ryan Moeller <rmoeller at FreeBSD.org>
Closes #19650
Closes #19769
[DebugInfo][DwarfDebug] Defer parent attachment of function-local DIEs until endModule() (#230866)
As it was discussed previously in
https://github.com/llvm/llvm-project/pull/142166#issuecomment-2950057682,
when DIEs for function-local types are emitted in DWARF, they should be
placed in their corresponding abstract subprograms, or abstract lexical
blocks inside them (if abstract DIE for subprogram exists).
If a function-local entity DIE is emitted in
`DwarfDebug::endFunctionImpl()`, DwarfDebug may not know yet if an
abstract subprogram should be created for the scope of function-local
entity, thus,
function-local type may be wrongly placed (inside concrete subprogram
DIE instead of abstract SP DIE, see
https://github.com/llvm/llvm-project/issues/29985,https://github.com/llvm/llvm-project/issues/55680 ).
Initially, to solve that for subprograms that represent fully inlined
functions, LexicalScopes class was modified to build a map of
[35 lines not shown]
[RISCV] Sync the LP64E i128 vararg and stack argument behavior with gcc. (#239884)
i128 arguments to variadic functions are not passed in aligned pairs for
LP64E.
The stack locations for i128 arguments are not 16 byte aligned.
In the backend, rather than checking for RVE directly, use the ABI stack
alignment to clamp the type alignment which is where gcc's behavior
comes from.
Assisted-by: Claude
Fix FreeBSD fallout from simd_aarch64 changes
FreeBSD ARM requires sys/simd.h to be included before sys/vnode.h
because simd.h pulls in definitions of AT_UID and AT_GID from
elf_common.h, which vnode.h has to undef before its own definitions.
This does not work in the reverse order.
When 45e778b6bce7 included sys/simd.h in vdev_raidz_math_impl.h
(included by vdev_raidz_math_scalar.c after sys/vnode.h) and
zio_checksum.c, it broke the ordering.
Restore the required include order to fix FreeBSD ARM builds.
Fixes: 45e778b6bce7
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: Ryan Moeller <rmoeller at FreeBSD.org>
Closes #19769
[Clang][Driver] Disable fake arch tool tests on macOS (#240517)
Like sycl-system-arch.cpp in #238500, the other tests that run a fake
GPU arch tool time out with "Child timed out" on macOS CI. macOS scans
every new executable on its first launch, so the scripts these tests
create in %t can wait behind scans of large binaries that other tests
launch for the first time. See #238903.
Return the file handle from truesearch.query
- Each entry has `handle`, the ZFS file handle of the file encoded in
base64, as `open_by_handle_at` takes it. `generation` is removed,
because the handle holds it.
- `truesearch_client` builds the handle from the inode number and the
generation that truesearchd returns.
ipfilter: Only recalculate the UDP header when we have one
When ipf_nat_out processes NAT_DIVERTOUT (ipnat rdr statements)
it also fixes the checksum in the UDP header. Test for a UDP header
before adjusting its length.
While we are here, the length in the UDP header must be converted
from network byte order to host byte order. Add the missing ntohs().
PR: 296944
MFC after: 3 days
[Hexagon] NFC: Refactor BuiltinsHexagon.td (#237371)
BuiltinsHexagon.td consists of manually created builtins and a set of
regular builtin definitions created by automation. To simplify
maintenance, separate these into two different files, similar to other
*Dep* files.
raidz: fix write ASSERTs for scratch area columns
While a RAID-Z expansion is in RRSS_SCRATCH_VALID, I/O to the start of
the vdev uses the scratch area: vdev_raidz_map_alloc_expanded()
subtracts VDEV_BOOT_SIZE from rc_offset and rc_shadow_offset, which
wraps below zero. The bounds ASSERTs in vdev_raidz_io_start_write()
compared these offsets directly, so any write to that region panicked
debug builds, for example a resilver after a scratch I/O error paused
the expansion.
Compare the physical offset, including VDEV_LABEL_START_SIZE, instead.
Reviewed-by: Paul Dagnelie <paul.dagnelie at klarasystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Matthew Ahrens <matt at mahrens.org>
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
Closes #19590
[ci][libc] Switch premerge libc runtime to full-build mode (#231937)
Enable full-build mode for libc in premerge CI when check-libc is
targeted, skipping death and shared math tests to keep execution fast.
Also add a libc-headers dependency to test rules to prevent parallel
build races against public header generation.
Assisted-by: Automated tooling, human reviewed.
raidz: keep the scratch copy when import recovery fails
When a pool is imported with a raidz expansion stopped in the scratch
phase (RRSS_SCRATCH_VALID), vdev_raidz_reflow_copy_scratch() copies the
scratch area over the start of the vdev. It ignored errors from both
the scratch read and the write to the real location. A failed read
left the buffer uninitialized, which was then written over live data,
and the uberblock was moved to RRSS_SCRATCH_INVALID_SYNCED_ON_IMPORT,
discarding the only good copy. On debug builds the same failure trips
the io_error/ZIO_FLAG_CANFAIL assertion in zio_done() instead, because
the root zios were created without ZIO_FLAG_CANFAIL.
Create the zios with ZIO_FLAG_CANFAIL, as raidz_reflow_scratch_sync()
does, check both zio_wait() calls, and on failure return with the state
still RRSS_SCRATCH_VALID. I/O to the start of the vdev then keeps
going to the scratch area, and the expansion thread retries the copy
through raidz_reflow_scratch_sync(), which already checks these errors
and pauses until the devices are healthy.
[5 lines not shown]
[bazel][llvm] Sort SelectionDAGOptionsTableGen dep in BUILD.bazel (#240578)
Commit 6af7d8c1efa6 (#240498) added :SelectionDAGOptionsTableGen to
CodeGen's deps out of alphabetical order, causing the Buildifier CI
check to fail. Move it into sorted order.
libcasper: Use pdfork() for the zygote
Use pdfork(2) rather than fork(2) to fork the zygote, and close the
descriptor when the main loop terminates.
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: Qualys, Inc.
Reviewed by: oshogbo
Differential Revision: https://reviews.freebsd.org/D60176
Use truesearch_client for the TrueSearch file and sockets
- The plugin writes and reads `truesearch.conf` through
`truesearch_client.config`. It asks both control sockets and waits
for a release through `truesearch_client.control`.
`middlewared/utils/truesearch.py` is removed, and its tests move to
the client.
- truesearchd and truesearch-indexer answer `status` with `ok` and a
JSON object. `truesearch.status` reads the object through the client.
Before, it read lines of `key=value` fields.
- The free space is `null` when the indexer cannot read it.
- The plugin imports `truesearch_client` when it loads. The
`middlewared` package depends on `truenas-truesearch`, which installs
it.
- The docstring of `truesearch.query` marks its literals with double
backticks. Each line of the `TruesearchQueryOptions` docstring ends
with a period.
- This change needs the TrueSearch change that adds these client modules
and answers in JSON. Both changes land together.
[libc][stdfix] Fix overflow bound for expk (#240301)
In `expk`, the overflow bound `0x1.62e4p3k` uses `floor` instead of
`ceil`, clamping `x = 0x1.62e4p3k` to `ACCUM_MAX`.
Update the overflow bound from `0x1.62e4p3k` to `0x1.62e44p3k`, and fix
comment nits as in `exphk`.
SystemZ: Lower sub-word atomicrmw during type legalization
Produce the ATOMIC_LOADW_* nodes when replacing the illegal i8/i16
results, instead of custom lowering the promoted node later. This
removes the no-op custom type legalization case.
Constants are now any-extended, so one test materializes an immediate
with llill instead of lhi.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
SelectionDAG: Use the memory type for atomic libcall actions (#238480)
The atomic libcall selection is driven by the memory type, not the
legalized value type. Convert targets to use the LibCall action
instead of Expand.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>