Black Lives Matter. Support the Equal Justice Initiative.

Text file src/runtime/time_windows_amd64.s

Documentation: runtime

     1  // Copyright 2011 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build !faketime
     6  // +build !faketime
     7  
     8  #include "go_asm.h"
     9  #include "textflag.h"
    10  #include "time_windows.h"
    11  
    12  TEXT time·now(SB),NOSPLIT,$0-24
    13  	CMPB	runtime·useQPCTime(SB), $0
    14  	JNE	useQPC
    15  	MOVQ	$_INTERRUPT_TIME, DI
    16  loop:
    17  	MOVL	time_hi1(DI), AX
    18  	MOVL	time_lo(DI), BX
    19  	MOVL	time_hi2(DI), CX
    20  	CMPL	AX, CX
    21  	JNE	loop
    22  	SHLQ	$32, AX
    23  	ORQ	BX, AX
    24  	IMULQ	$100, AX
    25  	MOVQ	AX, mono+16(FP)
    26  
    27  	MOVQ	$_SYSTEM_TIME, DI
    28  wall:
    29  	MOVL	time_hi1(DI), AX
    30  	MOVL	time_lo(DI), BX
    31  	MOVL	time_hi2(DI), CX
    32  	CMPL	AX, CX
    33  	JNE	wall
    34  	SHLQ	$32, AX
    35  	ORQ	BX, AX
    36  	MOVQ	$116444736000000000, DI
    37  	SUBQ	DI, AX
    38  	IMULQ	$100, AX
    39  
    40  	// generated code for
    41  	//	func f(x uint64) (uint64, uint64) { return x/1000000000, x%100000000 }
    42  	// adapted to reduce duplication
    43  	MOVQ	AX, CX
    44  	MOVQ	$1360296554856532783, AX
    45  	MULQ	CX
    46  	ADDQ	CX, DX
    47  	RCRQ	$1, DX
    48  	SHRQ	$29, DX
    49  	MOVQ	DX, sec+0(FP)
    50  	IMULQ	$1000000000, DX
    51  	SUBQ	DX, CX
    52  	MOVL	CX, nsec+8(FP)
    53  	RET
    54  useQPC:
    55  	JMP	runtime·nowQPC(SB)
    56  	RET
    57  

View as plain text