Skip to content

Instantly share code, notes, and snippets.

@keiya
Created September 16, 2011 23:32
Show Gist options
  • Save keiya/1223400 to your computer and use it in GitHub Desktop.
Save keiya/1223400 to your computer and use it in GitHub Desktop.
Multiplying without MUL
.data
.align 4
varx: .long 12
vary: .long 3
.text
.globl main
main:
mov (varx),%eax
mov (vary),%ebx
mov $0,%ecx
#; loop {
L1:
cmp $0,%ebx
jz END
#; if (LSb == 1)
#; then ONE1
#; else ZER0
shr $1,%ebx
jc ONE1
jmp ZER0
ZER0:
jmp LE1
ONE1:
add %eax,%ecx
jmp LE1
#; } end
LE1:
shl $1,%eax
jmp L1
END:
call stop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment