Print this page




  30 #if defined(ELFOBJ)
  31 #pragma weak fdimf = __fdimf
  32 #endif
  33 
  34 #include "libm.h"       /* for islessequal macro */
  35 
  36 float
  37 __fdimf(float x, float y) {
  38         /*
  39          * On SPARC v8plus/v9, this could be implemented as follows
  40          * (assuming %f0 = x, %f1 = y, return value left in %f0):
  41          *
  42          * fcmps        %fcc0,%f0,%f1
  43          * st           %g0,[scratch]   ! use fzero instead of st/ld
  44          * ld           [scratch],%f2   ! if VIS is available
  45          * fnegs        %f2,%f3
  46          * fmovsle      %fcc0,%f2,%f0
  47          * fmovsle      %fcc0,%f3,%f1
  48          * fsubs        %f0,%f1,%f0
  49          */
  50 #if defined(COMPARISON_MACRO_BUG)
  51         if (x == x && y == y && x <= y) {    /* } */
  52 #else
  53         if (islessequal(x, y)) {
  54 #endif
  55                 x = 0.0f;
  56                 y = -x;
  57         }
  58         return (x - y);
  59 }


  30 #if defined(ELFOBJ)
  31 #pragma weak fdimf = __fdimf
  32 #endif
  33 
  34 #include "libm.h"       /* for islessequal macro */
  35 
  36 float
  37 __fdimf(float x, float y) {
  38         /*
  39          * On SPARC v8plus/v9, this could be implemented as follows
  40          * (assuming %f0 = x, %f1 = y, return value left in %f0):
  41          *
  42          * fcmps        %fcc0,%f0,%f1
  43          * st           %g0,[scratch]   ! use fzero instead of st/ld
  44          * ld           [scratch],%f2   ! if VIS is available
  45          * fnegs        %f2,%f3
  46          * fmovsle      %fcc0,%f2,%f0
  47          * fmovsle      %fcc0,%f3,%f1
  48          * fsubs        %f0,%f1,%f0
  49          */



  50         if (islessequal(x, y)) {

  51                 x = 0.0f;
  52                 y = -x;
  53         }
  54         return (x - y);
  55 }