# sh testcase for fmac -*- Asm -*-
# mach: all
# as: -isa=shcompact
# ld: -m shelf32

	.include "compact/testutils.inc"

	start

	# 0.0 * x + y = y.

	fldi0 fr0
	fldi1 fr1
	fldi1 fr2
	fmac fr0, fr1, fr2
	# check result.
	fldi1 fr0
	fcmp/eq fr0, fr2
	bf wrong

	# x * y + 0.0 = x * y.

	fldi1 fr0
	fldi1 fr1
	fldi0 fr2
	# double it.
	fadd fr1, fr2
	fmac fr0, fr1, fr2
	# check result.
	fldi1 fr0
	fadd fr0, fr0
	fcmp/eq fr0, fr2
	bf wrong
	
	# x * 0.0 + y = y.

	fldi1 fr0
	fldi0 fr1
	fldi1 fr2
	fadd fr2, fr2
	fmac fr0, fr1, fr2
	# check result.
	fldi1 fr0
	# double fr0.
	fadd fr0, fr0
	fcmp/eq fr0, fr2
	bf wrong

	# x * 0.0 + 0.0 = 0.0

	fldi1 fr0
	fadd fr0, fr0
	fldi0 fr1
	fldi0 fr2
	fmac fr0, fr1, fr2
	# check result.
	fldi0 fr0
	fcmp/eq fr0, fr2
	bf wrong

	# 0.0 * x + 0.0 = 0.0.

	fldi0 fr0
	fldi1 fr1
	# double it.
	fadd fr1, fr1
	fldi0 fr2
	fmac fr0, fr1, fr2
	# check result.
	fldi0 fr0
	fcmp/eq fr0, fr2
	bf wrong

okay:
	pass

wrong:
	fail
