-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MERGE #5686 @nhat-nguyen] Float type specialization for comparison i…
…nstructions Merge pull request #5686 from nhat-nguyen:floats Perform type specialization and update destination value to boolean for comparison instructions when either source is float
- Loading branch information
Showing
4 changed files
with
125 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
//------------------------------------------------------------------------------------------------------- | ||
// Copyright (C) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. | ||
//------------------------------------------------------------------------------------------------------- | ||
|
||
WScript.LoadScriptFile("..\\UnitTestFramework\\UnitTestFramework.js"); | ||
|
||
// This tests the fast path for cmxx where either src is type specialized to float | ||
var tests = [ | ||
{ | ||
name: "NaN equality test", | ||
body: function() { | ||
assert.isTrue(NaN !== NaN); | ||
assert.isTrue(NaN !== 0.5); | ||
assert.isTrue(0.5 !== NaN); | ||
|
||
assert.isTrue(NaN != NaN); | ||
assert.isTrue(NaN != 0.5); | ||
assert.isTrue(0.5 != NaN); | ||
|
||
assert.isFalse(NaN === NaN); | ||
assert.isFalse(NaN === 0.5); | ||
assert.isFalse(0.5 === NaN); | ||
|
||
assert.isFalse(NaN == NaN); | ||
assert.isFalse(NaN == 0.5); | ||
assert.isFalse(0.5 == NaN); | ||
|
||
assert.isFalse(NaN > 0.5); | ||
assert.isFalse(NaN >= 0.5); | ||
assert.isFalse(NaN < 0.5); | ||
assert.isFalse(NaN <= 0.5); | ||
} | ||
}, | ||
{ | ||
name: "Type coercion test", | ||
body: function() { | ||
assert.isTrue('0.5' == 0.5); | ||
assert.isFalse('0.5' === 0.5); | ||
assert.isFalse('NaN' == NaN); | ||
assert.isTrue('NaN' != NaN); | ||
} | ||
}, | ||
{ | ||
name: "int vs. float", | ||
body: function() { | ||
assert.isFalse(5 == 0.5); | ||
assert.isTrue(5 != 0.5); | ||
assert.isFalse(5 === 0.5); | ||
assert.isTrue(5 !== 0.5); | ||
} | ||
}, | ||
{ | ||
name: "object vs. float", | ||
body: function() { | ||
assert.isFalse({} == 0.5); | ||
assert.isFalse({} === 0.5); | ||
assert.isTrue({} != 0.5); | ||
assert.isTrue({} !== 0.5); | ||
|
||
assert.isFalse({} > 0.5); | ||
assert.isFalse({} >= 0.5); | ||
assert.isFalse({} < 0.5); | ||
assert.isFalse({} <= 0.5); | ||
} | ||
} | ||
]; | ||
|
||
testRunner.runTests(tests, { verbose: WScript.Arguments[0] != "summary" }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters