	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function gfx_v8_0_set_powergating_state
_gfx_v8_0_set_powergating_state:        ## @gfx_v8_0_set_powergating_state
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movq	%rdi, %rbx
	movq	_AMD_PG_STATE_GATE@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	xorl	%r15d, %r15d
	cmpl	%esi, %r13d
	sete	%r12b
	callq	_amdgpu_sriov_vf
	testq	%rax, %rax
	jne	LBB0_17
## %bb.1:
	movq	_AMD_PG_SUPPORT_GFX_SMG@GOTPCREL(%rip), %rcx
	movq	_AMD_PG_SUPPORT_RLC_SMU_HS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	(%rcx), %eax
	movq	_AMD_PG_SUPPORT_CP@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movq	_AMD_PG_SUPPORT_GFX_DMG@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	testl	%eax, (%rbx)
	je	LBB0_3
## %bb.2:
	movq	%rbx, %rdi
	callq	_amdgpu_gfx_rlc_enter_safe_mode
LBB0_3:
	movl	4(%rbx), %eax
	addl	$-128, %eax
	cmpl	$4, %eax
	ja	LBB0_15
## %bb.4:
	movl	$13, %ecx
	btl	%eax, %ecx
	jae	LBB0_8
## %bb.5:
	cmpl	%r14d, %r13d
	sete	%r15b
	movq	_AMD_PG_SUPPORT_GFX_SMG@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	(%rbx), %eax
	setne	%al
	andb	%r15b, %al
	movzbl	%al, %esi
	movq	%rbx, %rdi
	callq	_gfx_v8_0_enable_gfx_static_mg_power_gating
	movq	_AMD_PG_SUPPORT_GFX_DMG@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	(%rbx), %eax
	setne	%al
	andb	%r15b, %al
	movzbl	%al, %esi
	movq	%rbx, %rdi
	callq	_gfx_v8_0_enable_gfx_dynamic_mg_power_gating
	movq	_AMD_PG_SUPPORT_GFX_QUICK_MG@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rbx)
	je	LBB0_11
## %bb.6:
	cmpl	%r14d, %r13d
	jne	LBB0_11
## %bb.7:
	movq	%rbx, %rdi
	movl	$1, %esi
	jmp	LBB0_12
LBB0_8:
	movb	%r12b, %r15b
	cmpl	%r14d, %r13d
	sete	-41(%rbp)                       ## 1-byte Folded Spill
	movq	_AMD_PG_SUPPORT_RLC_SMU_HS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	xorl	%r12d, %r12d
	andl	(%rbx), %eax
	setne	%r12b
	movq	%rbx, %rdi
	movl	%r12d, %esi
	callq	_cz_enable_sck_slow_down_on_power_up
	movq	%rbx, %rdi
	movl	%r12d, %esi
	callq	_cz_enable_sck_slow_down_on_power_down
	movq	_AMD_PG_SUPPORT_CP@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	xorl	%esi, %esi
	andl	(%rbx), %eax
	setne	%sil
	movq	%rbx, %rdi
	callq	_cz_enable_cp_power_gating
	movq	%rbx, %rdi
	movl	%r15d, %esi
	callq	_cz_update_gfx_cg_power_gating
	movq	_AMD_PG_SUPPORT_GFX_SMG@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	(%rbx), %eax
	setne	%al
	andb	-41(%rbp), %al                  ## 1-byte Folded Reload
	movzbl	%al, %esi
	movq	%rbx, %rdi
	callq	_gfx_v8_0_enable_gfx_static_mg_power_gating
	movq	_AMD_PG_SUPPORT_GFX_DMG@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rbx)
	je	LBB0_13
## %bb.9:
	cmpl	%r14d, %r13d
	jne	LBB0_13
## %bb.10:
	movq	%rbx, %rdi
	movl	$1, %esi
	jmp	LBB0_14
LBB0_11:
	movq	%rbx, %rdi
	xorl	%esi, %esi
