Changeset a35b458 in mainline for uspace/lib/math/arch
- Timestamp:
- 2018-03-02T20:10:49Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f1380b7
- Parents:
- 3061bc1
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
- Location:
- uspace/lib/math/arch
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/math/arch/amd64/src/cos.S
r3061bc1 ra35b458 35 35 pushq %rbp 36 36 movq %rsp, %rbp 37 37 38 38 # compute cosine (using red zone) 39 39 40 40 movsd %xmm0, -8(%rbp) 41 41 fldl -8(%rbp) 42 42 43 43 fcos 44 44 45 45 # detect if source operand is out of range 46 46 47 47 fnstsw %ax 48 48 andw $X87_STATUS_WORD_C2_MASK, %ax 49 49 jnz fix_range 50 50 51 51 fstpl -8(%rbp) 52 52 movsd -8(%rbp), %xmm0 53 53 54 54 leave 55 55 retq 56 56 57 57 # argument reduction 58 58 59 59 fix_range: 60 60 fldpi 61 61 fadd %st(0) 62 62 fxch %st(1) 63 63 64 64 reduce: 65 65 fprem1 … … 67 67 andw $X87_STATUS_WORD_C2_MASK, %ax 68 68 jnz reduce 69 69 70 70 fstp %st(1) 71 71 fcos 72 72 73 73 fstpl -8(%rbp) 74 74 movsd -8(%rbp), %xmm0 75 75 76 76 leave 77 77 retq -
uspace/lib/math/arch/amd64/src/sin.S
r3061bc1 ra35b458 35 35 pushq %rbp 36 36 movq %rsp, %rbp 37 37 38 38 # compute sine (using red zone) 39 39 40 40 movsd %xmm0, -8(%rbp) 41 41 fldl -8(%rbp) 42 42 43 43 fsin 44 44 45 45 # detect if source operand is out of range 46 46 47 47 fnstsw %ax 48 48 andw $X87_STATUS_WORD_C2_MASK, %ax 49 49 jnz fix_range 50 50 51 51 fstpl -8(%rbp) 52 52 movsd -8(%rbp), %xmm0 53 53 54 54 leave 55 55 retq 56 56 57 57 # argument reduction 58 58 59 59 fix_range: 60 60 fldpi 61 61 fadd %st(0) 62 62 fxch %st(1) 63 63 64 64 reduce: 65 65 fprem1 … … 67 67 andw $X87_STATUS_WORD_C2_MASK, %ax 68 68 jnz reduce 69 69 70 70 fstp %st(1) 71 71 fsin 72 72 73 73 fstpl -8(%rbp) 74 74 movsd -8(%rbp), %xmm0 75 75 76 76 leave 77 77 retq -
uspace/lib/math/arch/amd64/src/trunc.S
r3061bc1 ra35b458 35 35 pushq %rbp 36 36 movq %rsp, %rbp 37 37 38 38 # store x87 control word in the red zone 39 39 40 40 fnstcw -8(%rbp) 41 41 movw -8(%rbp), %ax 42 42 43 43 # set rounding control to truncate 44 44 # (no masking necessary for this flag) 45 45 46 46 orw $X87_CONTROL_WORD_RC_TRUNCATE, %ax 47 47 movw %ax, -16(%rbp) 48 48 fldcw -16(%rbp) 49 49 50 50 # truncate 51 51 52 52 movsd %xmm0, -16(%rbp) 53 53 fldl -16(%rbp) … … 55 55 fstpl -16(%rbp) 56 56 movsd -16(%rbp), %xmm0 57 57 58 58 # restore original control word 59 59 60 60 fldcw -8(%rbp) 61 61 62 62 leave 63 63 retq -
uspace/lib/math/arch/ia32/src/cos.S
r3061bc1 ra35b458 34 34 FUNCTION_BEGIN(cos_f64) 35 35 # compute cosine (no stack frame) 36 36 37 37 fldl 4(%esp) 38 38 fcos 39 39 40 40 # detect if source operand is out of range 41 41 42 42 fnstsw %ax 43 43 andw $X87_STATUS_WORD_C2_MASK, %ax 44 44 jnz fix_range 45 45 46 46 ret 47 47 48 48 # argument reduction 49 49 50 50 fix_range: 51 51 fldpi 52 52 fadd %st(0) 53 53 fxch %st(1) 54 54 55 55 reduce: 56 56 fprem1 … … 58 58 andw $X87_STATUS_WORD_C2_MASK, %ax 59 59 jnz reduce 60 60 61 61 fstp %st(1) 62 62 fcos 63 63 64 64 ret 65 65 FUNCTION_END(cos_f64) -
uspace/lib/math/arch/ia32/src/sin.S
r3061bc1 ra35b458 34 34 FUNCTION_BEGIN(sin_f64) 35 35 # compute sine (no stack frame) 36 36 37 37 fldl 4(%esp) 38 38 fsin 39 39 40 40 # detect if source operand is out of range 41 41 42 42 fnstsw %ax 43 43 andw $X87_STATUS_WORD_C2_MASK, %ax 44 44 jnz fix_range 45 45 46 46 ret 47 47 48 48 # argument reduction 49 49 50 50 fix_range: 51 51 fldpi 52 52 fadd %st(0) 53 53 fxch %st(1) 54 54 55 55 reduce: 56 56 fprem1 … … 58 58 andw $X87_STATUS_WORD_C2_MASK, %ax 59 59 jnz reduce 60 60 61 61 fstp %st(1) 62 62 fsin 63 63 64 64 ret 65 65 FUNCTION_END(sin_f64) -
uspace/lib/math/arch/ia32/src/trunc.S
r3061bc1 ra35b458 36 36 movl %esp, %ebp 37 37 subl $8, %esp 38 38 39 39 # store x87 control word 40 40 41 41 fnstcw -4(%ebp) 42 42 movw -4(%ebp), %ax 43 43 44 44 # set rounding control to truncate 45 45 # (no masking necessary for this flag) 46 46 47 47 orw $X87_CONTROL_WORD_RC_TRUNCATE, %ax 48 48 movw %ax, -8(%ebp) 49 49 fldcw -8(%ebp) 50 50 51 51 # truncate 52 52 53 53 fldl 8(%ebp) 54 54 frndint 55 55 56 56 # restore original control word 57 57 58 58 fldcw -4(%ebp) 59 59 60 60 leave 61 61 ret
Note:
See TracChangeset
for help on using the changeset viewer.