| 1 |
!sum |
| 2 |
# Average (unsigned byte, unsigned word) |
| 3 |
# Instructions: VPAVGB, VPAVGW |
| 4 |
- go: Average |
| 5 |
asm: "VPAVG[BW]" # Matches VPAVGB (byte) and VPAVGW (word) |
| 6 |
in: |
| 7 |
- &uint_t # $t will be Uint8xN for VPAVGB, Uint16xN for VPAVGW |
| 8 |
go: $t |
| 9 |
base: uint |
| 10 |
- *uint_t |
| 11 |
out: |
| 12 |
- *uint_t |
| 13 |
|
| 14 |
# Absolute Value (signed byte, word, dword, qword) |
| 15 |
# Instructions: VPABSB, VPABSW, VPABSD, VPABSQ |
| 16 |
- go: Abs |
| 17 |
asm: "VPABS[BWDQ]" # Matches VPABSB, VPABSW, VPABSD, VPABSQ |
| 18 |
in: |
| 19 |
- &int_t # $t will be Int8xN, Int16xN, Int32xN, Int64xN |
| 20 |
go: $t |
| 21 |
base: int |
| 22 |
out: |
| 23 |
- *int_t # Output is magnitude, fits in the same signed type |
| 24 |
|
| 25 |
# Sign Operation (signed byte, word, dword) |
| 26 |
# Applies sign of second operand to the first. |
| 27 |
# Instructions: VPSIGNB, VPSIGNW, VPSIGND |
| 28 |
- go: CopySign |
| 29 |
asm: "VPSIGN[BWD]" # Matches VPSIGNB, VPSIGNW, VPSIGND |
| 30 |
in: |
| 31 |
- *int_t # value to apply sign to |
| 32 |
- *int_t # value from which to take the sign |
| 33 |
out: |
| 34 |
- *int_t |
| 35 |
|
| 36 |
# Population Count (count set bits in each element) |
| 37 |
# Instructions: VPOPCNTB, VPOPCNTW (AVX512_BITALG) |
| 38 |
# VPOPCNTD, VPOPCNTQ (AVX512_VPOPCNTDQ) |
| 39 |
- go: OnesCount |
| 40 |
asm: "VPOPCNT[BWDQ]" |
| 41 |
in: |
| 42 |
- &any |
| 43 |
go: $t |
| 44 |
out: |
| 45 |
- *any |