Add Intel encodings for imul.

This commit is contained in:
Jakob Stoklund Olesen
2017-07-18 09:22:50 -07:00
parent 28457f82c3
commit 02fd83cd5c
6 changed files with 52 additions and 1 deletions

View File

@@ -105,6 +105,13 @@ ebb0:
; asm: xorl $1000000, %esi
[-,%rsi] v47 = bxor_imm v2, 1000000 ; bin: 81 f6 000f4240
; More arithmetic.
; asm: imull %esi, %ecx
[-,%rcx] v50 = imul v1, v2 ; bin: 0f af ce
; asm: imull %ecx, %esi
[-,%rsi] v51 = imul v2, v1 ; bin: 0f af f1
; Register copies.
; asm: movl %esi, %ecx

View File

@@ -145,6 +145,15 @@ ebb0:
; asm: movq %rcx, %r10
[-,%r10] v112 = copy v1 ; bin: 49 89 ca
; More arithmetic.
; asm: imulq %rsi, %rcx
[-,%rcx] v120 = imul v1, v2 ; bin: 48 0f af ce
; asm: imulq %r10, %rsi
[-,%rsi] v121 = imul v2, v3 ; bin: 49 0f af f2
; asm: imulq %rcx, %r10
[-,%r10] v122 = imul v3, v1 ; bin: 4c 0f af d1
; Bit-counting instructions.
; asm: popcntq %rsi, %rcx
@@ -313,6 +322,15 @@ ebb0:
; asm: movl %ecx, %r10d
[-,%r10] v112 = copy v1 ; bin: 41 89 ca
; More arithmetic.
; asm: imull %esi, %ecx
[-,%rcx] v120 = imul v1, v2 ; bin: 40 0f af ce
; asm: imull %r10d, %esi
[-,%rsi] v121 = imul v2, v3 ; bin: 41 0f af f2
; asm: imull %ecx, %r10d
[-,%r10] v122 = imul v3, v1 ; bin: 44 0f af d1
; Bit-counting instructions.
; asm: popcntl %esi, %ecx

View File

@@ -49,7 +49,12 @@ ebb0(v0: i32, v1: i32):
return v2
}
; function %i32_mul(i32, i32) -> i32
function %i32_mul(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
v2 = imul v0, v1
return v2
}
; function %i32_div(i32, i32) -> i32
; function %i32_rem_s(i32, i32) -> i32
; function %i32_rem_u(i32, i32) -> i32