Skip to content

Commit a5e7383

Browse files
authored
Merge pull request rust-lang#32 from alexcrichton/tests2
Migrate existing tests to #[assert_instr]
2 parents 55677c8 + 97f9eea commit a5e7383

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+97
-644
lines changed

CONTRIBUTING.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ example for `_mm_adds_epi16`:
1414
/// Add packed 16-bit integers in `a` and `b` using saturation.
1515
#[inline(always)]
1616
#[target_feature = "+sse2"]
17+
#[cfg_attr(test, assert_instr(paddsw))]
1718
pub fn _mm_adds_epi16(a: i16x8, b: i16x8) -> i16x8 {
1819
unsafe { paddsw(a, b) }
1920
}
@@ -32,6 +33,10 @@ Let's break this down:
3233
support `sse2`, the compiler will still generate code for `_mm_adds_epi16`
3334
*as if* `sse2` support existed. Without this attribute, the compiler might
3435
not generate the intended CPU instruction.
36+
* The `#[cfg_attr(test, assert_instr(paddsw))]` attribute indicates that when
37+
we're testing the crate we'll assert that the `paddsw` instruction is
38+
generated inside this function, ensuring that the SIMD intrinsic truly is an
39+
intrinsic for the instruction!
3540
* The types of the vectors given to the intrinsic should generally match the
3641
types as provided in the vendor interface. We'll talk about this more below.
3742
* The implementation of the vendor intrinsic is generally very simple.
@@ -40,7 +45,7 @@ Let's break this down:
4045
compiler intrinsic (in this case, `paddsw`) when one is available. More on
4146
this below as well.
4247

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

4651
```rust

asm/x86_bmi2_bzhi.asm

Lines changed: 0 additions & 12 deletions
This file was deleted.

asm/x86_bmi2_bzhi.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

asm/x86_bmi2_mulx.asm

Lines changed: 0 additions & 17 deletions
This file was deleted.

asm/x86_bmi2_mulx.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

asm/x86_bmi2_pdep.asm

Lines changed: 0 additions & 12 deletions
This file was deleted.

asm/x86_bmi2_pdep.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

asm/x86_bmi2_pext.asm

Lines changed: 0 additions & 12 deletions
This file was deleted.

asm/x86_bmi2_pext.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

asm/x86_bmi_andn.asm

Lines changed: 0 additions & 12 deletions
This file was deleted.

asm/x86_bmi_andn.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

asm/x86_bmi_bextr.asm

Lines changed: 0 additions & 32 deletions
This file was deleted.

asm/x86_bmi_bextr.rs

Lines changed: 0 additions & 21 deletions
This file was deleted.

asm/x86_bmi_blsi.asm

Lines changed: 0 additions & 12 deletions
This file was deleted.

asm/x86_bmi_blsi.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

asm/x86_bmi_blsr.asm

Lines changed: 0 additions & 12 deletions
This file was deleted.

asm/x86_bmi_blsr.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

asm/x86_bmi_tzcnt.asm

Lines changed: 0 additions & 12 deletions
This file was deleted.

asm/x86_bmi_tzcnt.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

asm/x86_lzcnt_lzcnt.asm

Lines changed: 0 additions & 12 deletions
This file was deleted.

asm/x86_lzcnt_lzcnt.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

asm/x86_popcnt_popcnt.asm

Lines changed: 0 additions & 12 deletions
This file was deleted.

asm/x86_popcnt_popcnt.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

asm/x86_tbm_blcfill.asm

Lines changed: 0 additions & 12 deletions
This file was deleted.

asm/x86_tbm_blcfill.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

asm/x86_tbm_blci.asm

Lines changed: 0 additions & 12 deletions
This file was deleted.

asm/x86_tbm_blci.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)