-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use same code for masked conversion for masked stores and loads
- Loading branch information
1 parent
2abd0f0
commit df7fcb1
Showing
4 changed files
with
122 additions
and
63 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
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,48 @@ | ||
// verify that simd mask reductions do not introduce additional bit shift operations | ||
//@ revisions: x86 aarch64 | ||
//@ [x86] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel | ||
//@ [x86] needs-llvm-components: x86 | ||
//@ [aarch64] compile-flags: --target=aarch64-unknown-linux-gnu | ||
//@ [aarch64] needs-llvm-components: aarch64 | ||
//@ [aarch64] min-llvm-version: 15.0 | ||
//@ assembly-output: emit-asm | ||
//@ compile-flags: --crate-type=lib -O | ||
|
||
#![feature(no_core, lang_items, repr_simd, intrinsics)] | ||
#![no_core] | ||
#![allow(non_camel_case_types)] | ||
|
||
// Because we don't have core yet. | ||
#[lang = "sized"] | ||
pub trait Sized {} | ||
|
||
#[lang = "copy"] | ||
trait Copy {} | ||
|
||
#[repr(simd)] | ||
pub struct mask8x16([i8; 16]); | ||
|
||
extern "rust-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 { | ||
// x86: movdqa | ||
// x86-NEXT: pmovmskb | ||
// aarch64: cmge | ||
// aarch64-NEXT: umaxv | ||
simd_reduce_all(m) | ||
} | ||
|
||
// CHECK-LABEL: mask_reduce_any: | ||
#[no_mangle] | ||
pub unsafe fn mask_reduce_any(m: mask8x16) -> bool { | ||
// x86: movdqa | ||
// x86-NEXT: pmovmskb | ||
// aarch64: cmlt | ||
// aarch64-NEXT: 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
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