Skip to content

Commit f07cbd1

Browse files
committed
Combine assembly mask reduce tests for x86 and aarch64
1 parent 08d03fe commit f07cbd1

File tree

3 files changed

+47
-66
lines changed

3 files changed

+47
-66
lines changed

tests/assembly/aarch64-simd-mask-reduce.rs

Lines changed: 0 additions & 33 deletions
This file was deleted.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// verify that simd mask reductions do not introduce additional bit shift operations
2+
// revisions: x86 aarch64
3+
// [x86] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel
4+
// [x86] needs-llvm-components: x86
5+
// [aarch64] compile-flags: --target=aarch64-unknown-linux-gnu
6+
// [aarch64] needs-llvm-components: aarch64
7+
// assembly-output: emit-asm
8+
// compile-flags: --crate-type=lib -O
9+
10+
#![feature(no_core, lang_items, repr_simd, platform_intrinsics)]
11+
#![no_core]
12+
#![allow(non_camel_case_types)]
13+
14+
// Because we don't have core yet.
15+
#[lang = "sized"]
16+
pub trait Sized {}
17+
18+
#[lang = "copy"]
19+
trait Copy {}
20+
21+
#[repr(simd)]
22+
pub struct mask8x16([i8; 16]);
23+
24+
extern "platform-intrinsic" {
25+
fn simd_reduce_all<T>(x: T) -> bool;
26+
fn simd_reduce_any<T>(x: T) -> bool;
27+
}
28+
29+
// CHECK-LABEL: mask_reduce_all:
30+
#[no_mangle]
31+
pub unsafe fn mask_reduce_all(m: mask8x16) -> bool {
32+
// x86: movdqa
33+
// x86-NEXT: pmovmskb
34+
// aarch64: cmgt
35+
// aarch64-NEXT: umaxv
36+
simd_reduce_all(m)
37+
}
38+
39+
// CHECK-LABEL: mask_reduce_any:
40+
#[no_mangle]
41+
pub unsafe fn mask_reduce_any(m: mask8x16) -> bool {
42+
// x86: movdqa
43+
// x86-NEXT: pmovmskb
44+
// aarch64: cmlt
45+
// aarch64-NEXT: umaxv
46+
simd_reduce_any(m)
47+
}

tests/assembly/x86_64-simd-mask-reduce.rs

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)