Commit 8eca0e95 authored by Julian Kranz's avatar Julian Kranz
Browse files

X86 RREIL Translator

X86 Specification

- Continued to add semantics of: SHLD, SHRD
- Bug fixes
parent f2ec411f
......@@ -44,7 +44,8 @@ main:
#loop main
#loope main
#loopne main
#loopne mainnd _else do
#lodsq
#rep lodsq
......@@ -468,10 +469,14 @@ main:
#and (%rax), %rax
#and %ebx, %ecx
shld $42, %ax, %bx
shld $99, %ecx, %edx
#shld $42, %ax, %bx
#shld $99, %ecx, %edx
shld %cl, %rax, %rbx
shrd $42, %ax, %bx
shrd $99, %ecx, %edx
shrd %cl, %rax, %rbx
#vmovd %xmm5, %ebx
#movupd %xmm2, %xmm1
......
......@@ -2420,7 +2420,7 @@ val sem-setcc x cond = do
write dst-sz dst (var temp)
end
val sem-shld x = do
val sem-shld-shrd s1-shifter s2-shifter x = do
size <- sizeof1 x.opnd1;
dst <- lval size x.opnd1;
src1 <- read size x.opnd1;
......@@ -2453,18 +2453,26 @@ val sem-shld x = do
undef 1 af;
undef 1 pf
end _else do
shl size temp-dst src1 (var temp-count);
mov 1 (at-offset temp-dst (size + 1)) (imm 0);
shl (size + 1) temp-dst src1 (imm 1);
s1-shifter (size + 2) temp-dst (var temp-dst) (var temp-count);
temp <- mktemp;
sub size temp (imm size) (var temp-count);
shr size temp src2 (var temp);
s2-shifter size temp src2 (var temp);
orb size temp-dst (var (at-offset temp-dst 1)) (var temp);
orb size temp-dst (var temp-dst) (var temp)
orb 1 cf (var temp-dst) (var (at-offset temp-dst (size + 1)))
end;
write size dst (var temp-dst)
end
val sem-shld x = sem-shld-shrd shl shr x
val sem-shrd x = sem-shld-shrd shr shl x
val sem-stc = do
cf <- fCF;
mov 1 cf (imm 1)
......
......@@ -1542,7 +1542,7 @@ val semantics insn =
| SHL x: sem-sal-shl x
| SHLD x: sem-shld x
| SHR x: sem-shr-sar x '0'
| SHRD x: sem-undef-arity3 x
| SHRD x: sem-shrd x
| SHUFPD x: sem-undef-arity3 x
| SHUFPS x: sem-undef-arity3 x
| SIDT x: sem-undef-arity1 x
......
......@@ -5444,13 +5444,13 @@ val / [0x0f 0xa5 /r]
### SHRD
### - Double Precision Shift Right
val / [0x0f 0xac /r]
| opndsz? = ternop SHLD r/m16 r16 imm8
| rexw? = ternop SHLD r/m64 r64 imm8
| otherwise = ternop SHLD r/m32 r32 imm8
| opndsz? = ternop SHRD r/m16 r16 imm8
| rexw? = ternop SHRD r/m64 r64 imm8
| otherwise = ternop SHRD r/m32 r32 imm8
val / [0x0f 0xad /r]
| opndsz? = ternop SHLD r/m16 r16 cl
| rexw? = ternop SHLD r/m64 r64 cl
| otherwise = ternop SHLD r/m32 r32 cl
| opndsz? = ternop SHRD r/m16 r16 cl
| rexw? = ternop SHRD r/m64 r64 cl
| otherwise = ternop SHRD r/m32 r32 cl
### SHUFPD
### - Shuffle Packed Double-Precision Floating-Point Values
......
Supports Markdown
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