Commit ad91c07c authored by Julian Kranz's avatar Julian Kranz

X86 RREIL Translator

X86 Specification

- Added semantics of: VMASKMOVP
- Bug fixes
parent 4028106d
......@@ -477,10 +477,17 @@ main:
#shrd $99, %ecx, %edx
#shrd %cl, %rax, %rbx
vbroadcastss (%rax), %xmm1
vbroadcastss (%rax), %ymm1
vbroadcastsd (%rax), %ymm1
vbroadcastf128 (%rax), %ymm1
#vbroadcastss (%rax), %xmm1
#vbroadcastss (%rax), %ymm1
#vbroadcastsd (%rax), %ymm1
#vbroadcastf128 (%rax), %ymm1
#vmaskmovps %xmm1, %xmm2, (%rax)
#vmaskmovps (%rax), %xmm1, %xmm2
vmaskmovpd %xmm1, %xmm2, (%rax)
vmaskmovpd (%rax), %xmm1, %xmm2
vmaskmovpd %ymm1, %ymm2, (%rax)
vmaskmovpd (%rax), %ymm1, %ymm2
#vmovd %xmm5, %ebx
......
## M>>
val sem-maskmov x size = do
src <- read size x.opnd1;
mask <- read size x.opnd2;
val sem-maskmov element-size x = do
size <- sizeof1 x.opnd2;
src <- read size x.opnd2;
mask <- read size x.opnd3;
src-temp <- mktemp;
mov size src-temp src;
......@@ -10,22 +11,51 @@ val sem-maskmov x size = do
mask-temp <- mktemp;
mov size mask-temp mask;
byte-size <- return 8;
let
val m i = do
_if (/d (var (at-offset mask-temp ((i + 1)*8 - 1)))) _then do
dst <- lval-offset byte-size x.opnd3 i;
write byte-size dst (var (at-offset src-temp (i*8)))
end
is-load <- return (
case x.opnd1 of
MEM m: '0'
| REG r: '1'
end
);
offset-factor <- return (
if is-load then
element-size
else
divb element-size 8
);
let
val m i =
let
val write-dst value = do
dst <- lval-offset element-size x.opnd1 (i*offset-factor);
write element-size dst value
end
in do
offset <- return (element-size*i);
_if (/d (var (at-offset mask-temp ((i + 1)*element-size - 1)))) _then
write-dst (var (at-offset src-temp offset))
_else
if is-load then
write-dst (imm 0)
else
return void
end end
in
vector-apply size byte-size m
end
vector-apply size element-size m
end;
if is-load and size === 128 then do
dst <- lval-offset size x.opnd1 size;
write size dst (imm 0)
end else
return void
end
val sem-maskmovdqu-vmaskmovdqu x = sem-maskmov x 128
val sem-maskmovdqu-vmaskmovdqu x = sem-maskmov 8 x
val sem-maskmovq x = sem-maskmov x 64
val sem-maskmovq x = sem-maskmov 8 x
val sem-mov avx-encoded x = do
sz <- sizeof1 x.opnd1;
......@@ -2579,6 +2609,15 @@ val sem-vbroadcast v = do
write-extend '1' dst-size dst (var temp-dst)
end
val sem-vmaskmovp element-size v = do
x <- return (
case v of
VA3 x: x
end
);
sem-maskmov element-size x
end
## W>>
## X>>
......
......@@ -1657,8 +1657,8 @@ val semantics insn =
case v of
VA3 x: sem-maskmovdqu-vmaskmovdqu x
end
| VMASKMOVPD x: sem-undef-varity x
| VMASKMOVPS x: sem-undef-varity x
| VMASKMOVPD x: sem-vmaskmovp 64 x
| VMASKMOVPS x: sem-vmaskmovp 32 x
| VMAXPD x: sem-undef-varity x
| VMAXPS x: sem-undef-varity x
| VMAXSD x: sem-undef-varity x
......
......@@ -3933,12 +3933,12 @@ val / [0x0f 0x00 /3] = unop LTR r/m16
### MASKMOVDQU
### - Store Selected Bytes of Double Quadword
val /66 [0x0f 0xf7 /r-reg] = ternop MASKMOVDQU xmm128 xmm/reg128 (m/default/di/edi/rdi (return 8))
val /vex/66/0f [0xf7 /r-reg] | vex128? = varity3 VMASKMOVDQU xmm128 xmm/m128 (m/default/di/edi/rdi (return 8))
val /66 [0x0f 0xf7 /r-reg] = ternop MASKMOVDQU (m/default/di/edi/rdi (return 8)) xmm128 xmm/reg128
val /vex/66/0f [0xf7 /r-reg] | vex128? = varity3 VMASKMOVDQU (m/default/di/edi/rdi (return 8)) xmm128 xmm/m128
### MASKMOVQ
### - Store Selected Bytes of Quadword
val / [0x0f 0xf7 /r-reg] = ternop MASKMOVQ mm64 mm/reg64 (m/default/di/edi/rdi (return 8))
val / [0x0f 0xf7 /r-reg] = ternop MASKMOVQ (m/default/di/edi/rdi (return 8)) mm64 mm/reg64
### MAXPD
### - Return Maximum Packed Double-Precision Floating-Point Values
......
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