[Mips] Don't use odd FPRs for single-precision arithmetic before MIPS32 (#245733)
Before MIPS32, single-precision arithmetic can only use the even FPRs
when the FPRs are 32 bits wide, since an odd FPR only holds the upper
half of a double. LLVM still used the odd FPRs for f32 on MIPS I to
MIPS IV with 32-bit FPRs, unless nooddspreg was given, so it emitted
code such as mul.s $f2, $f1, $f0.
Turn off the odd single-precision registers by default there, as GCC
does. This also emits .module nooddspreg and clears the ODDSPREG ABI
flag, as GAS does. A single-float FPU such as the R5900 has 32
single-precision FPRs, so single-float is not changed.
Clang already passes nooddspreg for MIPS II to MIPS V with O32, where
FPXX is the default, so this mostly affects MIPS I, -mfp32 and tools
that don't use the Clang driver.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
amd64/vmm: Do not fall back to the VMCS for vmxctx registers
vmx_setreg() first calls vmxctx_setreg() and, if that fails, handles the
register as a VMCS field. This relies on vmxctx_setreg() failing only
for registers that are not kept in the vCPU context. Were it to reject
a value for one of its own registers, the error would be dropped and
the request passed on to vmcs_setreg(), which would fail it only
because the register has no VMCS field.
Check whether the register is kept in the vCPU context instead, and if
so return the result of vmxctx_setreg() directly. This lets
vmxctx_setreg() validate values and have its error returned as is. Do
the same in vmx_getreg(), so that the two functions read alike.
No functional change intended.
Reviewed by: markj
Approved by: markj
Sponsored by: Alchemilla Ventures Private Limited
Differential Revision: https://reviews.freebsd.org/D61954
amd64/vmm: Restore vmxctx registers through vmxctx_setreg()
vmx_vcpu_snapshot() copies the guest registers kept in the vCPU context
straight between the context and the snapshot buffer, while
VM_SET_REGISTER stores them through vmxctx_setreg(). A check added to
vmxctx_setreg() would thus not apply to values restored from a
snapshot.
Add vmxctx_snapshot_reg(), modelled on vmcs_snapshot_reg(), and use it
for every register in the vCPU context, so that both paths store values
the same way. The snapshot format does not change.
No functional change intended.
Reviewed by: markj
Approved by: markj
Sponsored by: Alchemilla Ventures Private Limited
Differential Revision: https://reviews.freebsd.org/D61953
[Mips] Fix the MIPS I %lo offset fold for loads and stores (#245716)
On MIPS I a double is loaded or stored with two lwc1 or swc1, and
selectAddrFrameIndexOffset() folds the %lo of the address into both.
That fold had three bugs:
- For a constant pool entry it dropped the %lo but kept the offset, so
the second half of an f64 constant was loaded from %hi(sym) + 4.
- For a global it always used %lo, so a $gp relative address got
%lo(sym+4)($gp) instead of %gp_rel(sym+4)($gp).
- Inline asm memory operands could get a symbolic offset, which hit an
assertion in MipsAsmPrinter::PrintAsmMemoryOperand().
Fold the offset into the constant pool entry or global with its own
relocation, only when the offset is within the alignment of the
symbol, so %hi(sym) is also %hi(sym+offset), as GCC does. Do not fold
jump tables, and only accept an immediate offset for inline asm memory
operands.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
mail/stalwart*: change maintainer to jsi at jules.de
Existing maintainer is not reachable, domain anislet.dev
does not have neither MX or A records and port has active security
issues.
[C++20] [Modules] Correct Module Ownership and use canonical decl (#246565)
Close https://github.com/llvm/llvm-project/issues/245967
The root cause of the issue is that we didn't give deduction guide the
correct module ownership and we didn't use canonical decl correctly.
amd64/vmm: Reject reserved DR6 bits supplied by userspace
On Intel hosts the guest's DR6 is kept in the vCPU context and loaded
into the host's register before guest entry. VM_SET_REGISTER and the
snapshot restore path store any value there. Loading a value with any
of bits 63:32 set raises #GP, which panics the host.
Fail with EINVAL instead.
Reviewed by: markj
Approved by: markj
Fixes: 65eefbe42218 (Save and restore guest debug registers.)
MFC after: 1 week
Sponsored by: Alchemilla Ventures Private Limited
Differential Revision: https://reviews.freebsd.org/D61732
[OFFLOAD][L0] Skip Memcpy3D test in L0 (#246569)
One of the new Memcpy3D tests (SuccessSingleSliceZOffset) is failing in
some of the bulidbots configurations. Mark as skip while we investigate
the issue.
libvmmapi: Compare mapping lengths in vm_mmap_memseg()
vm_mmap_memseg() returns success without mapping anything when a
mapping with the same segment, offset, protection and flags already
starts at the requested address, but it does not compare the length.
A longer request then reports success for pages it did not map, and a
shorter one for a mapping that vm_munmap_memseg() cannot remove with
the same range. No caller in the tree makes such a request.
Fail with EEXIST when the length differs, as for the other attributes,
and document that behavior. Read the existing mapping into its own
structure rather than over the arguments.
Reviewed by: markj
Approved by: markj
Fixes: 9b1aa8d622e8 (Restructure memory allocation in bhyve to support "devmem".)
Sponsored by: Alchemilla Ventures Private Limited
Differential Revision: https://reviews.freebsd.org/D61530
[AMDGPU][GlobalISel] Fix ds_append/ds_consume addressing
This matches the SelectionDAG fix. For LDS, ds_append and ds_consume
address memory only through the 16 bit instruction offset and ignore
M0, but the selector copied the pointer base into M0. Select a constant,
dword aligned LDS address into the offset field and diagnose any other
LDS address as unsupported.
For GDS, the offset field must be zero and the address comes from
M0.base, so build M0 as `(addr << 16) | gds_size`. Using GDS on a
subtarget without GDS is now diagnosed.
```
; call i32 @llvm.amdgcn.ds.append.p3(ptr addrspace(3) inttoptr (i32 16 to ptr addrspace(3)), i1 false)
; before
s_mov_b32 m0, 16
ds_append v0
; after
ds_append v0 offset:16
```
[AMDGPU] Fix ds_append/ds_consume addressing in SelectionDAG
For LDS, ds_append and ds_consume address memory only through the 16 bit
instruction offset. M0 is not used, but isel put the pointer (or its
base) into M0, so the counter was read at the wrong address. Select a
constant, dword aligned LDS address into the offset field and diagnose
any other LDS address as unsupported.
For GDS, the ISA requires the offset field to be zero and takes the
address from M0.base, so pack the whole address into M0 as
`(addr << 16) | gds_size`. Using GDS on a subtarget without GDS is now
diagnosed instead of silently encoding a GDS bit.
```
; call i32 @llvm.amdgcn.ds.append.p3(ptr addrspace(3) inttoptr (i32 16 to ptr addrspace(3)), i1 false)
; before
s_mov_b32 m0, 16
ds_append v0
; after
[4 lines not shown]
bhyve: Preserve string I/O registers on faults before progress
When a string I/O instruction faults on its first transfer, the emulator
injects the exception but still writes the masked index and count back
to the guest. With a 32-bit address size in 64-bit mode this clears
the upper halves of RSI or RDI and of RCX, although no transfer
completed and the processor reports such a fault with the registers
unchanged.
Return before updating the registers whenever no transfer completed,
whether an error, a guest fault or an injected exception stopped the
first one. Exception injection has already restarted the instruction.
A repeated instruction with a zero count is handled as before.
Reviewed by: markj
Approved by: markj
Sponsored by: Alchemilla Ventures Private Limited
Differential Revision: https://reviews.freebsd.org/D61499
bhyve: Preserve upper RAX bits for byte and word input
Scalar IN merges the input into a 32-bit EAX temporary and writes that
value to RAX. This clears bits 63:32 for byte and word inputs, which
must preserve the bits outside AL or AX.
Use vie_update_register() to update the accumulator at the operand
width. This preserves the remaining bits for byte and word inputs and
retains zero-extension for dword inputs.
Reviewed by: markj
Approved by: markj
Sponsored by: Alchemilla Ventures Private Limited
Differential Revision: https://reviews.freebsd.org/D61498
[LoongArch] Force a frame pointer for large call frames (#242625)
A large reserved call frame can push the emergency spill slot out of
reach of SP. Accessing the emergency spill slot can require a scratch
register. If none is free, scavenging fails with "Incomplete scavenging
after 2nd pass".
Adapt the RISC-V fixes from #181302 and #182124.
Compute the maximum call frame size at the end of ISel, before reserved
registers are frozen, and when loading MIR. Force a frame pointer when
the maximum call frame size exceeds the int12 range on LA32 or the int15
range on LA64, so the emergency spill slot can be addressed from FP.
LLM assisted.
[Mips] Use IMPLICIT_DEF and INSERT_SUBREG to insert an FP value into an MSA vector. NFC (#242320)
The lowering of INSERT_FW, INSERT_FD and the floating-point variants of
INSERT_*_VIDX used SUBREG_TO_REG to view the FP register as an MSA
register. SUBREG_TO_REG means that the instruction defining the FP
register also defined the rest of the MSA register, which is not the
case. Only element 0 is used, so the rest is undefined, which is what
IMPLICIT_DEF and INSERT_SUBREG express. This matches the lowering of
FILL_FW and FILL_FD.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
---
<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[Mips] Use INSERT_SUBREG of IMPLICIT_DEF for the halves of a 64-bit MSA splat. NFC (#242321)
When synthesizing a 64-bit splat value on MIPS64, the high and low
32-bit
halves are computed as i32 values and then combined with dinsu or
dsll32, which do not use the high 32 bits of the halves. Widen the
halves to i64 with INSERT_SUBREG into an IMPLICIT_DEF instead of
SUBREG_TO_REG, since nothing depends on the value of their high bits.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[AMDGPU][GlobalISel] Fix ds_append/ds_consume addressing
This matches the SelectionDAG fix. For LDS, ds_append and ds_consume
address memory only through the 16 bit instruction offset and ignore
M0, but the selector copied the pointer base into M0. Select a constant,
dword aligned LDS address into the offset field and diagnose any other
LDS address as unsupported.
For GDS, the offset field must be zero and the address comes from
M0.base, so build M0 as `(addr << 16) | gds_size`. Using GDS on a
subtarget without GDS is now diagnosed.
```
; call i32 @llvm.amdgcn.ds.append.p3(ptr addrspace(3) inttoptr (i32 16 to ptr addrspace(3)), i1 false)
; before
s_mov_b32 m0, 16
ds_append v0
; after
ds_append v0 offset:16
```