/* ExtendedFloatSupportImpl.sun4.S */
/* Copyright (C) 1991 by Xerox Corporation.  All rights reserved. */
/* Michael Plass, August 12, 1991 10:09:21 am PDT */
!
! Access to SPARC support for Extended Precision (128-bit) Floating Point
!
	.seg	"text"

	.global	←XR←ExtendedFloatAdd
←XR←ExtendedFloatAdd:
	save	%sp,-80,%sp

	ld	[%i0],%f0
	ld	[%i0+4],%f1
	ld	[%i0+8],%f2
	ld	[%i0+12],%f3

	ld	[%i1],%f4
	ld	[%i1+4],%f5
	ld	[%i1+8],%f6
	ld	[%i1+12],%f7

	faddx	%f0, %f4, %f8
	
	st	%f8,[%i2]
	st	%f9,[%i2+4]
	st	%f10,[%i2+8]
	st	%f11,[%i2+12]

	ret
	restore

	.global	←XR←ExtendedFloatSubtract
←XR←ExtendedFloatSubtract:
	save	%sp,-80,%sp

	ld	[%i0],%f0
	ld	[%i0+4],%f1
	ld	[%i0+8],%f2
	ld	[%i0+12],%f3

	ld	[%i1],%f4
	ld	[%i1+4],%f5
	ld	[%i1+8],%f6
	ld	[%i1+12],%f7

	fsubx	%f0, %f4, %f8
	
	st	%f8,[%i2]
	st	%f9,[%i2+4]
	st	%f10,[%i2+8]
	st	%f11,[%i2+12]

	ret
	restore

	.global	←XR←ExtendedFloatMultiply
←XR←ExtendedFloatMultiply:
	save	%sp,-80,%sp

	ld	[%i0],%f0
	ld	[%i0+4],%f1
	ld	[%i0+8],%f2
	ld	[%i0+12],%f3

	ld	[%i1],%f4
	ld	[%i1+4],%f5
	ld	[%i1+8],%f6
	ld	[%i1+12],%f7

	fmulx	%f0, %f4, %f8
	
	st	%f8,[%i2]
	st	%f9,[%i2+4]
	st	%f10,[%i2+8]
	st	%f11,[%i2+12]

	ret
	restore

	.global	←XR←ExtendedFloatDivide
←XR←ExtendedFloatDivide:
	save	%sp,-80,%sp

	ld	[%i0],%f0
	ld	[%i0+4],%f1
	ld	[%i0+8],%f2
	ld	[%i0+12],%f3

	ld	[%i1],%f4
	ld	[%i1+4],%f5
	ld	[%i1+8],%f6
	ld	[%i1+12],%f7

	fdivx	%f0, %f4, %f8
	
	st	%f8,[%i2]
	st	%f9,[%i2+4]
	st	%f10,[%i2+8]
	st	%f11,[%i2+12]

	ret
	restore

	.global	←XR←ExtendedFloatLess
←XR←ExtendedFloatLess:
	save	%sp,-64,%sp

	ld	[%i0],%f0
	ld	[%i0+4],%f1
	ld	[%i0+8],%f2
	ld	[%i0+12],%f3

	ld	[%i1],%f4
	ld	[%i1+4],%f5
	ld	[%i1+8],%f6
	ld	[%i1+12],%f7

	fcmpex	%f0,%f4
	nop

	fbuge,a	LE12
	mov	0,%o0
	mov	1,%o0
LE12:
	ret
	restore	%g0,%o0,%o0

	.global	←XR←ExtendedFloatEqual
←XR←ExtendedFloatEqual:
	save	%sp,-64,%sp

	ld	[%i0],%f0
	ld	[%i0+4],%f1
	ld	[%i0+8],%f2
	ld	[%i0+12],%f3

	ld	[%i1],%f4
	ld	[%i1+4],%f5
	ld	[%i1+8],%f6
	ld	[%i1+12],%f7

	fcmpx	%f0,%f4
	nop

	nop				! [internal]
	fbne,a	LE15
	mov	0,%o0
	mov	1,%o0
LE15:
	ret
	restore	%g0,%o0,%o0

	.global	←XR←ExtendedFromDReal
←XR←ExtendedFromDReal:
	save	%sp,-80,%sp

	ld	[%i0],%f0
	ld	[%i0+4],%f1

	fdtox	%f0, %f4
	
	st	%f4,[%i1]
	st	%f5,[%i1+4]
	st	%f6,[%i1+8]
	st	%f7,[%i1+12]

	ret
	restore

	.global	←XR←DRealFromExtended
←XR←DRealFromExtended:
	save	%sp,-80,%sp

	ld	[%i0],%f0
	ld	[%i0+4],%f1
	ld	[%i0+8],%f2
	ld	[%i0+12],%f3

	fxtod	%f0, %f4
	
	st	%f4,[%i1]
	st	%f5,[%i1+4]

	ret
	restore