	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function trinity_gfx_powergating_initialize
_trinity_gfx_powergating_initialize:    ## @trinity_gfx_powergating_initialize
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r12
	callq	_trinity_get_pi
	movq	%rax, %r15
	movq	%r12, %rdi
	callq	_radeon_get_xclk
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movq	_HW_REV@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_RREG32
	movq	%rax, %r13
	movq	_ATI_REV_ID_MASK@GOTPCREL(%rip), %rax
	movq	(%rax), %r14
	movq	_ATI_REV_ID_SHIFT@GOTPCREL(%rip), %rax
	movq	(%rax), %rbx
	movq	_COMPUTE_ENGINE_PLL_PARAM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-48(%rbp), %r8
	movq	%r12, %rdi
	movl	$25000, %edx                    ## imm = 0x61A8
	xorl	%ecx, %ecx
	callq	_radeon_atom_get_clock_dividers
	testl	%eax, %eax
	jne	LBB0_4
## %bb.1:
	andq	%r13, %r14
	movl	%ebx, %ecx
	sarq	%cl, %r14
	movq	_GFX_POWER_GATING_CNTL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_RREG32_SMC
	movq	%rax, %r13
	movq	_SSSD_MASK@GOTPCREL(%rip), %rax
	movq	_PDS_DIV_MASK@GOTPCREL(%rip), %rcx
	movq	%r15, -64(%rbp)                 ## 8-byte Spill
	movq	(%rcx), %r15
	orq	(%rax), %r15
	movl	$1, %edi
	callq	_SSSD
	movq	%rax, %rbx
	notq	%r15
	andq	%r13, %r15
	movl	-48(%rbp), %edi
	callq	_PDS_DIV
	orq	%rax, %rbx
	orq	%r15, %rbx
	movq	_GFX_POWER_GATING_CNTL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%rbx, %rsi
	callq	_WREG32_SMC
	leaq	-56(%rbp), %rcx
	leaq	-80(%rbp), %r8
	movl	$500, %edi                      ## imm = 0x1F4
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	movl	$16, %edx
	callq	_r600_calculate_u_and_p
	movq	_CG_PG_CTRL@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	movq	-56(%rbp), %rdi
	callq	_SP
	movl	%eax, %ebx
	movq	-80(%rbp), %rdi
	callq	_SU
	orl	%eax, %ebx
	movl	%r15d, %edi
	movl	%ebx, %esi
	callq	_WREG32
	movq	_CG_GIPOTS@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movq	-56(%rbp), %rdi
	callq	_CG_GIPOT
	movq	_CG_GIPOT_MASK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	notl	%edx
	movl	%ebx, %edi
	movl	%eax, %esi
	callq	_WREG32_P
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	cmpq	$0, (%rax)
	je	LBB0_4
## %bb.2:
	testq	%r14, %r14
	jne	LBB0_4
## %bb.3:
	movq	%r12, %rdi
	callq	_trinity_override_dynamic_mg_powergating
LBB0_4:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_HW_REV,4,2                     ## @HW_REV
	.comm	_ATI_REV_ID_MASK,8,3            ## @ATI_REV_ID_MASK
	.comm	_ATI_REV_ID_SHIFT,8,3           ## @ATI_REV_ID_SHIFT
	.comm	_COMPUTE_ENGINE_PLL_PARAM,4,2   ## @COMPUTE_ENGINE_PLL_PARAM
	.comm	_GFX_POWER_GATING_CNTL,4,2      ## @GFX_POWER_GATING_CNTL
	.comm	_SSSD_MASK,8,3                  ## @SSSD_MASK
	.comm	_PDS_DIV_MASK,8,3               ## @PDS_DIV_MASK
	.comm	_CG_PG_CTRL,4,2                 ## @CG_PG_CTRL
	.comm	_CG_GIPOTS,4,2                  ## @CG_GIPOTS
	.comm	_CG_GIPOT_MASK,4,2              ## @CG_GIPOT_MASK
	.no_dead_strip	_trinity_gfx_powergating_initialize
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function trinity_gfx_powergating_initialize
_trinity_gfx_powergating_initialize:    ; @trinity_gfx_powergating_initialize
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x0
	bl	_trinity_get_pi
	mov	x20, x0
	mov	x0, x19
	bl	_radeon_get_xclk
	mov	x22, x0
Lloh0:
	adrp	x8, _HW_REV@GOTPAGE
Lloh1:
	ldr	x8, [x8, _HW_REV@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	bl	_RREG32
	mov	x21, x0
Lloh3:
	adrp	x8, _ATI_REV_ID_MASK@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ATI_REV_ID_MASK@GOTPAGEOFF]
