| 1 |
/* |
| 2 |
* FCML - Free Code Manipulation Library. |
| 3 |
* Copyright (C) 2010-2020 Slawomir Wojtasiak |
| 4 |
* |
| 5 |
* This library is free software; you can redistribute it and/or |
| 6 |
* modify it under the terms of the GNU Lesser General Public |
| 7 |
* License as published by the Free Software Foundation; either |
| 8 |
* version 2.1 of the License, or (at your option) any later version. |
| 9 |
* |
| 10 |
* This library is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
* Lesser General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU Lesser General Public |
| 16 |
* License along with this library; if not, write to the Free Software |
| 17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 |
*/ |
| 19 |
|
| 20 |
#include <fcml_assembler.h> |
| 21 |
#include "instructions_e_t.h" |
| 22 |
#include "instructions_base_t.h" |
| 23 |
|
| 24 |
fcml_bool fcml_tf_instructions_e_suite_init(void) { |
| 25 |
return FCML_TRUE; |
| 26 |
} |
| 27 |
|
| 28 |
fcml_bool fcml_tf_instructions_e_suite_cleanup(void) { |
| 29 |
return FCML_TRUE; |
| 30 |
} |
| 31 |
|
| 32 |
void fcml_tf_instruction_EMMS(void) { |
| 33 |
FCML_I3264( "emms", 0x0F, 0x77 ); |
| 34 |
FCML_A64( "emms", 0x0f, 0x77 ); |
| 35 |
} |
| 36 |
|
| 37 |
void fcml_tf_instruction_ENTER(void) { |
| 38 |
FCML_I32( "enter 0ffeeh,55h", 0xc8, 0xEE, 0xFF, 0x55 ); |
| 39 |
FCML_I32( "enter 0ffeeh,55h", 0x66, 0xc8, 0xEE, 0xFF, 0x55 ); |
| 40 |
FCML_I64( "enter 0ffeeh,55h", 0xc8, 0xEE, 0xFF, 0x55 ); |
| 41 |
FCML_I64( "enter 0ffeeh,55h", 0x66, 0xc8, 0xEE, 0xFF, 0x55 ); |
| 42 |
FCML_I64_D( "enter 0ffeeh,55h", 0x66, 0x48, 0xc8, 0xEE, 0xFF, 0x55 ); |
| 43 |
FCML_I32( "enter 0ffeeh,00h", 0xc8, 0xEE, 0xFF, 0x00 ); |
| 44 |
FCML_I32( "enter 0ffeeh,01h", 0xc8, 0xEE, 0xFF, 0x01 ); |
| 45 |
/* GAS */ |
| 46 |
FCML_A64( "enter $0xffee,$0x55", 0xc8, 0xee, 0xff, 0x55 ); |
| 47 |
FCML_A64( "enter $0xffee,$0x00", 0xc8, 0xee, 0xff, 0x00 ); |
| 48 |
FCML_A64( "enter $0xffee,$0x01", 0xc8, 0xee, 0xff, 0x01 ); |
| 49 |
} |
| 50 |
|
| 51 |
void fcml_tf_instruction_EXTRACTPS(void) { |
| 52 |
FCML_I64( "extractps dword ptr [rax+0000000000000020h],xmm0,50h", 0x66, 0x0F, 0x3A, 0x17, 0x40, 0x20, 0x50 ); |
| 53 |
FCML_A64( "extractps $0x50,%xmm0,0x0000000000000020(%rax)", 0x66, 0x0f, 0x3a, 0x17, 0x40, 0x20, 0x50 ); |
| 54 |
FCML_I32( "extractps dword ptr [eax+00000020h],xmm0,50h", 0x66, 0x0F, 0x3A, 0x17, 0x40, 0x20, 0x50 ); |
| 55 |
|
| 56 |
FCML_I32_M("vextractps dword ptr [ecx+eax],xmm2,20h", 2, FCML_MI(0x62, 0xf3, 0x7d, 0x08, 0x17, 0x14, 0x01, 0x20), FCML_MI(0xc4, 0xe3, 0x79, 0x17, 0x14, 0x01, 0x20)); |
| 57 |
FCML_I64_M("vextractps eax,xmm0,20h", 2, FCML_MI(0x62, 0xf3, 0x7d, 0x08, 0x17, 0xc0, 0x20), FCML_MI(0xc4, 0xe3, 0x79, 0x17, 0xc0, 0x20)); |
| 58 |
FCML_A64_M("vextractps $0x20,%xmm0,%eax", 2, FCML_MI(0x62, 0xf3, 0x7d, 0x08, 0x17, 0xc0, 0x20), FCML_MI(0xc4, 0xe3, 0x79, 0x17, 0xc0, 0x20)); |
| 59 |
} |
| 60 |
|
| 61 |
void fcml_tf_instruction_EXTRQ(void) { |
| 62 |
|
| 63 |
FCML_I32( "extrq xmm1,01h,02h", 0x66, 0x0F, 0x78, 0xC1, 0x01, 0x02 ); |
| 64 |
FCML_I32( "extrq xmm2,01h,02h", 0x66, 0x0F, 0x78, 0xC2, 0x01, 0x02 ); |
| 65 |
FCML_I64( "extrq xmm1,01h,02h", 0x66, 0x0F, 0x78, 0xC1, 0x01, 0x02 ); |
| 66 |
FCML_I64( "extrq xmm2,01h,02h", 0x66, 0x0F, 0x78, 0xC2, 0x01, 0x02 ); |
| 67 |
FCML_A64( "extrq $0x02,$0x01,%xmm1", 0x66, 0x0f, 0x78, 0xc1, 0x01, 0x02 ); |
| 68 |
|
| 69 |
FCML_I32( "extrq xmm0,xmm5", 0x66, 0x0F, 0x79, 0xC5 ); |
| 70 |
FCML_I32( "extrq xmm4,xmm1", 0x66, 0x0F, 0x79, 0xE1 ); |
| 71 |
FCML_I64( "extrq xmm0,xmm5", 0x66, 0x0F, 0x79, 0xC5 ); |
| 72 |
FCML_I64( "extrq xmm4,xmm1", 0x66, 0x0F, 0x79, 0xE1 ); |
| 73 |
FCML_A64( "extrq %xmm1,%xmm4", 0x66, 0x0f, 0x79, 0xe1 ); |
| 74 |
} |
| 75 |
|
| 76 |
fcml_stf_test_case fctl_ti_instructions_e[] = { |
| 77 |
{ "fcml_tf_instruction_EMMS", fcml_tf_instruction_EMMS }, |
| 78 |
{ "fcml_tf_instruction_ENTER", fcml_tf_instruction_ENTER }, |
| 79 |
{ "fcml_tf_instruction_EXTRACTPS", fcml_tf_instruction_EXTRACTPS }, |
| 80 |
{ "fcml_tf_instruction_EXTRQ", fcml_tf_instruction_EXTRQ }, |
| 81 |
FCML_STF_NULL_TEST |
| 82 |
}; |
| 83 |
|
| 84 |
fcml_stf_test_suite fctl_si_instructions_e = { |
| 85 |
"suite-fctl_ti_instructions_e", fcml_tf_instructions_e_suite_init, fcml_tf_instructions_e_suite_cleanup, fctl_ti_instructions_e |
| 86 |
}; |