Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/rustc_target/src/callconv/arm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ where

let valid_unit = match unit.kind {
RegKind::Integer => false,
RegKind::Float => true,
RegKind::PpcF128 => unreachable!(),
RegKind::Float => unit.size.bits() == 32 || unit.size.bits() == 64,
RegKind::Vector { .. } => unit.size.bits() == 64 || unit.size.bits() == 128,
RegKind::PpcF128 => unreachable!(),
};

valid_unit.then_some(Uniform::consecutive(unit, size))
Expand Down
16 changes: 15 additions & 1 deletion tests/codegen-llvm/arm-abi/homogeneous-aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// Test that homogeneous aggregates are passed and returned with the correct ABI on 32-bit arm.

#![feature(no_core, lang_items)]
#![feature(arm_target_feature)]
#![feature(arm_target_feature, f16, f128)]
#![crate_type = "lib"]
#![no_core]

Expand Down Expand Up @@ -151,6 +151,20 @@ pub extern "C" fn test_floats_5(a: Floats5) {
hint::black_box(a);
}

// Only f32 and f64 qualify as an HFA base.

// linux: define void @test_f16([2 x i32] %0)
#[unsafe(no_mangle)]
pub extern "C" fn test_f16(a: [f16; 3]) {
hint::black_box(a);
}

// linux: define void @test_f128([2 x i64] %0)
#[unsafe(no_mangle)]
pub extern "C" fn test_f128(a: [f128; 1]) {
hint::black_box(a);
}

// Just a big struct, note how watchOS passes it indirectly.
#[repr(C)]
pub struct Ints6 {
Expand Down
Loading