Commit b31e81a3 authored by Julian Kranz's avatar Julian Kranz

X86 RREIL Translator

- Added semantics of: (V)PSUBB, (V)PSUBW, (V)PSUBD, (V)PSUBQ
parent ff7ec6e1
......@@ -399,13 +399,18 @@ main:
#psrldq $73, %xmm1
#vpsrldq $5, %xmm1, %xmm2
psrlw %mm1, %mm2
psrlw (%rax), %xmm1
psrlw $197, %xmm1
psrld $20, %mm1
psrlq $10, %mm1
vpsrld %xmm1, %xmm2, %xmm3
vpsrlq $33, %xmm1, %xmm2
#psrlw %mm1, %mm2
#psrlw (%rax), %xmm1
#psrlw $197, %xmm1
#psrld $20, %mm1
#psrlq $10, %mm1
#vpsrld %xmm1, %xmm2, %xmm3
#vpsrlq $33, %xmm1, %xmm2
psubb (%rax), %mm1
psubw (%rax), %xmm1
psubd %xmm1, %xmm2
vpsubd (%rax), %xmm1, %xmm2
#vmovd %xmm5, %ebx
......
......@@ -421,7 +421,7 @@ end
val sem-packuswb-packusdw dst-element-size x = sem-packuswb-packusdw-opnd '0' dst-element-size x.opnd1 x.opnd1 x.opnd2
val sem-vpackuswb-vpackusdw dst-element-size x = sem-packuswb-packusdw-opnd '1' dst-element-size x.opnd1 x.opnd2 x.opnd3
val sem-padd-vpadd-opnd avx-encoded element-size adder opnd1 opnd2 opnd3 = do
val sem-pbinop-opnd avx-encoded element-size operator opnd1 opnd2 opnd3 = do
size <- sizeof1 opnd1;
src1 <- read size opnd2;
src2 <- read size opnd3;
......@@ -433,12 +433,11 @@ val sem-padd-vpadd-opnd avx-encoded element-size adder opnd1 opnd2 opnd3 = do
mov size temp-src2 src2;
temp-dst <- mktemp;
let
val m i = do
offset <- return (element-size*i);
adder element-size (at-offset temp-dst offset) (var (at-offset temp-src1 offset)) (var (at-offset temp-src2 offset))
operator element-size (at-offset temp-dst offset) (var (at-offset temp-src1 offset)) (var (at-offset temp-src2 offset))
end
in
vector-apply size element-size m
......@@ -447,11 +446,11 @@ val sem-padd-vpadd-opnd avx-encoded element-size adder opnd1 opnd2 opnd3 = do
write-extend avx-encoded size dst (var temp-dst)
end
val sem-padd element-size x = sem-padd-vpadd-opnd '0' element-size add x.opnd1 x.opnd1 x.opnd2
val sem-vpadd element-size x = sem-padd-vpadd-opnd '1' element-size add x.opnd1 x.opnd2 x.opnd3
val sem-padd element-size x = sem-pbinop-opnd '0' element-size add x.opnd1 x.opnd1 x.opnd2
val sem-vpadd element-size x = sem-pbinop-opnd '1' element-size add x.opnd1 x.opnd2 x.opnd3
val sem-padds element-size x = sem-padd-vpadd-opnd '0' element-size add-signed-saturating x.opnd1 x.opnd1 x.opnd2
val sem-vpadds element-size x = sem-padd-vpadd-opnd '1' element-size add-signed-saturating x.opnd1 x.opnd2 x.opnd3
val sem-padds element-size x = sem-pbinop-opnd '0' element-size add-signed-saturating x.opnd1 x.opnd1 x.opnd2
val sem-vpadds element-size x = sem-pbinop-opnd '1' element-size add-signed-saturating x.opnd1 x.opnd2 x.opnd3
val sem-paddus-vpaddus-opnd avx-encoded element-size opnd1 opnd2 opnd3 = do
size <- sizeof1 opnd1;
......@@ -1698,6 +1697,9 @@ val sem-vpsrldq x = sem-psxldq-vpsxldq-opnd '1' shr x.opnd1 x.opnd2 x.opnd3
val sem-psrl element-size x = sem-ps-vps-opnd '0' element-size shr x.opnd1 x.opnd1 x.opnd2
val sem-vpsrl element-size x = sem-ps-vps-opnd '1' element-size shr x.opnd1 x.opnd2 x.opnd3
val sem-psub element-size x = sem-pbinop-opnd '0' element-size sub x.opnd1 x.opnd1 x.opnd2
val sem-vpsub element-size x = sem-pbinop-opnd '1' element-size sub x.opnd1 x.opnd2 x.opnd3
val ps-push opnd-sz opnd = do
mode64 <- mode64?;
stack-addr-sz <- runtime-stack-address-size;
......
......@@ -1432,14 +1432,14 @@ val semantics insn =
| PSRLDQ x: sem-psrldq x
| PSRLQ x: sem-psrl 64 x
| PSRLW x: sem-psrl 16 x
| PSUBB x: sem-undef-arity2 x
| PSUBD x: sem-undef-arity2 x
| PSUBQ x: sem-undef-arity2 x
| PSUBB x: sem-psub 8 x
| PSUBD x: sem-psub 32 x
| PSUBQ x: sem-psub 64 x
| PSUBSB x: sem-undef-arity2 x
| PSUBSW x: sem-undef-arity2 x
| PSUBUSB x: sem-undef-arity2 x
| PSUBUSW x: sem-undef-arity2 x
| PSUBW x: sem-undef-arity2 x
| PSUBW x: sem-psub 16 x
| PTEST x: sem-undef-arity2 x
| PUNPCKHBW x: sem-undef-arity2 x
| PUNPCKHDQ x: sem-undef-arity2 x
......@@ -2105,14 +2105,26 @@ val semantics insn =
case v of
VA3 x: sem-vpsrl 16 x
end
| VPSUBB x: sem-undef-varity x
| VPSUBD x: sem-undef-varity x
| VPSUBQ x: sem-undef-varity x
| VPSUBB v:
case v of
VA3 x: sem-vpsub 8 x
end
| VPSUBD v:
case v of
VA3 x: sem-vpsub 32 x
end
| VPSUBQ v:
case v of
VA3 x: sem-vpsub 64 x
end
| VPSUBSB x: sem-undef-varity x
| VPSUBSW x: sem-undef-varity x
| VPSUBUSB x: sem-undef-varity x
| VPSUBUSW x: sem-undef-varity x
| VPSUBW x: sem-undef-varity x
| VPSUBW v:
case v of
VA3 x: sem-vpsub 16 x
end
| VPTEST x: sem-undef-varity x
| VPUNPCKHBW x: sem-undef-varity x
| VPUNPCKHDQ x: sem-undef-varity x
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment