Home | History | Annotate | Download | only in armv5te
      1 %verify "executed"
      2 /* EABI appears to have Java-style conversions of +inf/-inf/NaN */
      3 %include "armv5te/unop.S" {"instr":"bl      __aeabi_f2iz"}
      4 
      5 #if 0
      6 @include "armv5te/unop.S" {"instr":"bl      f2i_doconv"}
      7 @break
      8 /*
      9  * Convert the float in r0 to an int in r0.
     10  *
     11  * We have to clip values to int min/max per the specification.  The
     12  * expected common case is a "reasonable" value that converts directly
     13  * to modest integer.  The EABI convert function isn't doing this for us.
     14  */
     15 f2i_doconv:
     16     stmfd   sp!, {r4, lr}
     17     mov     r1, #0x4f000000             @ (float)maxint
     18     mov     r4, r0
     19     bl      __aeabi_fcmpge              @ is arg >= maxint?
     20     cmp     r0, #0                      @ nonzero == yes
     21     mvnne   r0, #0x80000000             @ return maxint (7fffffff)
     22     ldmnefd sp!, {r4, pc}
     23 
     24     mov     r0, r4                      @ recover arg
     25     mov     r1, #0xcf000000             @ (float)minint
     26     bl      __aeabi_fcmple              @ is arg <= minint?
     27     cmp     r0, #0                      @ nonzero == yes
     28     movne   r0, #0x80000000             @ return minint (80000000)
     29     ldmnefd sp!, {r4, pc}
     30 
     31     mov     r0, r4                      @ recover arg
     32     mov     r1, r4
     33     bl      __aeabi_fcmpeq              @ is arg == self?
     34     cmp     r0, #0                      @ zero == no
     35     ldmeqfd sp!, {r4, pc}               @ return zero for NaN
     36 
     37     mov     r0, r4                      @ recover arg
     38     bl      __aeabi_f2iz                @ convert float to int
     39     ldmfd   sp!, {r4, pc}
     40 #endif
     41