1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
extern crate llvmint;

use super::super::super::super::*;
use super::super::super::super::core::*;
use super::super::SSE2;

impl CmpEq<M4<i32>> for SSE2 {
#[inline(always)]
  fn cmpeq(&self, a: M4<i32>, b: M4<i32>) -> M4<i32> {
    Multi::wrap(a.unwrap() == b.unwrap())
  }
}

impl CmpGt<M4<i32>> for SSE2 {
#[inline(always)]
  fn cmpgt(&self, a: M4<i32>, b: M4<i32>) -> M4<i32> {
    Multi::wrap(a.unwrap() > b.unwrap())
  }
}

impl CmpLt<M4<i32>> for SSE2 {
#[inline(always)]
  fn cmplt(&self, a: M4<i32>, b: M4<i32>) -> M4<i32> {
    Multi::wrap(a.unwrap() < b.unwrap())
  }
}

impl Set1<M4<i32>> for SSE2 {
#[inline(always)]
  fn set1(&self, a: i32) -> M4<i32> {
    Twice{
      lo: Twice{lo: a, hi: a},
      hi: Twice{lo: a, hi: a}
    }
  }
}

impl Add<M4<i32>> for SSE2 {
#[inline(always)]
  fn add(&self, a: M4<i32>, b: M4<i32>) -> M4<i32> {
    Multi::wrap(a.unwrap() + b.unwrap())
  }
}

impl Shli<M4<i32>> for SSE2 {
#[inline(always)]
  fn shli(&self, a: M4<i32>, i: i32) -> M4<i32> {
    unsafe {
      Multi::wrap(llvmint::x86::sse2_pslli_d(a.unwrap(), i))
    }
  }
}

impl Shri<M4<i32>> for SSE2 {
#[inline(always)]
  fn shri(&self, a: M4<i32>, i: i32) -> M4<i32> {
    unsafe {
      Multi::wrap(llvmint::x86::sse2_psrli_d(a.unwrap(), i))
    }
  }
}

impl PackS<M4<i32>> for SSE2 {
#[inline(always)]
  fn packs(&self, a: M4<i32>, b: M4<i32>) -> M8<i16> {
    unsafe {
      Multi::wrap(llvmint::x86::sse2_packssdw_128(a.unwrap(), b.unwrap()))
    }
  }
}