	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_r600_ib_test                   ## -- Begin function r600_ib_test
	.p2align	4, 0x90
_r600_ib_test:                          ## @r600_ib_test
	.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	%rbx
	subq	$40, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, %r14
	leaq	-28(%rbp), %rsi
	callq	_radeon_scratch_get
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	movl	%eax, %ebx
	leaq	L_.str(%rip), %rdi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	_DRM_ERROR
	jmp	LBB0_18
LBB0_2:
	movl	-28(%rbp), %edi
	movl	$-889266515, %esi               ## imm = 0xCAFEDEAD
	callq	_WREG32
	movl	(%r15), %esi
	leaq	-56(%rbp), %rdx
	movq	%r14, %rdi
	xorl	%ecx, %ecx
	movl	$256, %r8d                      ## imm = 0x100
	callq	_radeon_ib_get
	testl	%eax, %eax
	je	LBB0_4
## %bb.3:
	movl	%eax, %ebx
	leaq	L_.str.1(%rip), %rdi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	_DRM_ERROR
	jmp	LBB0_17
LBB0_4:
	movq	_PACKET3_SET_CONFIG_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	$1, %esi
	callq	_PACKET3
	movq	-56(%rbp), %rcx
	movl	%eax, (%rcx)
	movl	-28(%rbp), %eax
	movq	_PACKET3_SET_CONFIG_REG_OFFSET@GOTPCREL(%rip), %rdx
	subl	(%rdx), %eax
	sarl	$2, %eax
	movl	%eax, 4(%rcx)
	movl	$-559038737, 8(%rcx)            ## imm = 0xDEADBEEF
	movl	$3, -48(%rbp)
	leaq	-56(%rbp), %rsi
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_radeon_ib_schedule
	testl	%eax, %eax
	je	LBB0_7
## %bb.5:
	movl	%eax, %ebx
	leaq	L_.str.2(%rip), %rdi
	jmp	LBB0_6
LBB0_7:
	movq	-40(%rbp), %rdi
	xorl	%r15d, %r15d
	xorl	%esi, %esi
	callq	_radeon_fence_wait
	testl	%eax, %eax
	je	LBB0_8
## %bb.19:
	movl	%eax, %ebx
	leaq	L_.str.3(%rip), %rdi
LBB0_6:
	movl	%ebx, %esi
	xorl	%eax, %eax
	callq	_DRM_ERROR
LBB0_16:
	leaq	-56(%rbp), %rsi
	movq	%r14, %rdi
	callq	_radeon_ib_free
LBB0_17:
	movl	-28(%rbp), %esi
	movq	%r14, %rdi
	callq	_radeon_scratch_free
LBB0_18:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	cmpl	$0, (%r14)
	je	LBB0_15
## %bb.9:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movl	-28(%rbp), %edi
	callq	_RREG32
	movl	%eax, %r15d
	cmpl	$-559038737, %eax               ## imm = 0xDEADBEEF
	je	LBB0_11
## %bb.12:                              ##   in Loop: Header=BB0_10 Depth=1
	movl	$1, %edi
	callq	_DRM_UDELAY
	incl	%ebx
	movl	(%r14), %eax
	cmpl	%eax, %ebx
	jb	LBB0_10
	jmp	LBB0_13
LBB0_11:
	movl	(%r14), %eax
LBB0_13:
	cmpl	%eax, %ebx
	jae	LBB0_15
## %bb.14:
	movq	-40(%rbp), %rax
	movl	(%rax), %esi
	leaq	L_.str.4(%rip), %rdi
	movl	%ebx, %edx
	callq	_DRM_INFO
	xorl	%ebx, %ebx
	jmp	LBB0_16
LBB0_15:
	movl	-28(%rbp), %esi
	leaq	L_.str.5(%rip), %rdi
	xorl	%ebx, %ebx
	movl	%r15d, %edx
	xorl	%eax, %eax
	callq	_DRM_ERROR
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_16
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"radeon: failed to get scratch reg (%d).\n"

L_.str.1:                               ## @.str.1
	.asciz	"radeon: failed to get ib (%d).\n"

	.comm	_PACKET3_SET_CONFIG_REG,4,2     ## @PACKET3_SET_CONFIG_REG
	.comm	_PACKET3_SET_CONFIG_REG_OFFSET,4,2 ## @PACKET3_SET_CONFIG_REG_OFFSET
L_.str.2:                               ## @.str.2
	.asciz	"radeon: failed to schedule ib (%d).\n"

L_.str.3:                               ## @.str.3
	.asciz	"radeon: fence wait failed (%d).\n"

L_.str.4:                               ## @.str.4
	.asciz	"ib test on ring %d succeeded in %u usecs\n"

L_.str.5:                               ## @.str.5
	.asciz	"radeon: ib test failed (scratch(0x%04X)=0x%08X)\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_r600_ib_test                   ; -- Begin function r600_ib_test
	.p2align	2
_r600_ib_test:                          ; @r600_ib_test
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	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
	mov	x21, x1
	mov	x19, x0
	add	x1, sp, #20
	bl	_radeon_scratch_get
	cbz	w0, LBB0_2
; %bb.1:
	mov	x20, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x20
	bl	_DRM_ERROR
	b	LBB0_11
