-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add assembly tests for simd_reduce_all/simd_reduce_any on x86_64 and …
…aarch64
- Loading branch information
1 parent
55ca959
commit b8b2b8d
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// verify that simd mask reductions do not introduce additional bit shift operations | ||
|
||
// assembly-output: emit-asm | ||
// compile-flags: --crate-type=lib -O --target aarch64-unknown-linux-gnu | ||
// needs-llvm-components: aarch64 | ||
// only-aarch64 | ||
// only-linux | ||
|
||
#![feature(repr_simd, platform_intrinsics)] | ||
#![allow(non_camel_case_types)] | ||
|
||
#[repr(simd)] | ||
#[derive(Copy, Clone)] | ||
pub struct mask8x16([i8; 16]); | ||
|
||
extern "platform-intrinsic" { | ||
fn simd_reduce_all<T>(x: T) -> bool; | ||
fn simd_reduce_any<T>(x: T) -> bool; | ||
} | ||
|
||
// CHECK-LABEL: mask_reduce_all: | ||
#[no_mangle] | ||
pub unsafe fn mask_reduce_all(m: mask8x16) -> bool { | ||
// CHECK: umaxv | ||
simd_reduce_all(m) | ||
} | ||
|
||
// CHECK-LABEL: mask_reduce_any: | ||
#[no_mangle] | ||
pub unsafe fn mask_reduce_any(m: mask8x16) -> bool { | ||
// CHECK: umaxv | ||
simd_reduce_any(m) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// verify that simd mask reductions do not introduce additional bit shift operations | ||
|
||
// assembly-output: emit-asm | ||
// compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel | ||
// only-x86_64 | ||
|
||
#![feature(repr_simd, platform_intrinsics)] | ||
#![allow(non_camel_case_types)] | ||
|
||
#[repr(simd)] | ||
#[derive(Copy, Clone)] | ||
pub struct mask8x16([i8; 16]); | ||
|
||
extern "platform-intrinsic" { | ||
fn simd_reduce_all<T>(x: T) -> bool; | ||
fn simd_reduce_any<T>(x: T) -> bool; | ||
} | ||
|
||
// CHECK-LABEL: mask_reduce_all: | ||
#[no_mangle] | ||
pub unsafe fn mask_reduce_all(m: mask8x16) -> bool { | ||
// CHECK-NOT: psllw | ||
// CHECK: pmovmskb | ||
simd_reduce_all(m) | ||
} | ||
|
||
// CHECK-LABEL: mask_reduce_any: | ||
#[no_mangle] | ||
pub unsafe fn mask_reduce_any(m: mask8x16) -> bool { | ||
// CHECK-NOT: psllw | ||
// CHECK: pmovmskb | ||
simd_reduce_any(m) | ||
} |