Skip to content

Commit

Permalink
fixed some stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustavo2622 committed Nov 30, 2023
1 parent 96218c0 commit 5ef792c
Showing 1 changed file with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions libs/lospecs/examples/spec.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ VPBROADCAST_16u16(w1@256) -> @256 =

# REF: https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#techs=MMX,SSE_ALL,AVX_ALL&ig_expand=324,324,101,6663,4774&text=vpmulh
# We want to get the high 16 bits of product, check endianness later
# Lower index = LSB
VPMULH_16u16(w1@256, w2@256) -> @256 =
map<16, 16>(
fun x@16 y@16 . mult<16>(x, y)[0:15],
fun x@16 y@16 . mult<16>(x, y)[16:31],
w1,
w2
)
Expand All @@ -54,15 +55,17 @@ VPMULH_16u16(w1@256, w2@256) -> @256 =
# rshift<n>(x,y): right shift logical x by y (x >> y) as n-bit ints
# sext<n>(x): sign extend x to n bits
# Can be implemented differently from this
# REF: https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#techs=MMX,SSE_ALL,AVX_ALL&ig_expand=324,324,101,6663,4774,4785&text=vpmulhrs
# REF: https://www.felixcloutier.com/x86/pmulhrsw
# Need to check mult here
# mult<16> : 16, 16 -> 32
VPMULHRS_16u16(w1@256, w2@256) -> @256 =
map<16, 16>(
fun x@16 y@16 . add<32>(
rshift<32>(
mult<32>(sext<32>(x),
sext<32>(y)
),
mult<16>(x, y),
14),
1)[16:31],
1)[1:16],
w1,
w2)

Expand Down Expand Up @@ -103,23 +106,23 @@ VPMADDUBSW_256(w1@256, w2@256) -> @256 =
# map<n, x> has type: ((...(a -> b) -> ...) -> c) -> d) -> a[x] -> b[x] -> ... -> c[x] -> d[x]
# | Function that takes args | | Lists of said args | | List of ret type |
# where if a is a type then a[x] is the type of lists of length x with elements with type a
#PACKUS_16u16(w1@256, w2@256) -> @256 =
# map<128, 2>(
# fun v1@128 v2@128 . or<128>(
# map<16,8>(
# fun a@16 . SatToUW<8>(a),
# v1
# ),
# sla<128>(map<16,8>(
# fun a@16 . SatToUW<8>(a),
# v2
# ),
# 64
# )
# )
# w1,
# w2,
# )
PACKUS_16u16(w1@256, w2@256) -> @256 =
map<128, 2>(
fun v1@128 v2@128 . or<128>(
map<16,8>(
fun a@16 . SatToUW<8>(a),
v1
),
sla<128>(map<16,8>(
fun a@16 . SatToUW<8>(a),
v2
),
64
)
),
w1,
w2
)

# TODO:
# Extend map to take in existing functions
Expand Down

0 comments on commit 5ef792c

Please sign in to comment.