diff options
| author | gnzlbg <gonzalobg88@gmail.com> | 2019-09-24 17:02:01 +0200 |
|---|---|---|
| committer | gnzlbg <gonzalobg88@gmail.com> | 2019-09-24 17:02:01 +0200 |
| commit | e6239bb81796715f66ec468b70d8779f8ccac6bd (patch) | |
| tree | 71f11accb3c9db14b69e09e793a6a5e1cab25592 | |
| parent | f0bbd2b71c4861efc11599fe763f80b5de4490cd (diff) | |
| download | rust-e6239bb81796715f66ec468b70d8779f8ccac6bd.tar.gz rust-e6239bb81796715f66ec468b70d8779f8ccac6bd.zip | |
Add some more tests
| -rw-r--r-- | src/test/ui/consts/const-eval/simd/insert_extract.rs | 47 | ||||
| -rw-r--r-- | src/test/ui/consts/const-eval/simd/insert_extract.stderr | 276 |
2 files changed, 296 insertions, 27 deletions
diff --git a/src/test/ui/consts/const-eval/simd/insert_extract.rs b/src/test/ui/consts/const-eval/simd/insert_extract.rs index a0f088cc636..136965bf68a 100644 --- a/src/test/ui/consts/const-eval/simd/insert_extract.rs +++ b/src/test/ui/consts/const-eval/simd/insert_extract.rs @@ -5,20 +5,49 @@ #![allow(non_camel_case_types)] #[repr(simd)] struct i8x1(i8); +#[repr(simd)] struct u16x2(u16, u16); +#[repr(simd)] struct f32x3(f32, f32, f32); extern "platform-intrinsic" { fn simd_insert<T, U>(x: T, idx: u32, val: U) -> T; fn simd_extract<T, U>(x: T, idx: u32) -> U; } -const fn foo(x: i8x1) -> i8 { - unsafe { simd_insert(x, 0_u32, 42_i8) }.0 -} - fn main() { - const V: i8x1 = i8x1(13); - const X: i8 = foo(V); - const Y: i8 = unsafe { simd_extract(V, 0) }; - assert_eq!(X, 42); - assert_eq!(Y, 13); + { + const U: i8x1 = i8x1(13); + const V: i8x1 = unsafe { simd_insert(U, 0_u32, 42_i8) }; + const X0: i8 = V.0; + const Y0: i8 = unsafe { simd_extract(V, 0) }; + assert_eq!(X0, 42); + assert_eq!(Y0, 42); + } + { + const U: u16x2 = u16x2(13, 14); + const V: u16x2 = unsafe { simd_insert(U, 1_u32, 42_u16) }; + const X0: u16 = V.0; + const X1: u16 = V.1; + const Y0: u16 = unsafe { simd_extract(V, 0) }; + const Y1: u16 = unsafe { simd_extract(V, 1) }; + assert_eq!(X0, 13); + assert_eq!(X1, 42); + assert_eq!(Y0, 13); + assert_eq!(Y1, 42); + } + { + const U: f32x3 = f32x3(13., 14., 15.); + const V: f32x3 = unsafe { simd_insert(U, 1_u32, 42_f32) }; + const X0: f32 = V.0; + const X1: f32 = V.1; + const X2: f32 = V.2; + const Y0: f32 = unsafe { simd_extract(V, 0) }; + const Y1: f32 = unsafe { simd_extract(V, 1) }; + const Y2: f32 = unsafe { simd_extract(V, 2) }; + assert_eq!(X0, 13.); + assert_eq!(X1, 42.); + assert_eq!(X2, 15.); + assert_eq!(Y0, 13.); + assert_eq!(Y1, 42.); + assert_eq!(Y2, 15.); + } } diff --git a/src/test/ui/consts/const-eval/simd/insert_extract.stderr b/src/test/ui/consts/const-eval/simd/insert_extract.stderr index 51510273a79..8975241403e 100644 --- a/src/test/ui/consts/const-eval/simd/insert_extract.stderr +++ b/src/test/ui/consts/const-eval/simd/insert_extract.stderr @@ -1,48 +1,288 @@ warning: skipping const checks - --> $DIR/insert_extract.rs:22:5 + --> $DIR/insert_extract.rs:22:9 | -LL | assert_eq!(X, 42); - | ^^^^^^^^^^^^^^^^^^ +LL | assert_eq!(X0, 42); + | ^^^^^^^^^^^^^^^^^^^ | = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) warning: skipping const checks - --> $DIR/insert_extract.rs:22:5 + --> $DIR/insert_extract.rs:22:9 | -LL | assert_eq!(X, 42); - | ^^^^^^^^^^^^^^^^^^ +LL | assert_eq!(X0, 42); + | ^^^^^^^^^^^^^^^^^^^ | = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) warning: skipping const checks - --> $DIR/insert_extract.rs:22:5 + --> $DIR/insert_extract.rs:22:9 | -LL | assert_eq!(X, 42); - | ^^^^^^^^^^^^^^^^^^ +LL | assert_eq!(X0, 42); + | ^^^^^^^^^^^^^^^^^^^ | = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) warning: skipping const checks - --> $DIR/insert_extract.rs:23:5 + --> $DIR/insert_extract.rs:23:9 | -LL | assert_eq!(Y, 13); - | ^^^^^^^^^^^^^^^^^^ +LL | assert_eq!(Y0, 42); + | ^^^^^^^^^^^^^^^^^^^ | = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) warning: skipping const checks - --> $DIR/insert_extract.rs:23:5 + --> $DIR/insert_extract.rs:23:9 | -LL | assert_eq!(Y, 13); - | ^^^^^^^^^^^^^^^^^^ +LL | assert_eq!(Y0, 42); + | ^^^^^^^^^^^^^^^^^^^ | = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) warning: skipping const checks - --> $DIR/insert_extract.rs:23:5 + --> $DIR/insert_extract.rs:23:9 | -LL | assert_eq!(Y, 13); - | ^^^^^^^^^^^^^^^^^^ +LL | assert_eq!(Y0, 42); + | ^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:32:9 + | +LL | assert_eq!(X0, 13); + | ^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:32:9 + | +LL | assert_eq!(X0, 13); + | ^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:32:9 + | +LL | assert_eq!(X0, 13); + | ^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:33:9 + | +LL | assert_eq!(X1, 42); + | ^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:33:9 + | +LL | assert_eq!(X1, 42); + | ^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:33:9 + | +LL | assert_eq!(X1, 42); + | ^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:34:9 + | +LL | assert_eq!(Y0, 13); + | ^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:34:9 + | +LL | assert_eq!(Y0, 13); + | ^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:34:9 + | +LL | assert_eq!(Y0, 13); + | ^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:35:9 + | +LL | assert_eq!(Y1, 42); + | ^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:35:9 + | +LL | assert_eq!(Y1, 42); + | ^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:35:9 + | +LL | assert_eq!(Y1, 42); + | ^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:46:9 + | +LL | assert_eq!(X0, 13.); + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:46:9 + | +LL | assert_eq!(X0, 13.); + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:46:9 + | +LL | assert_eq!(X0, 13.); + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:47:9 + | +LL | assert_eq!(X1, 42.); + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:47:9 + | +LL | assert_eq!(X1, 42.); + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:47:9 + | +LL | assert_eq!(X1, 42.); + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:48:9 + | +LL | assert_eq!(X2, 15.); + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:48:9 + | +LL | assert_eq!(X2, 15.); + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:48:9 + | +LL | assert_eq!(X2, 15.); + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:49:9 + | +LL | assert_eq!(Y0, 13.); + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:49:9 + | +LL | assert_eq!(Y0, 13.); + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:49:9 + | +LL | assert_eq!(Y0, 13.); + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:50:9 + | +LL | assert_eq!(Y1, 42.); + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:50:9 + | +LL | assert_eq!(Y1, 42.); + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:50:9 + | +LL | assert_eq!(Y1, 42.); + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:51:9 + | +LL | assert_eq!(Y2, 15.); + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:51:9 + | +LL | assert_eq!(Y2, 15.); + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +warning: skipping const checks + --> $DIR/insert_extract.rs:51:9 + | +LL | assert_eq!(Y2, 15.); + | ^^^^^^^^^^^^^^^^^^^^ | = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) |
