Skip to content

Conversation

@MaxGraey
Copy link
Member

@MaxGraey MaxGraey commented Aug 27, 2022

This change significantly simplify Object.is<f64 | f32>.

Sample 1:

Object.is(x, -0.0);

OLD codegen:

  local.get $x
  i64.reinterpret_f64
  i64.const -9223372036854775808
  i64.eq
  local.get $x
  f64.const -0
  f64.eq
  i32.and
 )

NEW codegen:

 local.get $x
 i64.reinterpret_f64
 i64.const -9223372036854775808
 i64.eq

Sample 2:

Object.is(x, NaN);

OLD codegen:

  local.get $x
  i64.reinterpret_f64
  i64.const 9221120237041090560
  i64.eq
  local.get $x
  local.get $x
  f64.ne
  local.get $x
  f64.const nan:0x8000000000000
  f64.eq
  select

NEW codegen:

 local.get $x
 i64.reinterpret_f64
 i64.const 9221120237041090560
 i64.eq
 local.get $x
 local.get $x
 f64.ne
 i32.or
  • I've read the contributing guidelines
  • I've added my name and email to the NOTICE file

@MaxGraey MaxGraey requested a review from dcodeIO August 27, 2022 15:01
@MaxGraey MaxGraey changed the title Simplify a little floating points comparison for Object.is Simplify floating points comparison for Object.is Aug 27, 2022
@MaxGraey MaxGraey merged commit 525b2e1 into AssemblyScript:main Aug 28, 2022
@MaxGraey MaxGraey deleted the improve-object-is branch August 28, 2022 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant