Home | History | Annotate | Line # | Download | only in i386
systmodes.S revision 1.1
      1  1.1  ross 
      2  1.1  ross /*
      3  1.1  ross ===============================================================================
      4  1.1  ross 
      5  1.1  ross This GNU assembler source file is part of TestFloat, Release 2a, a package
      6  1.1  ross of programs for testing the correctness of floating-point arithmetic
      7  1.1  ross complying to the IEC/IEEE Standard for Floating-Point.
      8  1.1  ross 
      9  1.1  ross Written by John R. Hauser.  More information is available through the Web
     10  1.1  ross page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
     11  1.1  ross 
     12  1.1  ross THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort
     13  1.1  ross has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
     14  1.1  ross TIMES RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO
     15  1.1  ross PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
     16  1.1  ross AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
     17  1.1  ross 
     18  1.1  ross Derivative works are acceptable, even for commercial purposes, so long as
     19  1.1  ross (1) they include prominent notice that the work is derivative, and (2) they
     20  1.1  ross include prominent notice akin to these four paragraphs for those parts of
     21  1.1  ross this code that are retained.
     22  1.1  ross 
     23  1.1  ross ===============================================================================
     24  1.1  ross */
     25  1.1  ross 
     26  1.1  ross 	.text
     27  1.1  ross 
     28  1.1  ross /*
     29  1.1  ross -------------------------------------------------------------------------------
     30  1.1  ross Sets the system's IEC/IEEE floating-point rounding mode.  Also disables all
     31  1.1  ross system exception traps.
     32  1.1  ross -------------------------------------------------------------------------------
     33  1.1  ross */
     34  1.1  ross 	.align 4
     35  1.1  ross 	.global _syst_float_set_rounding_mode
     36  1.1  ross _syst_float_set_rounding_mode:
     37  1.1  ross 	movb 4(%esp),%al
     38  1.1  ross 	andb $3,%al
     39  1.1  ross 	shlw $10,%ax
     40  1.1  ross 	orw $63,%ax
     41  1.1  ross 	subl $2,%esp
     42  1.1  ross 	fnstcw 0(%esp)
     43  1.1  ross 	andw $768,0(%esp)
     44  1.1  ross 	orw %ax,0(%esp)
     45  1.1  ross 	fldcw 0(%esp)
     46  1.1  ross 	addl $2,%esp
     47  1.1  ross 	ret
     48  1.1  ross 
     49  1.1  ross /*
     50  1.1  ross -------------------------------------------------------------------------------
     51  1.1  ross Sets the rounding precision of subsequent extended double-precision
     52  1.1  ross operations.  The `precision' argument should be one of 0, 32, 64, or 80.
     53  1.1  ross If `precision' is 32, the rounding precision is set equivalent to single
     54  1.1  ross precision; else if `precision' is 64, the rounding precision is set
     55  1.1  ross equivalent to double precision; else the rounding precision is set to full
     56  1.1  ross extended double precision.
     57  1.1  ross -------------------------------------------------------------------------------
     58  1.1  ross */
     59  1.1  ross 	.align 4
     60  1.1  ross 	.global _syst_float_set_rounding_precision
     61  1.1  ross _syst_float_set_rounding_precision:
     62  1.1  ross 	movb 4(%esp),%al
     63  1.1  ross 	movb $0,%ah
     64  1.1  ross 	cmpb $32,%al
     65  1.1  ross 	je setRoundingPrecision
     66  1.1  ross 	movb $2,%ah
     67  1.1  ross 	cmpb $64,%al
     68  1.1  ross 	je setRoundingPrecision
     69  1.1  ross 	movb $3,%ah
     70  1.1  ross 	cmpb $80,%al
     71  1.1  ross 	je setRoundingPrecision
     72  1.1  ross 	movb $0,%ah
     73  1.1  ross setRoundingPrecision:
     74  1.1  ross 	movb $0,%al
     75  1.1  ross 	subl $2,%esp
     76  1.1  ross 	fnstcw 0(%esp)
     77  1.1  ross 	andw $64767,0(%esp)
     78  1.1  ross 	orw %ax,0(%esp)
     79  1.1  ross 	fldcw 0(%esp)
     80  1.1  ross 	addl $2,%esp
     81  1.1  ross 	ret
     82  1.1  ross 
     83