# sh testcase for fabs.s $frgh, $frf -*- Asm -*-
# mach: all
# as: -isa=shmedia
# ld: -m shelf64

	.include "media/testutils.inc"

	start
init:
	pta wrong, tr0
	movi 0, r0
	movi 1, r1

fabs0:
	# Ensure fabs(-1) = 1.
	fmov.ls r0, fr7
	float.ls fr7, fr0
	fmov.ls r1, fr7
	float.ls fr7, fr1
	fsub.s fr0, fr1, fr2
	fabs.s fr2, fr3
	fcmpeq.s fr3, fr1, r7
	bnei r7, 1, tr0

fabs1:
	# Ensure fabs(1) = 1.
	fmov.ls r0, fr7
	float.ls fr7, fr0
	fmov.ls r1, fr7
	float.ls fr7, fr1
	fabs.s fr1, fr2
	fcmpeq.s fr1, fr2, r7
	bnei r7, 1, tr0

okay:
	pass

wrong:
	fail
