[Sparc] Make single-thread fences a compiler barrier (#248761)
A fence for a single thread, such as atomic_signal_fence, only orders
against a signal handler on the same thread, so it needs no barrier
instruction. SPARC emitted the full barrier for it anyway: stbar and
ldstub on V8 and membar on V9. As in GCC, make it only a compiler
barrier.
Assisted-by: Claude Opus 5.5
[Sparc] Use %lm for the low 32 bits of an address in the abs64 code model (#248785)
With -fno-pic -mcmodel=medany or large, the low 32 bits of an address
were built with sethi %hi(sym), which gives R_SPARC_HI22. In the 64-bit
ABI R_SPARC_HI22 checks that the value fits in 32 bits, so the link
failed for any data above 4 GiB. R_SPARC_LM22 is the same, except that
it truncates. Use %lm, as GCC does. The address of the GOT, built the
same way in SparcAsmPrinter, had the same problem.
Assisted-by: Claude Opus 5.5
[clang][Sparc] Define the CPU macros GCC defines (#248768)
GCC defines a macro for some SPARC CPUs: `__sparclite__` for `sparclite`
and `f934`, `__sparclite86x__`, `__sparclet__` for `sparclet` and
`tsc701`,
`__supersparc__` and `__hypersparc__`. Define them too.
Assisted-by: Claude Opus 5.5
Services: Monit - two settings monit refuses: GID test conditions, custom service path (#11407)
* Services: Monit - recognise GID test conditions
The GID test type's operand was a copy of UID's ('failed uid'), so a
'failed gid' condition was typed Custom. Custom passes the service type
check, so such a test could be linked to a host service, where monit
refuses the control file (syntax error 'gid').
* Services: Monit - require a program path for custom services
A custom service without a path was saved and rendered as
'check program <name> with path ""', which monit refuses (syntax
error), so monit no longer loads its control file.
[MC] Emit 'S' augmentation for .debug_frame signal frames (#246795)
.cfi_signal_frame is only encoded in .eh_frame CIEs ("zRS");
.debug_frame CIEs currently get no augmentation while GCC emits "S" for
these frames (comparison: https://godbolt.org/z/3bvxh7Pse).
Emit "S" for non-EH signal frames and include IsSignalFrame in the
non-EH CIEKey, otherwise a signal and normal frame with the same return
register can share a CIE.
Adds a small MC/ELF test checking the two CIE augmentations.
Co-authored-by: Evalyn Goemer <git at evalyngoemer.com>
Co-authored-by: Fangrui Song <i at maskray.me>
Services: Intrusion Detection: Administration - rule enabled state as posted, descending rule sort (#11409)
* Services: Intrusion Detection: Administration - set a rule's enabled state as posted
setRuleAction() passes getPost('enabled', 'int') to toggleRuleAction(),
whose $enabled == null is also true for 0, so posting enabled 0 toggled
the rule: a disabled rule got enabled.
* Services: Intrusion Detection: Administration - sort installed rules descending
The sort string ended in a space ("sid desc "), and rulecache.py's
search() takes the last space-separated word as the direction, so desc
fell back to asc.
Services: Captive Portal: Administration - template upload that isn't a zip, template in use (#11410)
* Services: Captive Portal: Administration - report a template that isn't a zip
strip_template.py answers its other problems as an error, but data that
isn't a zip makes zipfile raise BadZipFile, so saveTemplateAction()
returned error null and the page reported the upload as saved while
nothing was stored.
* Services: Captive Portal: Administration - refuse deleting a template a zone uses
The zone kept the deleted template's uuid, and its next save failed
with "Related template not found."
[DAG] Generalize sign-bit extraction in visitAND to low-bit masks (#248920)
Generalize (and (srl X, C), 1) to masks with B low bits set. Fold the
shift and mask to (srl X, BW - B) when C < BW - B and all bits from C
through the MSB are copies of the sign bit.
For masks wider than one bit, require a scalar SRL with a single use.
Preserve the existing one-bit fold for vectors and multi-use shifts.
Update code generation checks across several targets. The main benefit
is that some sdiv and srem cases need fewer instructions to compute
the bias.
[sanitizer] report libbacktrace errors on verbose mode (#243083)
Those errors could give clues why a backtrace is missing. Hence, log
them but only when verbose > 1.
Issue: https://github.com/llvm/llvm-project/issues/243075
[AMDGPU] Fold add into integer wmma accumulator (#248304)
Integer wmma and swmmac wrap on overflow when clamp is off, so adding X
to the result is the same as adding X to the accumulator. Fold the add
when the accumulator is zero or both are constants. Because wmma is
convergent, the call is only moved to the add when both are in the same
block.
```llvm
%d = call <8 x i32> @llvm.amdgcn.wmma.i32.16x16x16.iu8.v8i32.v2i32(i1 0, <2 x i32> %a, i1 0, <2 x i32> %b, <8 x i32> zeroinitializer, i1 0)
%r = add <8 x i32> %d, %x
-->
%r = call <8 x i32> @llvm.amdgcn.wmma.i32.16x16x16.iu8.v8i32.v2i32(i1 0, <2 x i32> %a, i1 0, <2 x i32> %b, <8 x i32> %x, i1 0)
```
[sanitizer] don't pass initial filename to libbacktrace (#243082)
Libbacktrace knows how to find the executable name for its supported
platforms. Passing an initial filename prevents this lookup phase.
Issue: https://github.com/llvm/llvm-project/issues/243075
[DAGCombiner] Don't treat bitcast+extract_subvector as a truncate on big-endian (#245146)
Fixes #244527
`(zext/aext (and (bitcast (extract_subvector vNi1, 0) to iK), cst))` was
folded into an AND on the wider bitcast, which assumes
`bitcast(extract_subvector(X, 0))` is `trunc(bitcast(X))`. That only
holds on little-endian: per LangRef a `<N x i1>` bitcast follows the
element order of the target, so on big-endian lane 0 is the most
significant bit and the masked low bits select the last K lanes. On
aarch64_be the reproducer read lanes 24..31 instead of 8..15, and mips
and s390x do the same.
Guards that branch in both folds with
`DAG.getDataLayout().isLittleEndian()` and leaves big-endian to the
generic lowering, which is already correct. The truncate branch is
untouched.
Test: `bitcast-extract-subvector-and-zext.ll` covers both folds for
[8 lines not shown]
[AArch64] Fix big-endian SVE truncation of fixed-length vectors (#246756)
On big-endian AArch64, lowering a fixed-length integer vector `trunc`
through SVE can keep the high half of each element. The generic
`BITCAST` reverses bytes when the element width changes, so `UZP1` can
select the wrong half.
Use `AArch64ISD::NVCAST` before each `UZP1` to preserve the register
layout and select the low half. The regression test reproduces the bug
on `main` with a plain `trunc` from `<8 x i64>` to `<8 x i8>`,
exercising all three narrowing steps.
I found this while testing the 32- and 64-lane mask optimization in
#246755 on big-endian SVE.
[NVPTX] Add support for lround and llround intrinsics for f16 and bf16 (#240078)
add support for lround and llround intrinsics for f16 and bf16 by
promoting them to f32.
fixes #239041
used claude for writing code comments