File:  [MW Coherent from dump] / coherent / b / kernel / emulator / poly_mul64.S
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:37 2019 UTC (7 years ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

/*---------------------------------------------------------------------------+
 |  poly_mul64.S                                                             |
 |                                                                           |
 | Multiply two 64 bit integers.                                             |
 |                                                                           |
 | Copyright (C) 1992    W. Metzenthen, 22 Parker St, Ormond, Vic 3163,      |
 |                       Australia.  E-mail [email protected]    |
 |                                                                           |
 | Call from C as:                                                           |
 |   void mul64(long long *a, long long *b, long long *result)               |
 |                                                                           |
 +---------------------------------------------------------------------------*/


#include "fpu_asm.h"

.text
	.align 2,144
.globl mul64
mul64:
	pushl %ebp
	movl %esp,%ebp
	subl $16,%esp
	pushl %esi
	pushl %ebx

	movl PARAM1,%esi
	movl PARAM2,%ecx
	movl PARAM3,%ebx

	xor %eax,%eax
	movl %eax,-4(%ebp)
	movl %eax,-8(%ebp)

	movl (%esi),%eax
	mull (%ecx)
	movl %eax,-16(%ebp)	// Not used
	movl %edx,-12(%ebp)

	movl (%esi),%eax
	mull 4(%ecx)
	addl %eax,-12(%ebp)
	adcl %edx,-8(%ebp)
	adcl $0,-4(%ebp)

	movl 4(%esi),%eax
	mull (%ecx)
	addl %eax,-12(%ebp)
	adcl %edx,-8(%ebp)
	adcl $0,-4(%ebp)

	movl 4(%esi),%eax
	mull 4(%ecx)
	addl %eax,-8(%ebp)
	adcl %edx,-4(%ebp)

	testb $128,-9(%ebp)
	je L_no_round

	addl $1,-8(%ebp)
	adcl $0,-4(%ebp)

L_no_round:
	movl -8(%ebp),%esi
	movl %esi,(%ebx)
	movl -4(%ebp),%esi
	movl %esi,4(%ebx)

	popl %ebx
	popl %esi
	leave
	ret

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.