Skip to content

Commit

Permalink
rm
Browse files Browse the repository at this point in the history
  • Loading branch information
guzba committed Aug 3, 2022
1 parent 437b42d commit 6751860
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 106 deletions.
6 changes: 3 additions & 3 deletions examples/basic.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import nimsimd/sse2

# SIMD floating point multiplication
let
a = m128(1.0) # Vector of 4 float32 each with value 1.0
b = m128(2.0) # Vector of 4 float32 each with value 2.0
c = a * b # SIMD vector multiplication operator
a = mm_set1_ps(1.0) # Vector of 4 float32 each with value 1.0
b = mm_set1_ps(2.0) # Vector of 4 float32 each with value 2.0
c = mm_mul_ps(a, b) # SIMD vector multiplication operator

# Cast the vector to echo as separate float32 values
echo cast[array[4, float32]](c)
100 changes: 0 additions & 100 deletions src/nimsimd/sse2.nim
Original file line number Diff line number Diff line change
Expand Up @@ -663,103 +663,3 @@ func mm_xor_pd*(a, b: M128d): M128d {.importc: "_mm_xor_pd".}
func mm_xor_si128*(a, b: M128i): M128i {.importc: "_mm_xor_si128".}

{.pop.}

# For readability

func m128*(): M128 {.inline.} = mm_setzero_ps()

func m128*(a: float32): M128 {.inline.} = mm_set1_ps(a)

func m128d*(): M128d {.inline.} = mm_setzero_pd()

func m128i*(): M128i {.inline.} = mm_setzero_si128()

func m128d*(a: float64): M128d {.inline.} = mm_set1_pd(a)

func m128i*(a: int32): M128i {.inline.} = mm_set1_epi32(a)

func `and`*(a, b: M128): M128 {.inline.} = mm_and_ps(a, b)

func `and`*(a, b: M128d): M128d {.inline.} = mm_and_pd(a, b)

func `and`*(a, b: M128i): M128i {.inline.} = mm_and_si128(a, b)

func `or`*(a, b: M128): M128 {.inline.} = mm_or_ps(a, b)

func `or`*(a, b: M128d): M128d {.inline.} = mm_or_pd(a, b)

func `or`*(a, b: M128i): M128i {.inline.} = mm_or_si128(a, b)

func `xor`*(a, b: M128): M128 {.inline.} = mm_xor_ps(a, b)

func `xor`*(a, b: M128d): M128d {.inline.} = mm_xor_pd(a, b)

func `xor`*(a, b: M128i): M128i {.inline.} = mm_xor_si128(a, b)

func `==`*(a, b: M128): M128 {.inline.} = mm_cmpeq_ps(a, b)

func `==`*(a, b: M128d): M128d {.inline.} = mm_cmpeq_pd(a, b)

func `!=`*(a, b: M128): M128 {.inline.} = mm_cmpneq_ps(a, b)

func `!=`*(a, b: M128d): M128d {.inline.} = mm_cmpneq_pd(a, b)

func `>`*(a, b: M128): M128 {.inline.} = mm_cmpgt_ps(a, b)

func `>`*(a, b: M128d): M128d {.inline.} = mm_cmpgt_pd(a, b)

func `>=`*(a, b: M128): M128 {.inline.} = mm_cmpge_ps(a, b)

func `>=`*(a, b: M128d): M128d {.inline.} = mm_cmpge_pd(a, b)

func `<`*(a, b: M128): M128 {.inline.} = mm_cmplt_ps(a, b)

func `<`*(a, b: M128d): M128d {.inline.} = mm_cmplt_pd(a, b)

func `<=`*(a, b: M128): M128 {.inline.} = mm_cmple_ps(a, b)

func `<=`*(a, b: M128d): M128d {.inline.} = mm_cmple_pd(a, b)

func `+`*(a, b: M128): M128 {.inline.} = mm_add_ps(a, b)

func `+`*(a, b: M128d): M128d {.inline.} = mm_add_pd(a, b)

func `+=`*(a: var M128, b: M128) {.inline.} = a = a + b

func `+=`*(a: var M128d, b: M128d) {.inline.} = a = a + b

func `-`*(a, b: M128): M128 {.inline.} = mm_sub_ps(a, b)

func `-`*(a, b: M128d): M128d {.inline.} = mm_sub_pd(a, b)

func `-=`*(a: var M128, b: M128) {.inline.} = a = a - b

func `-=`*(a: var M128d, b: M128d) {.inline.} = a = a - b

func `*`*(a, b: M128): M128 {.inline.} = mm_mul_ps(a, b)

func `*`*(a, b: M128d): M128d {.inline.} = mm_mul_pd(a, b)

func `*=`*(a: var M128, b: M128) {.inline.} = a = a * b

func `*=`*(a: var M128d, b: M128d) {.inline.} = a = a * b

func `/`*(a, b: M128): M128 {.inline.} = mm_div_ps(a, b)

func `/`*(a, b: M128d): M128d {.inline.} = mm_div_pd(a, b)

func `/=`*(a: var M128, b: M128) {.inline.} = a = a / b

func `/=`*(a: var M128d, b: M128d) {.inline.} = a = a / b

func max*(a, b: M128): M128 {.inline.} = mm_max_ps(a, b)

func max*(a, b: M128d): M128d {.inline.} = mm_max_pd(a, b)

func min*(a, b: M128): M128 {.inline.} = mm_min_ps(a, b)

func min*(a, b: M128d): M128d {.inline.} = mm_min_pd(a, b)

func sqrt*(a: M128): M128 {.inline.} = mm_sqrt_ps(a)

func sqrt*(a: M128d): M128d {.inline.} = mm_sqrt_pd(a)
6 changes: 3 additions & 3 deletions tests/test.nim
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import nimsimd/sse42

let
a = m128(1.0)
b = m128(2.0)
c = a * b
a = mm_set1_ps(1.0)
b = mm_set1_ps(2.0)
c = mm_mul_ps(a, b)

doAssert cast[array[4, float32]](c) == [2.0.float32, 2.0, 2.0, 2.0]

0 comments on commit 6751860

Please sign in to comment.