Skip to content

Blink executes FDIV as FDIVR and FDIVR as FDIV #196

Description

@alxrmorozov

This test succeeds on real CPU but fails in blink:

#include "test/asm/mac.inc"
.globl	_start
_start:

//	make -j8 o//blink o//test/asm/fdiv.elf
//	o//blink/blinkenlights o//test/asm/fdiv.elf

	.test	"fdiv"
	fld1
	fldz
	fdiv	%st,%st(1)
	fistpq	-8(%rsp)
	fistpq	-8(%rsp)
	cmpq	$0,-8(%rsp)
	.e

	.test	"fdivr"
	fldz
	fld1
	fdivr	%st,%st(1)
	fistpq	-8(%rsp)
	fistpq	-8(%rsp)
	cmpq	$0,-8(%rsp)
	.e

"test succeeded":
	.exit

If I replace fdiv with fdivr and fdivr with fdiv it succeeds in blink.
It looks like this is connected with this AT&T assembler feature:
https://sourceware.org/binutils/docs/as.html#i386_002dBugs
But FSUB and FSUBR work correctly.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions