Skip to content

Compile examples on CI #329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions crates/stdsimd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,11 @@ strict = [ "coresimd/strict" ]
# Internal-usage only: enables only those intrinsics supported by Intel's
# Software Development Environment (SDE).
intel_sde = [ "coresimd/intel_sde" ]

[[example]]
name = "hex"
path = "../../examples/hex.rs"

[[example]]
name = "nbody"
path = "../../examples/nbody.rs"
17 changes: 8 additions & 9 deletions examples/hex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,12 @@
//!
//! You can test out this program via:
//!
//! echo test | cargo +nightly run --release --example hex
//! echo test | cargo +nightly run --release --example hex -p stdsimd
//!
//! and you should see `746573740a` get printed out.

#![feature(cfg_target_feature, target_feature)]
#![feature(cfg_target_feature, target_feature, stdsimd)]
#![cfg_attr(test, feature(test))]
#![cfg_attr(feature = "cargo-clippy",
allow(result_unwrap_used, option_unwrap_used, print_stdout,
missing_docs_in_private_items, shadow_reuse,
cast_possible_wrap, cast_sign_loss))]

#[macro_use]
extern crate stdsimd;
Expand All @@ -29,7 +25,10 @@ extern crate quickcheck;
use std::str;
use std::io::{self, Read};

use stdsimd::vendor::*;
#[cfg(target_arch = "x86")]
use stdsimd::arch::x86::*;
#[cfg(target_arch = "x86_64")]
use stdsimd::arch::x86_64::*;

fn main() {
let mut input = Vec::new();
Expand Down Expand Up @@ -175,7 +174,7 @@ fn hex_encode_fallback<'a>(
unsafe { Ok(str::from_utf8_unchecked(&dst[..src.len() * 2])) }
}

// Run these with `cargo +nightly test --example hex`
// Run these with `cargo +nightly test --example hex -p stdsimd`
#[cfg(test)]
mod tests {
use std::iter;
Expand Down Expand Up @@ -281,7 +280,7 @@ mod tests {
}
}

// Run these with `cargo +nightly bench --example hex`
// Run these with `cargo +nightly bench --example hex -p stdsimd`
#[cfg(test)]
mod benches {
extern crate rand;
Expand Down
15 changes: 11 additions & 4 deletions examples/nbody.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! html#nbody

#![cfg_attr(feature = "strict", deny(warnings))]
#![feature(cfg_target_feature)]
#![feature(cfg_target_feature, stdsimd)]
#![feature(target_feature)]
#![cfg_attr(feature = "cargo-clippy",
allow(similar_names, missing_docs_in_private_items,
Expand All @@ -27,7 +27,10 @@ impl Frsqrt for f64x2 {
#[cfg(all(any(target_arch = "x86", target_arch = "x86_64"),
target_feature = "sse"))]
{
use stdsimd::vendor::*;
#[cfg(target_arch = "x86")]
use stdsimd::arch::x86::*;
#[cfg(target_arch = "x86_64")]
use stdsimd::arch::x86_64::*;

let t = self.as_f32x2();

Expand All @@ -45,8 +48,12 @@ impl Frsqrt for f64x2 {
#[cfg(all(any(target_arch = "arm", target_arch = "aarch64"),
target_feature = "neon"))]
{
use self::stdsimd::vendor;
unsafe { vendor::vrsqrte_f32(self.as_f32x2()).as_f64x2() }
#[cfg(target_arch = "arm")]
use stdsimd::arch::arm::*;
#[cfg(target_arch = "aarch64")]
use stdsimd::arch::aarch64::*;

unsafe { vrsqrte_f32(self.as_f32x2()).as_f64x2() }
}
#[cfg(not(any(all(any(target_arch = "x86",
target_arch = "x86_64"),
Expand Down