Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify floating points comparison for Object.is #2476

Merged
merged 1 commit into from
Aug 28, 2022

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
Page not found · GitHub · GitHub
Skip to content
404 “This is not the web page you are looking for”
@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.

None yet

1 participant