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
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
extern crate llvmint;

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

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

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

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

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

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

impl AddS<M8<i16>> for SSE2 {
#[inline(always)]
  fn adds(&self, a: M8<i16>, b: M8<i16>) -> M8<i16> {
    unsafe {
      Multi::wrap(llvmint::x86::sse2_padds_w(a.unwrap(), b.unwrap()))
    }
  }
}

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

impl Min<M8<i16>> for SSE2 {
#[inline(always)]
  fn min(&self, a: M8<i16>, b: M8<i16>) -> M8<i16> {
    unsafe {
      Multi::wrap(llvmint::x86::sse2_pmins_w(a.unwrap(), b.unwrap()))
    }
  }
}

impl Max<M8<i16>> for SSE2 {
#[inline(always)]
  fn max(&self, a: M8<i16>, b: M8<i16>) -> M8<i16> {
    unsafe {
      Multi::wrap(llvmint::x86::sse2_pmaxs_w(a.unwrap(), b.unwrap()))
    }
  }
}

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

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

impl Mullo<M8<i16>> for SSE2 {
#[inline(always)]
  fn mullo(&self, a: M8<i16>, b: M8<i16>) -> M8<i16> {
    Multi::wrap(a.unwrap() * b.unwrap())
  }
}

impl Mulhi<M8<i16>> for SSE2 {
#[inline(always)]
  fn mulhi(&self, a: M8<i16>, b: M8<i16>) -> M8<i16> {
    unsafe {
      Multi::wrap(llvmint::x86::sse2_pmulh_w(a.unwrap(), b.unwrap()))
    }
  }
}

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

impl PackUS<M8<i16>> for SSE2 {
#[inline(always)]
  fn packus(&self, a: M8<i16>, b: M8<i16>) -> M16<i8> {
    unsafe {
      Multi::wrap(llvmint::x86::sse2_packuswb_128(a.unwrap(), b.unwrap()))
    }
  }
}