diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2015-08-12 16:09:02 -0700 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2015-08-17 14:41:40 -0700 |
| commit | 3e500673cc540828f9ec609f83d07f4e1c271de0 (patch) | |
| tree | fc30d74313c861735beefa52d9ec0e782918b5f3 /src/test/run-fail | |
| parent | 8b68f58fef4ffb833c123f057638484fa59ded76 (diff) | |
| download | rust-3e500673cc540828f9ec609f83d07f4e1c271de0.tar.gz rust-3e500673cc540828f9ec609f83d07f4e1c271de0.zip | |
Fix existing tests for new `#[repr(simd)]`.
Diffstat (limited to 'src/test/run-fail')
| -rw-r--r-- | src/test/run-fail/overflowing-simd-lsh-1.rs | 23 | ||||
| -rw-r--r-- | src/test/run-fail/overflowing-simd-lsh-2.rs | 23 | ||||
| -rw-r--r-- | src/test/run-fail/overflowing-simd-lsh-3.rs | 23 | ||||
| -rw-r--r-- | src/test/run-fail/overflowing-simd-lsh-4.rs | 49 | ||||
| -rw-r--r-- | src/test/run-fail/overflowing-simd-rsh-1.rs | 23 | ||||
| -rw-r--r-- | src/test/run-fail/overflowing-simd-rsh-2.rs | 23 | ||||
| -rw-r--r-- | src/test/run-fail/overflowing-simd-rsh-3.rs | 23 | ||||
| -rw-r--r-- | src/test/run-fail/overflowing-simd-rsh-4.rs | 49 |
8 files changed, 0 insertions, 236 deletions
diff --git a/src/test/run-fail/overflowing-simd-lsh-1.rs b/src/test/run-fail/overflowing-simd-lsh-1.rs deleted file mode 100644 index a3bce00ee07..00000000000 --- a/src/test/run-fail/overflowing-simd-lsh-1.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:thread '<main>' panicked at 'shift operation overflowed' -// compile-flags: -C debug-assertions - -#![feature(core_simd)] - -use std::simd::i32x4; - -// (Work around constant-evaluation) -fn id<T>(x: T) -> T { x } - -fn main() { - let _x = i32x4(1, 0, 0, 0) << id(i32x4(32, 0, 0, 0)); -} diff --git a/src/test/run-fail/overflowing-simd-lsh-2.rs b/src/test/run-fail/overflowing-simd-lsh-2.rs deleted file mode 100644 index e119bd03c88..00000000000 --- a/src/test/run-fail/overflowing-simd-lsh-2.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:thread '<main>' panicked at 'shift operation overflowed' -// compile-flags: -C debug-assertions - -#![feature(core_simd)] - -use std::simd::i32x4; - -// (Work around constant-evaluation) -fn id<T>(x: T) -> T { x } - -fn main() { - let _x = i32x4(1, 0, 0, 0) << id(i32x4(-1, 0, 0, 0)); -} diff --git a/src/test/run-fail/overflowing-simd-lsh-3.rs b/src/test/run-fail/overflowing-simd-lsh-3.rs deleted file mode 100644 index 4fb7fa958f0..00000000000 --- a/src/test/run-fail/overflowing-simd-lsh-3.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:thread '<main>' panicked at 'shift operation overflowed' -// compile-flags: -C debug-assertions - -#![feature(core_simd)] - -use std::simd::u64x2; - -// (Work around constant-evaluation) -fn id<T>(x: T) -> T { x } - -fn main() { - let _x = u64x2(1, 0) << id(u64x2(64, 0)); -} diff --git a/src/test/run-fail/overflowing-simd-lsh-4.rs b/src/test/run-fail/overflowing-simd-lsh-4.rs deleted file mode 100644 index 2fc177ced9d..00000000000 --- a/src/test/run-fail/overflowing-simd-lsh-4.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:thread '<main>' panicked at 'shift operation overflowed' -// compile-flags: -C debug-assertions - -// This function is checking that our automatic truncation does not -// sidestep the overflow checking. - -#![feature(core_simd)] - -use std::simd::i8x16; - -fn eq_i8x16(i8x16(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15): i8x16, - i8x16(y0, y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15): i8x16) - -> bool -{ - (x0 == y0) && (x1 == y1) && (x2 == y2) && (x3 == y3) - && (x4 == y4) && (x5 == y5) && (x6 == y6) && (x7 == y7) - && (x8 == y8) && (x9 == y9) && (x10 == y10) && (x11 == y11) - && (x12 == y12) && (x13 == y13) && (x14 == y14) && (x15 == y15) -} - -// (Work around constant-evaluation) -fn id<T>(x: T) -> T { x } - -fn main() { - // this signals overflow when checking is on - let x = i8x16(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) - << id(i8x16(17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); - - // ... but when checking is off, the fallback will truncate the - // input to its lower three bits (= 1). Note that this is *not* - // the behavior of the x86 processor for 8- and 16-bit types, - // but it is necessary to avoid undefined behavior from LLVM. - // - // We check that here, by ensuring the result has only been - // shifted by one place; if overflow checking is turned off, then - // this assertion will pass (and the compiletest driver will - // report that the test did not produce the error expected above). - assert!(eq_i8x16(x, i8x16(2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))); -} diff --git a/src/test/run-fail/overflowing-simd-rsh-1.rs b/src/test/run-fail/overflowing-simd-rsh-1.rs deleted file mode 100644 index dffd627a084..00000000000 --- a/src/test/run-fail/overflowing-simd-rsh-1.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:thread '<main>' panicked at 'shift operation overflowed' -// compile-flags: -C debug-assertions - -#![feature(core_simd)] - -use std::simd::i32x4; - -// (Work around constant-evaluation) -fn id<T>(x: T) -> T { x } - -fn main() { - let _x = i32x4(-1, 0, 0, 0) >> id(i32x4(32, 0, 0, 0)); -} diff --git a/src/test/run-fail/overflowing-simd-rsh-2.rs b/src/test/run-fail/overflowing-simd-rsh-2.rs deleted file mode 100644 index 2852e147f83..00000000000 --- a/src/test/run-fail/overflowing-simd-rsh-2.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:thread '<main>' panicked at 'shift operation overflowed' -// compile-flags: -C debug-assertions - -#![feature(core_simd)] - -use std::simd::i32x4; - -// (Work around constant-evaluation) -fn id<T>(x: T) -> T { x } - -fn main() { - let _x = i32x4(0, 0, 0, -1) >> id(i32x4(0, 0, 0, -1)); -} diff --git a/src/test/run-fail/overflowing-simd-rsh-3.rs b/src/test/run-fail/overflowing-simd-rsh-3.rs deleted file mode 100644 index 057eaa3f91a..00000000000 --- a/src/test/run-fail/overflowing-simd-rsh-3.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:thread '<main>' panicked at 'shift operation overflowed' -// compile-flags: -C debug-assertions - -#![feature(core_simd)] - -use std::simd::i64x2; - -// (Work around constant-evaluation) -fn id<T>(x: T) -> T { x } - -fn main() { - let _x = i64x2(0, -1) >> id(i64x2(0, 64)); -} diff --git a/src/test/run-fail/overflowing-simd-rsh-4.rs b/src/test/run-fail/overflowing-simd-rsh-4.rs deleted file mode 100644 index a850fff6919..00000000000 --- a/src/test/run-fail/overflowing-simd-rsh-4.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:thread '<main>' panicked at 'shift operation overflowed' -// compile-flags: -C debug-assertions - -// This function is checking that our (type-based) automatic -// truncation does not sidestep the overflow checking. - -#![feature(core_simd)] - -use std::simd::i8x16; - -fn eq_i8x16(i8x16(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15): i8x16, - i8x16(y0, y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15): i8x16) - -> bool -{ - (x0 == y0) && (x1 == y1) && (x2 == y2) && (x3 == y3) - && (x4 == y4) && (x5 == y5) && (x6 == y6) && (x7 == y7) - && (x8 == y8) && (x9 == y9) && (x10 == y10) && (x11 == y11) - && (x12 == y12) && (x13 == y13) && (x14 == y14) && (x15 == y15) -} - -// (Work around constant-evaluation) -fn id<T>(x: T) -> T { x } - -fn main() { - // this signals overflow when checking is on - let x = i8x16(2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) - >> id(i8x16(17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)); - - // ... but when checking is off, the fallback will truncate the - // input to its lower three bits (= 1). Note that this is *not* - // the behavior of the x86 processor for 8- and 16-bit types, - // but it is necessary to avoid undefined behavior from LLVM. - // - // We check that here, by ensuring the result is not zero; if - // overflow checking is turned off, then this assertion will pass - // (and the compiletest driver will report that the test did not - // produce the error expected above). - assert!(eq_i8x16(x, i8x16(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))); -} |
