[Webkit-unassigned] [Bug 198106] WebAssembly: pow functions returns 0 when exponent 1.0 or -1.0

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue May 28 16:46:47 PDT 2019


https://bugs.webkit.org/show_bug.cgi?id=198106

--- Comment #5 from Justin Michaud <justin_michaud at apple.com> ---
powTest
(func $func25 (param $var0 f64)
    (local $var1 i32) (local $var2 f64)
    get_global $global5
    set_local $var1
    get_global $global5
    i32.const 16
    i32.add
    set_global $global5
    get_local $var0
    call $func56
    set_local $var2
    get_local $var1
    get_local $var0
    f64.store
    get_local $var1
    i32.const 8
    i32.add
    get_local $var2
    f64.store
    get_local $var1
    call $func55
    get_local $var1
    set_global $global5
  )

Math.pow
(func $func56 (param $var0 f64) (result f64)
    (local $var1 i32) (local $var2 i32) (local $var3 i32) (local $var4 i32) (local $var5 i32) (local $var6 i64) (local $var7 f64) (local $var8 f64) (local $var9 f64) (local $var10 f64) (local $var11 f64) (local $var12 f64) (local $var13 f64) (local $var14 f64)
    get_local $var0
    i64.reinterpret/f64
    tee_local $var6
    i64.const 32
    i64.shr_u
    i32.wrap/i64
    tee_local $var4
    i32.const 2147483647
    i32.and
    tee_local $var1
    get_local $var6
    i32.wrap/i64
    tee_local $var3
    i32.or
    i32.eqz
    if
      f64.const 1
      return
    end
    get_local $var1
    i32.const 2146435072
    i32.le_u
    if
      get_local $var1
      i32.const 2146435072
      i32.eq
      tee_local $var5
      get_local $var3
      i32.const 0
      i32.ne
      i32.and
      i32.eqz
      if
        block $label1
          block $label0
            get_local $var3
            i32.eqz
            br_if $label0
            br $label1
          end $label0
          get_local $var5
          if
            get_local $var0
            f64.const 0.0
            get_local $var4
            i32.const -1
            i32.gt_s
            select
            return
          end
          get_local $var1
          i32.const 1072693248
          i32.eq
          if
            f64.const 10
            f64.const 0.1
            get_local $var4
            i32.const -1
            i32.gt_s
            select
            return
          end
          get_local $var4
          i32.const 1073741824
          i32.eq
          if
            f64.const 100
            return
          end
          get_local $var4
          i32.const 1071644672
          i32.eq
          if
            f64.const 3.1622776601683795
            return
          end
        end $label1
        f64.const 1
        set_local $var10
        get_local $var1
        i32.const 1105199104
        i32.gt_u
        if (result f64)
          get_local $var1
          i32.const 1139802112
          i32.gt_u
          if
            get_global $global4
            f64.const 0.0
            get_local $var4
            i32.const 0
            i32.gt_s
            select
            return
          end
          get_local $var10
          f64.const 1e+300
          f64.mul
          f64.const 1e+300
          f64.mul
          get_local $var10
          f64.const 1e-300
          f64.mul
          f64.const 1e-300
          f64.mul
          get_local $var4
          i32.const 0
          i32.gt_s
          select
          return
        else
          i32.const 1
          tee_local $var3
          i32.const 3
          i32.shl
          i32.const 1536
          i32.add
          f64.load
          tee_local $var13
          f64.const 1.25
          get_local $var3
          i32.const 3
          i32.shl
          i32.const 1504
          i32.add
          f64.load
          tee_local $var12
          f64.sub
          tee_local $var11
          f64.const 1
          get_local $var12
          f64.const 1.25
          f64.add
          f64.div
          tee_local $var9
          f64.mul
          tee_local $var8
          i64.reinterpret/f64
          i64.const -4294967296
          i64.and
          f64.reinterpret/i64
          tee_local $var7
          get_local $var7
          get_local $var7
          f64.mul
          tee_local $var14
          f64.const 3
          f64.add
          get_local $var8
          get_local $var7
          f64.add
          get_local $var9
          get_local $var11
          get_local $var3
          i32.const 18
          i32.shl
          i32.const 1073872896
          i32.add
          i64.extend_u/i32
          i64.const 32
          i64.shl
          f64.reinterpret/i64
          tee_local $var11
          get_local $var7
          f64.mul
          f64.sub
          f64.const 1.25
          get_local $var11
          get_local $var12
          f64.sub
          f64.sub
          get_local $var7
          f64.mul
          f64.sub
          f64.mul
          tee_local $var9
          f64.mul
          get_local $var8
          get_local $var8
          f64.mul
          tee_local $var7
          get_local $var7
          f64.mul
          get_local $var7
          get_local $var7
          get_local $var7
          get_local $var7
          get_local $var7
          f64.const 0.20697501780033842
          f64.mul
          f64.const 0.23066074577556175
          f64.add
          f64.mul
          f64.const 0.272728123808534
          f64.add
          f64.mul
          f64.const 0.33333332981837743
          f64.add
          f64.mul
          f64.const 0.4285714285785502
          f64.add
          f64.mul
          f64.const 0.5999999999999946
          f64.add
          f64.mul
          f64.add
          tee_local $var12
          f64.add
          i64.reinterpret/f64
          i64.const -4294967296
          i64.and
          f64.reinterpret/i64
          tee_local $var7
          f64.mul
          tee_local $var11
          get_local $var9
          get_local $var7
          f64.mul
          get_local $var8
          get_local $var12
          get_local $var7
          f64.const -3
          f64.add
          get_local $var14
          f64.sub
          f64.sub
          f64.mul
          f64.add
          tee_local $var8
          f64.add
          i64.reinterpret/f64
          i64.const -4294967296
          i64.and
          f64.reinterpret/i64
          tee_local $var7
          f64.const 0.9617967009544373
          f64.mul
          tee_local $var9
          get_local $var3
          i32.const 3
          i32.shl
          i32.const 1520
          i32.add
          f64.load
          get_local $var8
          get_local $var7
          get_local $var11
          f64.sub
          f64.sub
          f64.const 0.9617966939259756
          f64.mul
          get_local $var7
          f64.const 7.028461650952758e-9
          f64.mul
          f64.sub
          f64.add
          tee_local $var7
          f64.add
          f64.add
          f64.const 3
          f64.add
          i64.reinterpret/f64
          i64.const -4294967296
          i64.and
          f64.reinterpret/i64
          tee_local $var11
          set_local $var8
          get_local $var11
          f64.const 3
          f64.sub
          get_local $var13
          f64.sub
          get_local $var9
          f64.sub
        end
        set_local $var9
        get_local $var7
        get_local $var9
        f64.sub
        get_local $var0
        f64.mul
        get_local $var0
        get_local $var6
        i64.const -4294967296
        i64.and
        f64.reinterpret/i64
        tee_local $var7
        f64.sub
        get_local $var8
        f64.mul
        f64.add
        set_local $var0
        get_local $var8
        get_local $var7
        f64.mul
        tee_local $var7
        get_local $var0
        f64.add
        tee_local $var8
        i64.reinterpret/f64
        tee_local $var6
        i64.const 32
        i64.shr_u
        i32.wrap/i64
        set_local $var2
        get_local $var6
        i32.wrap/i64
        set_local $var1
        get_local $var2
        i32.const 1083179007
        i32.gt_s
        if
          get_local $var1
          get_local $var2
          i32.const -1083179008
          i32.add
          i32.or
          if
            get_local $var10
            f64.const 1e+300
            f64.mul
            f64.const 1e+300
            f64.mul
            return
          end
          get_local $var0
          f64.const 8.008566259537294e-17
          f64.add
          get_local $var8
          get_local $var7
          f64.sub
          f64.gt
          if
            get_local $var10
            f64.const 1e+300
            f64.mul
            f64.const 1e+300
            f64.mul
            return
          end
        else
          get_local $var2
          i32.const 2147482624
          i32.and
          i32.const 1083231231
          i32.gt_u
          if
            get_local $var1
            get_local $var2
            i32.const 1064252416
            i32.add
            i32.or
            if
              get_local $var10
              f64.const 1e-300
              f64.mul
              f64.const 1e-300
              f64.mul
              return
            end
            get_local $var0
            get_local $var8
            get_local $var7
            f64.sub
            f64.le
            if
              get_local $var10
              f64.const 1e-300
              f64.mul
              f64.const 1e-300
              f64.mul
              return
            end
          end
        end
        get_local $var2
        i32.const 2147483647
        i32.and
        tee_local $var1
        i32.const 1071644672
        i32.gt_u
        if (result i32)
          get_local $var7
          i32.const -1048576
          get_local $var2
          i32.const 1048576
          get_local $var1
          i32.const 20
          i32.shr_u
          i32.const -1022
          i32.add
          i32.shr_u
          i32.add
          tee_local $var1
          i32.const 20
          i32.shr_u
          i32.const 2047
          i32.and
          tee_local $var3
          i32.const -1023
          i32.add
          i32.shr_s
          get_local $var1
          i32.and
          i64.extend_u/i32
          i64.const 32
          i64.shl
          f64.reinterpret/i64
          f64.sub
          tee_local $var8
          set_local $var7
          get_local $var0
          get_local $var8
          f64.add
          i64.reinterpret/f64
          set_local $var6
          i32.const 0
          get_local $var1
          i32.const 1048575
          i32.and
          i32.const 1048576
          i32.or
          i32.const 1043
          get_local $var3
          i32.sub
          i32.shr_u
          tee_local $var1
          i32.sub
          get_local $var1
          get_local $var2
          i32.const 0
          i32.lt_s
          select
        else
          i32.const 0
        end
        set_local $var2
        get_local $var10
        f64.const 1
        get_local $var6
        i64.const -4294967296
        i64.and
        f64.reinterpret/i64
        tee_local $var8
        f64.const 0.6931471824645996
        f64.mul
        tee_local $var9
        get_local $var0
        get_local $var8
        get_local $var7
        f64.sub
        f64.sub
        f64.const 0.6931471805599453
        f64.mul
        get_local $var8
        f64.const 1.904654299957768e-9
        f64.mul
        f64.sub
        tee_local $var8
        f64.add
        tee_local $var7
        get_local $var7
        get_local $var7
        get_local $var7
        f64.mul
        tee_local $var0
        get_local $var0
        get_local $var0
        get_local $var0
        get_local $var0
        f64.const 4.1381367970572385e-8
        f64.mul
        f64.const -0.0000016533902205465252
        f64.add
        f64.mul
        f64.const 0.00006613756321437934
        f64.add
        f64.mul
        f64.const -0.0027777777777015593
        f64.add
        f64.mul
        f64.const 0.16666666666666602
        f64.add
        f64.mul
        f64.sub
        tee_local $var0
        f64.mul
        get_local $var0
        f64.const -2
        f64.add
        f64.div
        get_local $var8
        get_local $var7
        get_local $var9
        f64.sub
        f64.sub
        tee_local $var0
        get_local $var7
        get_local $var0
        f64.mul
        f64.add
        f64.sub
        get_local $var7
        f64.sub
        f64.sub
        tee_local $var7
        i64.reinterpret/f64
        tee_local $var6
        i64.const 32
        i64.shr_u
        i32.wrap/i64
        get_local $var2
        i32.const 20
        i32.shl
        i32.add
        tee_local $var1
        i32.const 1048576
        i32.lt_s
        if (result f64)
          get_local $var7
          get_local $var2
          call $func39
        else
          get_local $var6
          i64.const 4294967295
          i64.and
          get_local $var1
          i64.extend_u/i32
          i64.const 32
          i64.shl
          i64.or
          f64.reinterpret/i64
        end
        f64.mul
        return
      end
    end
    f64.const 10
    get_local $var0
    f64.add
  )

