Skip to content

Commit 33eb49e

Browse files
added mul instruction with tests
1 parent 248e15b commit 33eb49e

File tree

3 files changed

+50
-1
lines changed

3 files changed

+50
-1
lines changed

Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ TEST_ASM = \
207207
test/movntq.asm \
208208
test/movq.asm \
209209
test/movzx.asm \
210+
test/mul.asm \
210211
test/mulx.asm \
211212
test/neg.asm \
212213
test/negative_mem_disp.asm \

src/instructions.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ const struct instr_table INSTR_TABLE[] = {
165165
{{'\0'}, movq, {vm, vv}, RM, VECTOR, NA, NA, 5, {0xf3, REX, 0x0f, 0x7e, REG}},
166166
{"movzx", movzx, {rr, rm}, RM, DATA_TRANSFER, NA, NA, 4, {REX, 0x0f, 0xb6, REG}},
167167
{"mulpd", mulpd, {NA, vv}, RM, VECTOR, NA, NA, 5, {0x66, REX, 0x0f, 0x59, REG}},
168-
{"mul", mul, {r, m}, M, OPERATION, NA, 4, 3, {REX, 0xf7, REG}}
168+
{"mul", mul, {r, m}, M, OPERATION, NA, 4, 3, {REX, 0xf7, REG}},
169169
{"mulx", mulx, {rrr, rrm}, RVM, VECTOR_EXT, NA, NA, 3, {VEX(NDD,LZ,XF2,X0F38,W0_W1), 0xf6, REG}},
170170
{"neg", neg, {r, m}, M, OTHER, 1, 3, 3, {REX, 0xf6, REG}},
171171
{"nop", nop, {n, n}, NA, OTHER, NA, NA, 1, {NOP}},

test/mul.asm

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
SECTION .text
2+
GLOBAL test
3+
test:
4+
mul rax
5+
mul rbx
6+
mul rcx
7+
mul rdx
8+
mul rdi
9+
mul r8
10+
mul r9
11+
mul r10
12+
mul r11
13+
mul r12
14+
mul r13
15+
mul r14
16+
mul r15
17+
mul eax
18+
mul ebx
19+
mul ecx
20+
mul edx
21+
mul edi
22+
mul r8d
23+
mul r9d
24+
mul r10d
25+
mul r11d
26+
mul r12d
27+
mul r13d
28+
mul r14d
29+
mul r15d
30+
mul esp
31+
mul esi
32+
mul ebp
33+
mul ax
34+
mul bx
35+
mul cx
36+
mul dx
37+
mul di
38+
mul r8w
39+
mul r9w
40+
mul r10w
41+
mul r11w
42+
mul r12w
43+
mul r13w
44+
mul r14w
45+
mul r15w
46+
mul sp
47+
mul si
48+
mul bp

0 commit comments

Comments
 (0)