Changeset a35b458 in mainline for uspace/lib/math/arch/amd64/src
- 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/amd64/src
- Files:
-
- 3 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
Note:
See TracChangeset
for help on using the changeset viewer.