; Listing generated by Microsoft (R) Optimizing Compiler Version 14.00.50727.42 

	TITLE	c:\Documents and Settings\Tobi\My Documents\Visual Studio 2005\Projects\Scimark2-AMD\source\SparseCompRow.c
	.686P
	.XMM
	include listing.inc
	.model	flat

INCLUDELIB OLDNAMES

PUBLIC	_SparseCompRow_matmult
; Function compile flags: /Ogtpy
; File c:\documents and settings\tobi\my documents\visual studio 2005\projects\scimark2-amd\source\sparsecomprow.c
_TEXT	SEGMENT
_r$ = -8						; size = 4
tv1031 = -4						; size = 4
_M$ = 8							; size = 4
_y$ = 12						; size = 4
_val$ = 16						; size = 4
_row$ = 20						; size = 4
_col$ = 24						; size = 4
_SparseCompRow_matmult PROC
; _x$ = edi
; _NUM_ITERATIONS$ = eax

; 24   :     {

	mov	ecx, DWORD PTR _col$[esp-4]
	mov	edx, DWORD PTR _val$[esp-4]
	sub	esp, 8

; 25   :         int reps;
; 26   :         int r;
; 27   :         int i;
; 28   : 
; 29   :         for (reps=0; reps<NUM_ITERATIONS; reps++)

	test	eax, eax
	push	ebx
	mov	ebx, DWORD PTR _M$[esp+8]
	push	ebp
	mov	ebp, DWORD PTR _row$[esp+12]
	push	esi
	jle	$LN7@SparseComp
	xorps	xmm1, xmm1
	mov	DWORD PTR tv1031[esp+20], eax
$LN9@SparseComp:

; 30   :         {
; 31   :         
; 32   :             for (r=0; r<M; r++)

	xor	esi, esi
	test	ebx, ebx
	mov	DWORD PTR _r$[esp+20], esi
	jle	$LN8@SparseComp
$LL6@SparseComp:

; 33   :             {
; 34   :                 double sum = 0.0; 
; 35   :                 int rowR = row[r];
; 36   :                 int rowRp1 = row[r+1];

	mov	ebx, DWORD PTR [ebp+esi*4+4]

; 37   :                 for (i=rowR; i<rowRp1; i++)

	mov	eax, DWORD PTR [ebp+esi*4]
	mov	ebp, ebx
	sub	ebp, eax
	cmp	ebp, 4
	movapd	xmm0, xmm1
	jl	SHORT $LC19@SparseComp
	mov	esi, ebx
	sub	esi, eax
	sub	esi, 4
	shr	esi, 2
	add	esi, 1
	lea	edx, DWORD PTR [edx+eax*8+16]
	lea	ecx, DWORD PTR [ecx+eax*4+8]
	lea	eax, DWORD PTR [eax+esi*4]
$LL20@SparseComp:

; 38   :                     sum += x[ col[i] ] * val[i];

	mov	ebp, DWORD PTR [ecx-8]
	movsd	xmm2, QWORD PTR [edi+ebp*8]
	mulsd	xmm2, QWORD PTR [edx-16]
	mov	ebp, DWORD PTR [ecx-4]
	addsd	xmm2, xmm0
	movsd	xmm0, QWORD PTR [edi+ebp*8]
	mulsd	xmm0, QWORD PTR [edx-8]
	mov	ebp, DWORD PTR [ecx]
	addsd	xmm2, xmm0
	movsd	xmm0, QWORD PTR [edi+ebp*8]
	mulsd	xmm0, QWORD PTR [edx]
	mov	ebp, DWORD PTR [ecx+4]
	addsd	xmm2, xmm0
	movsd	xmm0, QWORD PTR [edi+ebp*8]
	mulsd	xmm0, QWORD PTR [edx+8]
	add	ecx, 16					; 00000010H
	add	edx, 32					; 00000020H
	sub	esi, 1
	addsd	xmm2, xmm0
	movapd	xmm0, xmm2
	jne	SHORT $LL20@SparseComp
	mov	ecx, DWORD PTR _col$[esp+16]
	mov	edx, DWORD PTR _val$[esp+16]
	mov	esi, DWORD PTR _r$[esp+20]
$LC19@SparseComp:

; 37   :                 for (i=rowR; i<rowRp1; i++)

	cmp	eax, ebx
	jge	SHORT $LN18@SparseComp
$LC3@SparseComp:

; 38   :                     sum += x[ col[i] ] * val[i];

	mov	ebp, DWORD PTR [ecx+eax*4]
	movsd	xmm2, QWORD PTR [edi+ebp*8]
	mulsd	xmm2, QWORD PTR [edx+eax*8]
	add	eax, 1
	cmp	eax, ebx
	addsd	xmm2, xmm0
	movapd	xmm0, xmm2
	jl	SHORT $LC3@SparseComp
$LN18@SparseComp:

; 39   :                 y[r] = sum;

	mov	eax, DWORD PTR _y$[esp+16]
	mov	ebx, DWORD PTR _M$[esp+16]
	mov	ebp, DWORD PTR _row$[esp+16]
	movsd	QWORD PTR [eax+esi*8], xmm0
	add	esi, 1
	cmp	esi, ebx
	mov	DWORD PTR _r$[esp+20], esi
	jl	$LL6@SparseComp
$LN8@SparseComp:

; 25   :         int reps;
; 26   :         int r;
; 27   :         int i;
; 28   : 
; 29   :         for (reps=0; reps<NUM_ITERATIONS; reps++)

	sub	DWORD PTR tv1031[esp+20], 1
	jne	$LN9@SparseComp
$LN7@SparseComp:

; 40   :             }
; 41   :         }
; 42   :     }

	pop	esi
	pop	ebp
	pop	ebx
	add	esp, 8
	ret	0
_SparseCompRow_matmult ENDP
_TEXT	ENDS
PUBLIC	_SparseCompRow_num_flops
; Function compile flags: /Ogtpy
_TEXT	SEGMENT
_num_iterations$ = 8					; size = 4
_SparseCompRow_num_flops PROC
; _N$ = ecx
; _nz$ = eax

; 6    :         /* Note that if nz does not divide N evenly, then the
; 7    :            actual number of nonzeros used is adjusted slightly.
; 8    :         */
; 9    :         int actual_nz = (nz/N) * N;

	cdq
	idiv	ecx

; 10   :         return ((double)actual_nz) * 2.0 * ((double) num_iterations);

	cvtsi2sd xmm1, DWORD PTR _num_iterations$[esp-4]
	imul	eax, ecx
	cvtsi2sd xmm0, eax
	mulsd	xmm0, xmm1
	mulsd	xmm0, QWORD PTR _RESOLUTION_DEFAULT

; 11   :     }

	ret	0
_SparseCompRow_num_flops ENDP
END