LBB0_12:
	callq	_polaris11_enable_gfx_quick_mg_power_gating
	jmp	LBB0_15
LBB0_13:
	movq	%rbx, %rdi
	xorl	%esi, %esi
LBB0_14:
	callq	_gfx_v8_0_enable_gfx_dynamic_mg_power_gating
LBB0_15:
	movq	_AMD_PG_SUPPORT_RLC_SMU_HS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_AMD_PG_SUPPORT_GFX_SMG@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movq	_AMD_PG_SUPPORT_CP@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movq	_AMD_PG_SUPPORT_GFX_DMG@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	testl	%eax, (%rbx)
	je	LBB0_17
## %bb.16:
	movq	%rbx, %rdi
	callq	_amdgpu_gfx_rlc_exit_safe_mode
LBB0_17:
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AMD_PG_STATE_GATE,4,2          ## @AMD_PG_STATE_GATE
	.comm	_AMD_PG_SUPPORT_GFX_SMG,4,2     ## @AMD_PG_SUPPORT_GFX_SMG
	.comm	_AMD_PG_SUPPORT_RLC_SMU_HS,4,2  ## @AMD_PG_SUPPORT_RLC_SMU_HS
	.comm	_AMD_PG_SUPPORT_CP,4,2          ## @AMD_PG_SUPPORT_CP
	.comm	_AMD_PG_SUPPORT_GFX_DMG,4,2     ## @AMD_PG_SUPPORT_GFX_DMG
	.comm	_AMD_PG_SUPPORT_GFX_QUICK_MG,4,2 ## @AMD_PG_SUPPORT_GFX_QUICK_MG
	.no_dead_strip	_gfx_v8_0_set_powergating_state
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function gfx_v8_0_set_powergating_state
_gfx_v8_0_set_powergating_state:        ; @gfx_v8_0_set_powergating_state
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _AMD_PG_STATE_GATE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _AMD_PG_STATE_GATE@GOTPAGEOFF]
Lloh2:
	ldr	w27, [x8]
	cmp	w27, w1
	cset	w21, eq
	bl	_amdgpu_sriov_vf
	cbnz	x0, LBB0_17
; %bb.1:
	ldr	w8, [x19]
Lloh3:
	adrp	x23, _AMD_PG_SUPPORT_GFX_SMG@GOTPAGE
Lloh4:
	ldr	x23, [x23, _AMD_PG_SUPPORT_GFX_SMG@GOTPAGEOFF]
Lloh5:
	adrp	x24, _AMD_PG_SUPPORT_RLC_SMU_HS@GOTPAGE
Lloh6:
	ldr	x24, [x24, _AMD_PG_SUPPORT_RLC_SMU_HS@GOTPAGEOFF]
	ldr	w9, [x23]
	ldr	w10, [x24]
	orr	w9, w10, w9
Lloh7:
	adrp	x25, _AMD_PG_SUPPORT_CP@GOTPAGE
Lloh8:
	ldr	x25, [x25, _AMD_PG_SUPPORT_CP@GOTPAGEOFF]
	ldr	w10, [x25]
	orr	w9, w9, w10
Lloh9:
	adrp	x26, _AMD_PG_SUPPORT_GFX_DMG@GOTPAGE
Lloh10:
	ldr	x26, [x26, _AMD_PG_SUPPORT_GFX_DMG@GOTPAGEOFF]
	ldr	w10, [x26]
	orr	w9, w9, w10
	tst	w9, w8
	b.eq	LBB0_3
; %bb.2:
	mov	x0, x19
	bl	_amdgpu_gfx_rlc_enter_safe_mode
