File: divmod_amd64.s

package info (click to toggle)
golang-github-gorgonia-tensor 0.9.24-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,696 kB
  • sloc: sh: 18; asm: 18; makefile: 8
file content (22 lines) | stat: -rw-r--r-- 327 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// +build !noasm

#include "textflag.h"

TEXT ·divmod(SB),NOSPLIT,$0
	MOVQ	a+0(FP), SI
	MOVQ	b+8(FP), CX
	MOVQ	SI, AX
	CMPQ	CX, $-1
	JEQ	$1, denomIsOne 	// if denominator is 1, then jump to end

	CQO
	IDIVQ	CX
	MOVQ	AX, q+16(FP)
	MOVQ	DX, r+24(FP)
bye:
	RET
denomIsOne:
	NEGQ	AX
	MOVQ	AX, q+16(FP)
	MOVQ	$0, r+24(FP)
	JMP	bye