https://github.com/akkartik/mu/blob/main/023float.cc
1
2
3
4
5 :(before "End Initialize Op Names")
6 put_new(Name_f3_0f, "10", "copy xm32 to x32 (movss)");
7 put_new(Name_f3_0f, "11", "copy x32 to xm32 (movss)");
8
9 :(code)
10 void test_copy_x32_to_x32() {
11 Xmm[3] = 0.5;
12 run(
13 "== code 0x1\n"
14
15 "f3 0f 11 d8 \n"
16
17 );
18 CHECK_TRACE_CONTENTS(
19 "run: copy XMM3 to x/m32\n"
20 "run: x/m32 is XMM0\n"
21 "run: storing 0.5\n"
22 );
23 }
24
25 :(before "End Three-Byte Opcodes Starting With f3 0f")
26 case 0x10: {
27 const uint8_t modrm = next();
28 const uint8_t rdest = (modrm>>3)&0x7;
29 trace(Callstack_depth+1, "run") << "copy x/m32 to " << Xname[rdest] << end();
30 float* src = effective_address_float(modrm);
31 Xmm[rdest] = *src;
32 trace(Callstack_depth+1, "run") << "storing " << Xmm[rdest] << end();
33 break;
34 }
35 case 0x11: {
36 const uint8_t modrm = next();
37 const uint8_t rsrc = (modrm>>3)&0x7;
38 trace(Callstack_depth+1, "run") << "copy " << Xname[rsrc] << " to x/m32&quoif __name__ == '__main__': from __init__ import init; init()
from unittest import TestCase, main
class Test(TestCase):
def test_wrapper(self):
from ranger.api.keys import Wrapper
class dummyfm(object):
def move(self, relative):
return "I move down by {0}".format(relative)
class commandarg(object):
def __init__(self):
self.fm = dummyfm()
self.n = None
arg = commandarg()
do = Wrapper('fm')
command = do.move(relative=4)
self.assertEqual(command(arg), 'I move down by 4')
if __name__ == '__main__': main()