Skip to content

Commit 9dfb7d3

Browse files
committed
This commit adds AVX2 instruction vpand.
Signed-off-by: dkostic <[email protected]>
1 parent 57008ee commit 9dfb7d3

File tree

5 files changed

+19
-1
lines changed

5 files changed

+19
-1
lines changed

x86/allowed_asm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@
120120
: testq$
121121
: vpxor$
122122
: vpaddw$
123+
: vpand$
123124
: vpmulhw$
124125
: vpmullw$
125126
: vpsubw$

x86/proofs/decode.ml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,10 @@ let decode_aux = new_definition `!pfxs rex l. decode_aux pfxs rex l =
594594
let sz = vexL_size L in
595595
(read_ModRM rex l >>= \((reg,rm),l).
596596
SOME (VPMULLW (mmreg reg sz) (mmreg v sz) (simd_of_RM sz rm),l))
597+
| [0xdb:8] ->
598+
let sz = vexL_size L in
599+
(read_ModRM rex l >>= \((reg,rm),l).
600+
SOME (VPAND (mmreg reg sz) (mmreg v sz) (simd_of_RM sz rm),l))
597601
| [0xe5:8] ->
598602
let sz = vexL_size L in
599603
(read_ModRM rex l >>= \((reg,rm),l).

x86/proofs/instruction.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ let instruction_INDUCTION,instruction_RECURSION = define_type
305305
| TEST operand operand
306306
| TZCNT operand operand
307307
| VPADDW operand operand operand
308+
| VPAND operand operand operand
308309
| VPMULHW operand operand operand
309310
| VPMULLW operand operand operand
310311
| VPSUBW operand operand operand

x86/proofs/simulator.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ let iclasses = iclasses @
296296
[0xc4; 0x41; 0x45; 0xfd; 0xdb]; (* VPADDW (%_% ymm11) (%_% ymm7) (%_% ymm11) *)
297297
[0xc5; 0x7d; 0xd5; 0xc9]; (* VPMULLW (%_% ymm1) (%_% ymm0) (%_% ymm9) *)
298298
[0xc5; 0x45; 0xe5; 0xfb]; (* VPMULHW (%_% ymm15) (%_% ymm7) (%_% ymm3) *)
299+
[0xc5; 0xa5; 0xdb; 0xd2]; (* VPAND (%_% ymm2) (%_% ymm11) (%_% ymm2) *)
299300
];;
300301

301302
(* ------------------------------------------------------------------------- *)

x86/proofs/x86.ml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1367,6 +1367,13 @@ let x86_TZCNT = new_definition
13671367
ZF := (val z = 0) ,,
13681368
UNDEFINED_VALUES[OF;SF;PF;AF]) s`;;
13691369

1370+
let x86_VPAND = new_definition
1371+
`x86_VPAND dest src1 src2 (s:x86state) =
1372+
let x = read src1 s
1373+
and y = read src2 s in
1374+
let z = word_and x y in
1375+
(dest := (z:N word)) s`;;
1376+
13701377
let x86_VPXOR = new_definition
13711378
`x86_VPXOR dest src1 src2 (s:x86state) =
13721379
let x = read src1 s
@@ -2035,6 +2042,10 @@ let x86_execute = define
20352042
(match operand_size dest with
20362043
256 -> x86_VPXOR (OPERAND256 dest s) (OPERAND256 src1 s) (OPERAND256 src2 s)
20372044
| 128 -> x86_VPXOR (OPERAND128 dest s) (OPERAND128 src1 s) (OPERAND128 src2 s)) s
2045+
| VPAND dest src1 src2 ->
2046+
(match operand_size dest with
2047+
256 -> x86_VPAND (OPERAND256 dest s) (OPERAND256 src1 s) (OPERAND256 src2 s)
2048+
| 128 -> x86_VPAND (OPERAND128 dest s) (OPERAND128 src1 s) (OPERAND128 src2 s)) s
20382049
| XCHG dest src ->
20392050
(match operand_size dest with
20402051
64 -> x86_XCHG (OPERAND64 dest s) (OPERAND64 src s)
@@ -2776,7 +2787,7 @@ let X86_OPERATION_CLAUSES =
27762787
x86_STC; x86_SUB_ALT; x86_TEST; x86_TZCNT; x86_XCHG; x86_XOR;
27772788
(*** AVX2 instructions ***)
27782789
x86_VPADDW_ALT; x86_VPMULHW_ALT; x86_VPMULLW_ALT; x86_VPSUBW_ALT;
2779-
x86_VPXOR;
2790+
x86_VPXOR; x86_VPAND;
27802791
(*** 32-bit backups since the ALT forms are 64-bit only ***)
27812792
INST_TYPE[`:32`,`:N`] x86_ADC;
27822793
INST_TYPE[`:32`,`:N`] x86_ADCX;

0 commit comments

Comments
 (0)