LBB0_2:
	ldr	w0, [sp, #20]
	mov	w1, #57005
	movk	w1, #51966, lsl #16
	bl	_WREG32
	ldr	w1, [x21]
	add	x2, sp, #24
	mov	x0, x19
	mov	x3, #0
	mov	w4, #256
	bl	_radeon_ib_get
	cbz	w0, LBB0_4
; %bb.3:
	mov	x20, x0
Lloh2:
	adrp	x0, l_.str.1@PAGE
Lloh3:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x20
	bl	_DRM_ERROR
	b	LBB0_10
LBB0_4:
	mov	w22, #48879
	movk	w22, #57005, lsl #16
Lloh4:
	adrp	x8, _PACKET3_SET_CONFIG_REG@GOTPAGE
Lloh5:
	ldr	x8, [x8, _PACKET3_SET_CONFIG_REG@GOTPAGEOFF]
Lloh6:
	ldr	w0, [x8]
	mov	w1, #1
	bl	_PACKET3
	ldr	x8, [sp, #24]
	str	w0, [x8]
	ldr	w9, [sp, #20]
Lloh7:
	adrp	x10, _PACKET3_SET_CONFIG_REG_OFFSET@GOTPAGE
Lloh8:
	ldr	x10, [x10, _PACKET3_SET_CONFIG_REG_OFFSET@GOTPAGEOFF]
Lloh9:
	ldr	w10, [x10]
	sub	w9, w9, w10
	asr	w9, w9, #2
	stp	w9, w22, [x8, #4]
	mov	w8, #3
	str	w8, [sp, #32]
	add	x1, sp, #24
	mov	x0, x19
	mov	x2, #0
	bl	_radeon_ib_schedule
	cbz	w0, LBB0_6
; %bb.5:
	mov	x20, x0
Lloh10:
	adrp	x0, l_.str.2@PAGE
Lloh11:
	add	x0, x0, l_.str.2@PAGEOFF
	b	LBB0_8
LBB0_6:
	ldr	x0, [sp, #40]
	mov	w1, #0
	bl	_radeon_fence_wait
	cbz	w0, LBB0_12
; %bb.7:
	mov	x20, x0
Lloh12:
	adrp	x0, l_.str.3@PAGE
Lloh13:
	add	x0, x0, l_.str.3@PAGEOFF
LBB0_8:
	mov	x1, x20
	bl	_DRM_ERROR
LBB0_9:
	add	x1, sp, #24
	mov	x0, x19
	bl	_radeon_ib_free
LBB0_10:
	ldr	w1, [sp, #20]
	mov	x0, x19
	bl	_radeon_scratch_free
LBB0_11:
	mov	x0, x20
	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
	add	sp, sp, #96
	ret
LBB0_12:
	ldr	w8, [x19]
	cbz	w8, LBB0_16
; %bb.13:
	mov	w20, #0
LBB0_14:                                ; =>This Inner Loop Header: Depth=1
	ldr	w0, [sp, #20]
	bl	_RREG32
	mov	x21, x0
	cmp	w0, w22
	b.eq	LBB0_17
; %bb.15:                               ;   in Loop: Header=BB0_14 Depth=1
	mov	w0, #1
	bl	_DRM_UDELAY
	add	w20, w20, #1
	ldr	w8, [x19]
	cmp	w20, w8
	b.lo	LBB0_14
	b	LBB0_18
LBB0_16:
	mov	w21, #0
	b	LBB0_20
LBB0_17:
	ldr	w8, [x19]
LBB0_18:
	cmp	w20, w8
	b.hs	LBB0_20
; %bb.19:
	ldr	x8, [sp, #40]
	ldr	w1, [x8]
Lloh14:
	adrp	x0, l_.str.4@PAGE
Lloh15:
	add	x0, x0, l_.str.4@PAGEOFF
	mov	x2, x20
	bl	_DRM_INFO
	mov	w20, #0
	b	LBB0_9
LBB0_20:
	ldr	w1, [sp, #20]
	str	x21, [sp]
Lloh16:
	adrp	x0, l_.str.5@PAGE
Lloh17:
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_DRM_ERROR
Lloh18:
	adrp	x8, _EINVAL@GOTPAGE
Lloh19:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_9
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"radeon: failed to get scratch reg (%d).\n"

l_.str.1:                               ; @.str.1
	.asciz	"radeon: failed to get ib (%d).\n"

	.comm	_PACKET3_SET_CONFIG_REG,4,2     ; @PACKET3_SET_CONFIG_REG
	.comm	_PACKET3_SET_CONFIG_REG_OFFSET,4,2 ; @PACKET3_SET_CONFIG_REG_OFFSET
l_.str.2:                               ; @.str.2
	.asciz	"radeon: failed to schedule ib (%d).\n"

l_.str.3:                               ; @.str.3
	.asciz	"radeon: fence wait failed (%d).\n"

l_.str.4:                               ; @.str.4
	.asciz	"ib test on ring %d succeeded in %u usecs\n"

l_.str.5:                               ; @.str.5
	.asciz	"radeon: ib test failed (scratch(0x%04X)=0x%08X)\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
.subsections_via_symbols
