Skip to content

Commit 602999c

Browse files
committed
Add autocast tests
- Correct usage of invalid intrinsics in tests
1 parent 29dca05 commit 602999c

7 files changed

+69
-1
lines changed

tests/run-make/simd-ffi/simd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ extern "C" {
3535
fn integer(a: i32x4, b: i32x4) -> i32x4;
3636
// vmaxq_s32
3737
#[cfg(target_arch = "aarch64")]
38-
#[link_name = "llvm.aarch64.neon.maxs.v4i32"]
38+
#[link_name = "llvm.aarch64.neon.smax.v4i32"]
3939
fn integer(a: i32x4, b: i32x4) -> i32x4;
4040

4141
// Use a generic LLVM intrinsic to do type checking on other platforms
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//@ add-core-stubs
2+
//@ build-pass
3+
//@ ignore-pass
4+
//@ compile-flags: --target aarch64-unknown-linux-gnu
5+
//@ needs-llvm-components: aarch64
6+
#![feature(no_core, lang_items, link_llvm_intrinsics, abi_unadjusted, repr_simd, simd_ffi)]
7+
#![no_std]
8+
#![no_core]
9+
#![allow(internal_features, non_camel_case_types, improper_ctypes)]
10+
#![crate_type = "lib"]
11+
12+
extern crate minicore;
13+
use minicore::*;
14+
15+
#[repr(simd)]
16+
pub struct i8x8([i8; 8]);
17+
18+
extern "unadjusted" {
19+
#[link_name = "llvm.aarch64.neon.rbit.v8i8"]
20+
fn foo(a: i8x8) -> i8x8;
21+
}
22+
23+
#[target_feature(enable = "neon")]
24+
pub unsafe fn bar(a: i8x8) -> i8x8 {
25+
foo(a)
26+
}
27+
28+
//~? NOTE: Using deprecated intrinsic `llvm.aarch64.neon.rbit.v8i8`, `llvm.bitreverse.v8i8` can be used instead
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
note: Using deprecated intrinsic `llvm.aarch64.neon.rbit.v8i8`, `llvm.bitreverse.v8i8` can be used instead
2+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//@ build-fail
2+
3+
#![feature(link_llvm_intrinsics, abi_unadjusted)]
4+
#![allow(internal_features, non_camel_case_types, improper_ctypes)]
5+
6+
extern "unadjusted" {
7+
#[link_name = "llvm.assume"]
8+
fn foo();
9+
}
10+
11+
pub fn main() {
12+
unsafe { foo() }
13+
}
14+
15+
//~? ERROR: Intrinsic signature mismatch for `llvm.assume`: expected signature `void (i1)`
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
error: Intrinsic signature mismatch for `llvm.assume`: expected signature `void (i1)`
2+
3+
error: aborting due to 1 previous error
4+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//@ build-fail
2+
3+
#![feature(link_llvm_intrinsics, abi_unadjusted)]
4+
#![allow(internal_features, non_camel_case_types, improper_ctypes)]
5+
6+
extern "unadjusted" {
7+
#[link_name = "llvm.abcde"]
8+
fn foo();
9+
}
10+
11+
pub fn main() {
12+
unsafe { foo() }
13+
}
14+
15+
//~? ERROR: Invalid LLVM intrinsic: `llvm.abcde`
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
error: Invalid LLVM intrinsic: `llvm.abcde`
2+
3+
error: aborting due to 1 previous error
4+

0 commit comments

Comments
 (0)