Lloh5:
	ldr	x24, [x8]
Lloh6:
	adrp	x8, _ATI_REV_ID_SHIFT@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ATI_REV_ID_SHIFT@GOTPAGEOFF]
Lloh8:
	ldr	x25, [x8]
Lloh9:
	adrp	x8, _COMPUTE_ENGINE_PLL_PARAM@GOTPAGE
Lloh10:
	ldr	x8, [x8, _COMPUTE_ENGINE_PLL_PARAM@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	add	x4, sp, #8
	mov	x0, x19
	mov	w2, #25000
	mov	w3, #0
	bl	_radeon_atom_get_clock_dividers
	cbnz	w0, LBB0_4
; %bb.1:
Lloh12:
	adrp	x26, _GFX_POWER_GATING_CNTL@GOTPAGE
Lloh13:
	ldr	x26, [x26, _GFX_POWER_GATING_CNTL@GOTPAGEOFF]
	ldr	w0, [x26]
	bl	_RREG32_SMC
	mov	x23, x0
Lloh14:
	adrp	x8, _SSSD_MASK@GOTPAGE
Lloh15:
	ldr	x8, [x8, _SSSD_MASK@GOTPAGEOFF]
Lloh16:
	ldr	x27, [x8]
Lloh17:
	adrp	x8, _PDS_DIV_MASK@GOTPAGE
Lloh18:
	ldr	x8, [x8, _PDS_DIV_MASK@GOTPAGEOFF]
Lloh19:
	ldr	x28, [x8]
	mov	w0, #1
	bl	_SSSD
	orr	x8, x28, x27
	bic	x8, x23, x8
	orr	x23, x8, x0
	ldr	w0, [sp, #8]
	bl	_PDS_DIV
	orr	x1, x23, x0
	ldr	w0, [x26]
	bl	_WREG32_SMC
	add	x3, sp, #24
	add	x4, sp, #16
	mov	w0, #500
	mov	x1, x22
	mov	w2, #16
	bl	_r600_calculate_u_and_p
Lloh20:
	adrp	x8, _CG_PG_CTRL@GOTPAGE
Lloh21:
	ldr	x8, [x8, _CG_PG_CTRL@GOTPAGEOFF]
Lloh22:
	ldr	w22, [x8]
	ldr	x0, [sp, #24]
	bl	_SP
	mov	x23, x0
	ldr	x0, [sp, #16]
	bl	_SU
	orr	w1, w0, w23
	mov	x0, x22
	bl	_WREG32
Lloh23:
	adrp	x8, _CG_GIPOTS@GOTPAGE
Lloh24:
	ldr	x8, [x8, _CG_GIPOTS@GOTPAGEOFF]
Lloh25:
	ldr	w22, [x8]
	ldr	x0, [sp, #24]
	bl	_CG_GIPOT
	mov	x1, x0
Lloh26:
	adrp	x8, _CG_GIPOT_MASK@GOTPAGE
Lloh27:
	ldr	x8, [x8, _CG_GIPOT_MASK@GOTPAGEOFF]
Lloh28:
	ldr	w8, [x8]
	mvn	w2, w8
	mov	x0, x22
	bl	_WREG32_P
	ldr	x8, [x20]
	cbz	x8, LBB0_4
; %bb.2:
	and	x8, x24, x21
	asr	x8, x8, x25
	cbnz	x8, LBB0_4
; %bb.3:
	mov	x0, x19
	bl	_trinity_override_dynamic_mg_powergating
LBB0_4:
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_HW_REV,4,2                     ; @HW_REV
	.comm	_ATI_REV_ID_MASK,8,3            ; @ATI_REV_ID_MASK
	.comm	_ATI_REV_ID_SHIFT,8,3           ; @ATI_REV_ID_SHIFT
	.comm	_COMPUTE_ENGINE_PLL_PARAM,4,2   ; @COMPUTE_ENGINE_PLL_PARAM
	.comm	_GFX_POWER_GATING_CNTL,4,2      ; @GFX_POWER_GATING_CNTL
	.comm	_SSSD_MASK,8,3                  ; @SSSD_MASK
	.comm	_PDS_DIV_MASK,8,3               ; @PDS_DIV_MASK
	.comm	_CG_PG_CTRL,4,2                 ; @CG_PG_CTRL
	.comm	_CG_GIPOTS,4,2                  ; @CG_GIPOTS
	.comm	_CG_GIPOT_MASK,4,2              ; @CG_GIPOT_MASK
	.no_dead_strip	_trinity_gfx_powergating_initialize
.subsections_via_symbols
