~mpu/qbe

2 2

Problem using blit

Roberto E. Vargas Caballero <k0ga@shike2.com>
Details
Message ID
<ZQyBBpOUI8ee/1FE@simple-cc.openbsd.amsterdam>
DKIM signature
missing
Download raw message
Hi,

I have rebased all the changes of upstream and I have moved
to use the blit version in upstream and I got several tests
failling. The first one failling is this qbe code

	data $.L4 = align 4 {
		w	1,
		w	0,
	}
	export function w $main()
	{
	@.L8
		%x.L4 =l	alloc4	8
			blit	%x.L4,$.L4,8
		%.L6 =l	add	%x.L4,4
		%.L7 =w	loadsw	%.L6
			ret	%.L7
	}

that generates

	.data
	.balign 4
	.L4:
		.int 1
		.int 0
	/* end data */

	.text
	.globl main
	main:
		pushq %rbp
		movq %rsp, %rbp
		movl $3735936685, %eax
		leave
		ret
	.type main, @function
	.size main, .-main
	/* end function main */

	.section .note.GNU-stack,"",@progbits

that clearly is wrong.

I'll submit the other tests failing after this one is fixed.

Regards,
Roberto Vargas
Details
Message ID
<60b611ba-825c-4303-9b23-bc9cb03610de@app.fastmail.com>
In-Reply-To
<ZQyBBpOUI8ee/1FE@simple-cc.openbsd.amsterdam> (view parent)
DKIM signature
missing
Download raw message
On Thu, Sep 21, 2023, at 19:44, Roberto E. Vargas Caballero wrote:
> 	@.L8
> 		%x.L4 =l	alloc4	8
> 			blit	%x.L4,$.L4,8
> 		%.L6 =l	add	%x.L4,4
> 		%.L7 =w	loadsw	%.L6
> 			ret	%.L7

Blit, unlike memcpy(), takes the destination pointer as second
argument. In your code, you copy from %x.L4 to $.L4, that is,
you copy from uninitialized memory. The compilation result thus
looks correct to me.

Maybe you meant

        blit $.L4,%x.L4,8
Roberto E. Vargas Caballero <k0ga@shike2.com>
Details
Message ID
<ZRKGL7cVaREeIJiQ@simple-cc.openbsd.amsterdam>
In-Reply-To
<60b611ba-825c-4303-9b23-bc9cb03610de@app.fastmail.com> (view parent)
DKIM signature
missing
Download raw message
On Sat, Sep 23, 2023 at 09:29:32AM +0200, Quentin Carbonneaux wrote:
> On Thu, Sep 21, 2023, at 19:44, Roberto E. Vargas Caballero wrote:
> > 	@.L8
> > 		%x.L4 =l	alloc4	8
> > 			blit	%x.L4,$.L4,8
> > 		%.L6 =l	add	%x.L4,4
> > 		%.L7 =w	loadsw	%.L6
> > 			ret	%.L7
> 
> Blit, unlike memcpy(), takes the destination pointer as second
> argument. In your code, you copy from %x.L4 to $.L4, that is,
> you copy from uninitialized memory. The compilation result thus
> looks correct to me.
> 
> Maybe you meant
> 
>         blit $.L4,%x.L4,8

Ok, that makes sense. After fixing that all the tests are passing.

Thank you,
Reply to thread Export thread (mbox)