Fix passing and returning vector types
This commit is contained in:
parent
eed1f75415
commit
c3ee030119
@ -1,4 +1,4 @@
|
|||||||
#![feature(core_intrinsics, generators, generator_trait, is_sorted)]
|
#![feature(core_intrinsics, generators, generator_trait, is_sorted, repr_simd)]
|
||||||
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
use std::arch::x86_64::*;
|
use std::arch::x86_64::*;
|
||||||
@ -153,12 +153,20 @@ pub fn new() -> Box<Foo<T>> {
|
|||||||
|
|
||||||
enum Never {}
|
enum Never {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foo(I64X2(0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn panic(_: u128) {
|
fn panic(_: u128) {
|
||||||
panic!();
|
panic!();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[repr(simd)]
|
||||||
|
struct I64X2(i64, i64);
|
||||||
|
|
||||||
|
#[allow(improper_ctypes_definitions)]
|
||||||
|
extern "C" fn foo(_a: I64X2) {}
|
||||||
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
#[target_feature(enable = "sse2")]
|
#[target_feature(enable = "sse2")]
|
||||||
unsafe fn test_simd() {
|
unsafe fn test_simd() {
|
||||||
|
@ -165,6 +165,9 @@ pub(crate) fn load_scalar(self, fx: &mut FunctionCx<'_, '_, 'tcx>) -> Value {
|
|||||||
CValueInner::ByRef(ptr, None) => {
|
CValueInner::ByRef(ptr, None) => {
|
||||||
let clif_ty = match layout.abi {
|
let clif_ty = match layout.abi {
|
||||||
Abi::Scalar(scalar) => scalar_to_clif_type(fx.tcx, scalar),
|
Abi::Scalar(scalar) => scalar_to_clif_type(fx.tcx, scalar),
|
||||||
|
Abi::Vector { element, count } => scalar_to_clif_type(fx.tcx, element)
|
||||||
|
.by(u32::try_from(count).unwrap())
|
||||||
|
.unwrap(),
|
||||||
_ => unreachable!("{:?}", layout.ty),
|
_ => unreachable!("{:?}", layout.ty),
|
||||||
};
|
};
|
||||||
let mut flags = MemFlags::new();
|
let mut flags = MemFlags::new();
|
||||||
|
Loading…
Reference in New Issue
Block a user