Skip to content

Commit

Permalink
Merge pull request rust-lang#32 from alexcrichton/tests2
Browse files Browse the repository at this point in the history
Migrate existing tests to #[assert_instr]
  • Loading branch information
alexcrichton committed Sep 20, 2017
2 parents 55677c8 + 97f9eea commit a5e7383
Show file tree
Hide file tree
Showing 49 changed files with 97 additions and 644 deletions.
7 changes: 6 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ example for `_mm_adds_epi16`:
/// Add packed 16-bit integers in `a` and `b` using saturation.
#[inline(always)]
#[target_feature = "+sse2"]
#[cfg_attr(test, assert_instr(paddsw))]
pub fn _mm_adds_epi16(a: i16x8, b: i16x8) -> i16x8 {
unsafe { paddsw(a, b) }
}
Expand All @@ -32,6 +33,10 @@ Let's break this down:
support `sse2`, the compiler will still generate code for `_mm_adds_epi16`
*as if* `sse2` support existed. Without this attribute, the compiler might
not generate the intended CPU instruction.
* The `#[cfg_attr(test, assert_instr(paddsw))]` attribute indicates that when
we're testing the crate we'll assert that the `paddsw` instruction is
generated inside this function, ensuring that the SIMD intrinsic truly is an
intrinsic for the instruction!
* The types of the vectors given to the intrinsic should generally match the
types as provided in the vendor interface. We'll talk about this more below.
* The implementation of the vendor intrinsic is generally very simple.
Expand All @@ -40,7 +45,7 @@ Let's break this down:
compiler intrinsic (in this case, `paddsw`) when one is available. More on
this below as well.

Once a function has been added, you should add at least one test for basic
Once a function has been added, you should also add at least one test for basic
functionality. Here's an example for `_mm_adds_epi16`:

```rust
Expand Down
12 changes: 0 additions & 12 deletions asm/x86_bmi2_bzhi.asm

This file was deleted.

11 changes: 0 additions & 11 deletions asm/x86_bmi2_bzhi.rs

This file was deleted.

17 changes: 0 additions & 17 deletions asm/x86_bmi2_mulx.asm

This file was deleted.

11 changes: 0 additions & 11 deletions asm/x86_bmi2_mulx.rs

This file was deleted.

12 changes: 0 additions & 12 deletions asm/x86_bmi2_pdep.asm

This file was deleted.

11 changes: 0 additions & 11 deletions asm/x86_bmi2_pdep.rs

This file was deleted.

12 changes: 0 additions & 12 deletions asm/x86_bmi2_pext.asm

This file was deleted.

11 changes: 0 additions & 11 deletions asm/x86_bmi2_pext.rs

This file was deleted.

12 changes: 0 additions & 12 deletions asm/x86_bmi_andn.asm

This file was deleted.

11 changes: 0 additions & 11 deletions asm/x86_bmi_andn.rs

This file was deleted.

32 changes: 0 additions & 32 deletions asm/x86_bmi_bextr.asm

This file was deleted.

21 changes: 0 additions & 21 deletions asm/x86_bmi_bextr.rs

This file was deleted.

12 changes: 0 additions & 12 deletions asm/x86_bmi_blsi.asm

This file was deleted.

11 changes: 0 additions & 11 deletions asm/x86_bmi_blsi.rs

This file was deleted.

12 changes: 0 additions & 12 deletions asm/x86_bmi_blsr.asm

This file was deleted.

11 changes: 0 additions & 11 deletions asm/x86_bmi_blsr.rs

This file was deleted.

12 changes: 0 additions & 12 deletions asm/x86_bmi_tzcnt.asm

This file was deleted.

11 changes: 0 additions & 11 deletions asm/x86_bmi_tzcnt.rs

This file was deleted.

12 changes: 0 additions & 12 deletions asm/x86_lzcnt_lzcnt.asm

This file was deleted.

11 changes: 0 additions & 11 deletions asm/x86_lzcnt_lzcnt.rs

This file was deleted.

12 changes: 0 additions & 12 deletions asm/x86_popcnt_popcnt.asm

This file was deleted.

11 changes: 0 additions & 11 deletions asm/x86_popcnt_popcnt.rs

This file was deleted.

12 changes: 0 additions & 12 deletions asm/x86_tbm_blcfill.asm

This file was deleted.

11 changes: 0 additions & 11 deletions asm/x86_tbm_blcfill.rs

This file was deleted.

12 changes: 0 additions & 12 deletions asm/x86_tbm_blci.asm

This file was deleted.

11 changes: 0 additions & 11 deletions asm/x86_tbm_blci.rs

This file was deleted.

Loading

0 comments on commit a5e7383

Please sign in to comment.