Page 287 - ARM 64 Bit Assembly Language
P. 287

276 Chapter 8


                47        -1/3! =  AAAAAAAA as an S(-2,32)
                48         1/5! =  44444445 as an S(-6,32)
                49        -1/7! =  97F97F97 as an S(-12,32)
                50         1/9! =  5C778E96 as an S(-18,32)
                51        -1/11! = 9466EA60 as an S(-25,32)
                52         1/13! = 5849184F as an S(-32,32)
                53        -1/15! = 94603063 as an S(-40,32)
                54         1/17! = 654B1DC1 as an S(-48,32)
                55
                56        Combining the two tables of power and coefficient formats, we
                57        can now determine how much shift we need after each step in
                58        order to do all sums in S(2,61) format:
                59
                60        power powerfmt    coef   coeffmt    resultfmt  right shift
                61         x     S(1,30)  *  1 (skip the multiply)       1 -> S(2,61)
                62         x^3   S(3,28)  *  -1/3!  S(-2,32)  = S(2,61)  0 -> S(2,61)
                63         x^5   S(5,26)  *  1/5!  S(-6,32)  = S(0,63)   2 -> S(2,61)
                64         x^7   S(7,24)  *  -1/7!  S(-12,32) = S(-4,64)  6 -> S(2,61)
                65         x^9   S(9,22)  *  1/9!  S(-18,32) = S(-8,64)  10-> S(2,61)
                66         x^11  S(11,20) *  -1/11! S(-25,32) = S(-13,64)  15-> S(2,61)
                67         x^13  S(13,18) *  1/13! S(-32,32) = S(-18,64)  20-> S(2,61)
                68         x^15  S(15,16) *  -1/15! S(-40,32) = S(-24,64)  26-> S(2,61)
                69         x^17  S(17,14) *  1/17! S(-48,32) = S(-30,64)  32-> S(2,61)
                70        Note: the last row has a shift of 32, which indicates that
                71              it can contribute no more than 1/2 bit of precision
                72              to the 32-bit result.
                73        */
                74
                75        // We will define a few constants that may be useful
                76        .data
                77        .global pi
                78  pi:   .word   0x3243F6A8     // pi as an S(3,28)
                79        .equ    PI_LO,0xF6A8
                80        .equ    PI_HI,0x3243
                81  pi_2:  .word  0x1921FB54     // pi/2 as an S(3,28)
                82        .equ    PI_2_LO,0xFB54
                83        .equ    PI_2_HI,0x1921
                84  pi_x2:  .word  0x6487ED51    // 2*pi as an S(3,28)
                85        .equ    PI_X2_LO,0xED51
                86        .equ    PI_X2_HI,0x6487
                87
                88        // This is the table of coefficients and shifts for sinq to use
                89        .align  3              // align to double word boundary
                90  sintab: .word 0xAAAAAAAA,  0  // -1/3!  as an S(-2,32)
                91        .word 0x44444445,  2   //  1/5!  as an S(-6,32)
                92        .word 0x97F97F97,  6   // -1/7!  as an S(-12,32)
                93        .word 0x5C778E96,  10  //  1/9!  as an S(-18,32)
                94        .word 0x9466EA60,  15  // -1/11! as an S(-25,32)
                95        .word 0x5849184F,  20  //  1/13! as an S(-32,32)
   282   283   284   285   286   287   288   289   290   291   292