Description
I tried this code when targeting any of the PowerPC SPE targets such as powerpc-unknown-linux-muslspe
(compiler explorer):
pub fn add(x: f32, y: f32) -> f32 {
x + y
}
I expected to see this happen: The assembly to use SPE instructions as this is an SPE target.
Instead, this happened: The assembly uses regular PowerPC FPU floating point instructions, as none of the three powerpc-*spe
targets actually have the spe
target feature enabled. According to the Debian PowerPCSPEPort wiki page, PowerPC SPE lacks the standard PowerPC FPU, and the Signal Processing Engine (SPE) Programming Environments Manual doesn't list fadds
(which the targets currently compile the x + y
to) as an SPE instruction, so the status quo is almost certainly incorrect.
cc @BKPepe as target maintainer of powerpc-unknown-linux-muslspe
. Also cc @glaubitz who added powerpc-unknown-linux-gnuspe
in #48484 and @BaoshanPang who added powerpc-wrs-vxworks-spe
in #61946, as neither of those two targets have any target maintainers.
Meta
rustc --version --verbose
:
rustc 1.87.0-nightly (aa8f0fd71 2025-03-23)
binary: rustc
commit-hash: aa8f0fd7163a2f23aa958faed30c9c2b77b934a5
commit-date: 2025-03-23
host: x86_64-unknown-linux-gnu
release: 1.87.0-nightly
LLVM version: 20.1.1
Activity
beetrees commentedon Mar 26, 2025
@rustbot label +O-PowerPC +A-target-feature
RalfJung commentedon Mar 26, 2025
Hm yeah, that's odd... we would have expected
+spe
to be listed here, right?rust/compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks_spe.rs
Line 28 in b660382
beetrees commentedon Mar 28, 2025
Yes. The
spe
feature will also be enabled when using a SPE target CPU such ase500
(none of the SPE targets currently specify a default target CPU so they all default to thegeneric
PowerPC one), but being explicit would definitely be better.