Page 325 - ARM 64 Bit Assembly Language
P. 325

314 Chapter 9

                  9.7.7.2 Operations

                   Name     Effect                               Description
                   fcsel    if cond is True then                 Set Fd to Fn or Fm.
                              Fd ← Fn
                            else
                              Fd ← Fm
                            end if


                  9.7.7.3 Examples
                1     fcsel    s0, s1, s2, ge // if ge, then s0<-s1 else s0<-s2



                  9.8 Floating point sine function

                  A fixed point implementation of the sine function was discussed in Section 8.6,and shownto
                  be superior to the floating point sine function provided by GCC. Now that we have covered
                  the FP instructions, we can write an assembly version using floating point that also performs
                  better than the routines provided by GCC.

                  Listing 9.1 Simple scalar implementation of the sinx function using IEEE single precision.

                1  //*************************************************************
                2  // Name: sincos_a_f.S
                3  // Author: Larry Pyeatt
                4  // Date: 2/22/2018
                5  //*************************************************************
                6  // This is a version of the sin functions that uses single
                7  // precision floating point with the FP/NEON instruction set.
                8  // --------------------------------------------------------------
                9         .data
                10        // The following is a table of constants used in the
                11        // Taylor series approximation for sine
                12        .align  5              // Align to cache
                13  ctab:  .word  0xBE2AAAAA     // -1.666666e-01
                14        .word   0x3C088889     //  8.333334e-03
                15        .word   0xB9500D00     // -1.984126e-04
                16        .word   0x3638EF1D     //  2.755732e-06
                17        .word   0xB2D7322A     // -2.505210e-08
                18        .equ    TERMS,((. - ctab)/4)
                19  // --------------------------------------------------------------
                20        .text
                21        .align 2
                22        // float sin_a_f(x)
                23        // sin_a_f implements the sine function using IEEE single
   320   321   322   323   324   325   326   327   328   329   330