Home | History | Annotate | Download | only in armv5te
      1 %default { "naninst":"mvn     r0, #0" }
      2     /*
      3      * For the JIT: incoming arguments in r0-r1, r2-r3
      4      *              result in r0
      5      *
      6      * Compare two floating-point values.  Puts 0, 1, or -1 into the
      7      * destination register based on the results of the comparison.
      8      *
      9      * Provide a "naninst" instruction that puts 1 or -1 into r1 depending
     10      * on what value we'd like to return when one of the operands is NaN.
     11      *
     12      * See OP_CMPL_FLOAT for an explanation.
     13      *
     14      * For: cmpl-double, cmpg-double
     15      */
     16     /* op vAA, vBB, vCC */
     17     push    {r0-r3}                     @ save operands
     18     mov     r11, lr                     @ save return address
     19     LDR_PC_LR ".L__aeabi_cdcmple"       @ PIC way of "bl __aeabi_cdcmple"
     20     bhi     .L${opcode}_gt_or_nan       @ C set and Z clear, disambiguate
     21     mvncc   r0, #0                      @ (less than) r1<- -1
     22     moveq   r0, #0                      @ (equal) r1<- 0, trumps less than
     23     add     sp, #16                     @ drop unused operands
     24     bx      r11
     25 
     26     @ Test for NaN with a second comparison.  EABI forbids testing bit
     27     @ patterns, and we can't represent 0x7fc00000 in immediate form, so
     28     @ make the library call.
     29 .L${opcode}_gt_or_nan:
     30     pop     {r2-r3}                     @ restore operands in reverse order
     31     pop     {r0-r1}                     @ restore operands in reverse order
     32     LDR_PC_LR ".L__aeabi_cdcmple"       @ r0<- Z set if eq, C clear if <
     33     movcc   r0, #1                      @ (greater than) r1<- 1
     34     bxcc    r11
     35     $naninst                            @ r1<- 1 or -1 for NaN
     36     bx      r11
     37