Skip to content

Commit

Permalink
Introduce core::simd trait imports in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
workingjubilee committed Jul 21, 2022
1 parent a14404a commit f8aa494
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions library/core/src/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3569,6 +3569,7 @@ impl<T> [T] {
///
/// ```
/// #![feature(portable_simd)]
/// use core::simd::SimdFloat;
///
/// let short = &[1, 2, 3];
/// let (prefix, middle, suffix) = short.as_simd::<4>();
Expand Down
1 change: 1 addition & 0 deletions library/core/tests/simd.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use core::simd::f32x4;
use core::simd::SimdFloat;

#[test]
fn testing() {
Expand Down
2 changes: 1 addition & 1 deletion src/test/codegen/simd-wide-sum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#![crate_type = "lib"]
#![feature(portable_simd)]

use std::simd::Simd;
use std::simd::{Simd, SimdUint};
const N: usize = 8;

#[no_mangle]
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/simd/libm_no_std_cant_float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#![no_std]
#![feature(portable_simd)]
use core::simd::f32x4;
use core::simd::SimdFloat;

// For SIMD float ops, the LLIR version which is used to implement the portable
// forms of them may become calls to math.h AKA libm. So, we can't guarantee
Expand Down
12 changes: 6 additions & 6 deletions src/test/ui/simd/libm_no_std_cant_float.stderr
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
error[E0599]: no method named `ceil` found for struct `Simd` in the current scope
--> $DIR/libm_no_std_cant_float.rs:14:17
--> $DIR/libm_no_std_cant_float.rs:15:17
|
LL | let _xc = x.ceil();
| ^^^^ method not found in `Simd<f32, 4_usize>`

error[E0599]: no method named `floor` found for struct `Simd` in the current scope
--> $DIR/libm_no_std_cant_float.rs:15:17
--> $DIR/libm_no_std_cant_float.rs:16:17
|
LL | let _xf = x.floor();
| ^^^^^ method not found in `Simd<f32, 4_usize>`

error[E0599]: no method named `round` found for struct `Simd` in the current scope
--> $DIR/libm_no_std_cant_float.rs:16:17
--> $DIR/libm_no_std_cant_float.rs:17:17
|
LL | let _xr = x.round();
| ^^^^^ method not found in `Simd<f32, 4_usize>`

error[E0599]: no method named `trunc` found for struct `Simd` in the current scope
--> $DIR/libm_no_std_cant_float.rs:17:17
--> $DIR/libm_no_std_cant_float.rs:18:17
|
LL | let _xt = x.trunc();
| ^^^^^ method not found in `Simd<f32, 4_usize>`

error[E0599]: no method named `mul_add` found for struct `Simd` in the current scope
--> $DIR/libm_no_std_cant_float.rs:18:19
--> $DIR/libm_no_std_cant_float.rs:19:19
|
LL | let _xfma = x.mul_add(x, x);
| ^^^^^^^ method not found in `Simd<f32, 4_usize>`

error[E0599]: no method named `sqrt` found for struct `Simd` in the current scope
--> $DIR/libm_no_std_cant_float.rs:19:20
--> $DIR/libm_no_std_cant_float.rs:20:20
|
LL | let _xsqrt = x.sqrt();
| ^^^^ method not found in `Simd<f32, 4_usize>`
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/simd/libm_std_can_float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// This is the converse of the other libm test.
#![feature(portable_simd)]
use std::simd::f32x4;
use std::simd::StdFloat;
use std::simd::{SimdFloat, StdFloat};

// For SIMD float ops, the LLIR version which is used to implement the portable
// forms of them may become calls to math.h AKA libm. So, we can't guarantee
Expand Down

0 comments on commit f8aa494

Please sign in to comment.