LBB0_3:
	ldr	w8, [x19, #4]
	sub	w8, w8, #128
	cmp	w8, #4
	b.hi	LBB0_15
; %bb.4:
	mov	w9, #1
	lsl	w8, w9, w8
	mov	w9, #13
	tst	w8, w9
	b.eq	LBB0_8
; %bb.5:
	cmp	w27, w20
	cset	w21, eq
	ldr	w8, [x19]
	ldr	w9, [x23]
	tst	w9, w8
	cset	w8, ne
	and	w1, w8, w21
	mov	x0, x19
	bl	_gfx_v8_0_enable_gfx_static_mg_power_gating
	ldr	w8, [x19]
	ldr	w9, [x26]
	tst	w9, w8
	cset	w8, ne
	and	w1, w8, w21
	mov	x0, x19
	bl	_gfx_v8_0_enable_gfx_dynamic_mg_power_gating
	ldr	w8, [x19]
Lloh11:
	adrp	x9, _AMD_PG_SUPPORT_GFX_QUICK_MG@GOTPAGE
Lloh12:
	ldr	x9, [x9, _AMD_PG_SUPPORT_GFX_QUICK_MG@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_11
; %bb.6:
	cmp	w27, w20
	b.ne	LBB0_11
; %bb.7:
	mov	x0, x19
	mov	w1, #1
	b	LBB0_12
LBB0_8:
	ldr	w8, [x19]
	ldr	w9, [x24]
	tst	w9, w8
	cset	w22, ne
	mov	x0, x19
	mov	x1, x22
	bl	_cz_enable_sck_slow_down_on_power_up
	mov	x0, x19
	mov	x1, x22
	bl	_cz_enable_sck_slow_down_on_power_down
	ldr	w8, [x19]
	ldr	w9, [x25]
	tst	w9, w8
	cset	w1, ne
	mov	x0, x19
	bl	_cz_enable_cp_power_gating
	mov	x0, x19
	mov	x1, x21
	bl	_cz_update_gfx_cg_power_gating
	ldr	w8, [x19]
	ldr	w9, [x23]
	tst	w9, w8
	ccmp	w27, w20, #0, ne
	cset	w1, eq
	mov	x0, x19
	bl	_gfx_v8_0_enable_gfx_static_mg_power_gating
	ldr	w8, [x19]
	ldr	w9, [x26]
	tst	w9, w8
	b.eq	LBB0_13
; %bb.9:
	cmp	w27, w20
	b.ne	LBB0_13
; %bb.10:
	mov	x0, x19
	mov	w1, #1
	b	LBB0_14
LBB0_11:
	mov	x0, x19
	mov	w1, #0
LBB0_12:
	bl	_polaris11_enable_gfx_quick_mg_power_gating
	b	LBB0_15
LBB0_13:
	mov	x0, x19
	mov	w1, #0
LBB0_14:
	bl	_gfx_v8_0_enable_gfx_dynamic_mg_power_gating
LBB0_15:
	ldr	w8, [x19]
	ldr	w9, [x23]
	ldr	w10, [x24]
	orr	w9, w10, w9
	ldr	w10, [x25]
	orr	w9, w9, w10
	ldr	w10, [x26]
	orr	w9, w9, w10
	tst	w9, w8
	b.eq	LBB0_17
; %bb.16:
	mov	x0, x19
	bl	_amdgpu_gfx_rlc_exit_safe_mode
LBB0_17:
	mov	w0, #0
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_AMD_PG_STATE_GATE,4,2          ; @AMD_PG_STATE_GATE
	.comm	_AMD_PG_SUPPORT_GFX_SMG,4,2     ; @AMD_PG_SUPPORT_GFX_SMG
	.comm	_AMD_PG_SUPPORT_RLC_SMU_HS,4,2  ; @AMD_PG_SUPPORT_RLC_SMU_HS
	.comm	_AMD_PG_SUPPORT_CP,4,2          ; @AMD_PG_SUPPORT_CP
	.comm	_AMD_PG_SUPPORT_GFX_DMG,4,2     ; @AMD_PG_SUPPORT_GFX_DMG
	.comm	_AMD_PG_SUPPORT_GFX_QUICK_MG,4,2 ; @AMD_PG_SUPPORT_GFX_QUICK_MG
	.no_dead_strip	_gfx_v8_0_set_powergating_state
.subsections_via_symbols