Not sure what this does:
  (func $func39 (param $var0 f64) (param $var1 i32) (result f64)
    (local $var2 i32) (local $var3 i32)
    get_local $var1
    i32.const 1023
    i32.gt_s
    if
      get_local $var0
      f64.const 8.98846567431158e+307
      f64.mul
      tee_local $var0
      f64.const 8.98846567431158e+307
      f64.mul
      get_local $var0
      get_local $var1
      i32.const 2046
      i32.gt_s
      tee_local $var2
      select
      set_local $var0
      get_local $var1
      i32.const -2046
      i32.add
      tee_local $var3
      i32.const 1023
      get_local $var3
      i32.const 1023
      i32.lt_s
      select
      get_local $var1
      i32.const -1023
      i32.add
      get_local $var2
      select
      set_local $var1
    else
      get_local $var1
      i32.const -1022
      i32.lt_s
      if
        get_local $var0
        f64.const 2.2250738585072014e-308
        f64.mul
        tee_local $var0
        f64.const 2.2250738585072014e-308
        f64.mul
        get_local $var0
        get_local $var1
        i32.const -2044
        i32.lt_s
        tee_local $var2
        select
        set_local $var0
        get_local $var1
        i32.const 2044
        i32.add
        tee_local $var3
        i32.const -1022
        get_local $var3
        i32.const -1022
        i32.gt_s
        select
        get_local $var1
        i32.const 1022
        i32.add
        get_local $var2
        select
        set_local $var1
      end
    end
    get_local $var0
    get_local $var1
    i32.const 1023
    i32.add
    i64.extend_u/i32
    i64.const 52
    i64.shl
    f64.reinterpret/i64
    f64.mul
  )

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20190528/b1fa18b0/attachment-0001.html>


More information about the webkit-unassigned mailing list