Bug 151974 - [JSC] Add Float support to B3
Summary: [JSC] Add Float support to B3
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Benjamin Poulain
URL:
Keywords:
: 151903 151921 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-12-07 17:12 PST by Benjamin Poulain
Modified: 2015-12-08 10:25 PST (History)
2 users (show)

See Also:


Attachments
Patch (190.91 KB, patch)
2015-12-07 17:15 PST, Benjamin Poulain
no flags Details | Formatted Diff | Diff
Patch (190.89 KB, patch)
2015-12-07 17:31 PST, Benjamin Poulain
no flags Details | Formatted Diff | Diff
Patch (190.92 KB, patch)
2015-12-07 17:41 PST, Benjamin Poulain
fpizlo: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Poulain 2015-12-07 17:12:40 PST
[JSC] Add Float support to B3
Comment 1 Benjamin Poulain 2015-12-07 17:15:52 PST
Created attachment 266835 [details]
Patch
Comment 2 Benjamin Poulain 2015-12-07 17:16:32 PST
*** Bug 151921 has been marked as a duplicate of this bug. ***
Comment 3 Benjamin Poulain 2015-12-07 17:16:47 PST
*** Bug 151903 has been marked as a duplicate of this bug. ***
Comment 4 WebKit Commit Bot 2015-12-07 17:17:15 PST
Attachment 266835 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/b3/testb3.cpp:5937:  l is incorrectly named. Don't use the single letter 'l' as an identifier name.  [readability/naming] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6340:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6341:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6342:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6343:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6344:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6345:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6377:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6378:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6379:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6380:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6381:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6382:  More than one command on the same line  [whitespace/newline] [4]
Total errors found: 13 in 38 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Benjamin Poulain 2015-12-07 17:31:04 PST
Created attachment 266836 [details]
Patch
Comment 6 WebKit Commit Bot 2015-12-07 17:31:57 PST
Attachment 266836 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/b3/testb3.cpp:5937:  l is incorrectly named. Don't use the single letter 'l' as an identifier name.  [readability/naming] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6340:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6341:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6342:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6343:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6344:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6345:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6377:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6378:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6379:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6380:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6381:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6382:  More than one command on the same line  [whitespace/newline] [4]
Total errors found: 13 in 38 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 7 Benjamin Poulain 2015-12-07 17:41:37 PST
Created attachment 266837 [details]
Patch
Comment 8 WebKit Commit Bot 2015-12-07 17:42:48 PST
Attachment 266837 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/b3/testb3.cpp:5937:  l is incorrectly named. Don't use the single letter 'l' as an identifier name.  [readability/naming] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6340:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6341:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6342:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6343:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6344:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6345:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6377:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6378:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6379:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6380:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6381:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:6382:  More than one command on the same line  [whitespace/newline] [4]
Total errors found: 13 in 38 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 Filip Pizlo 2015-12-07 18:08:24 PST
Comment on attachment 266837 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=266837&action=review

I think you're just missing moveFloatConditionally, which corresponds to Float = Select(Int, Float, Float).  But I guess that depends on whether or not you believe that movsd can efficiently be used instead of movss.

> Source/JavaScriptCore/ChangeLog:8
> +        This patch adds basic float support to B3.

Basic or comprehensive?

> Source/JavaScriptCore/assembler/MacroAssembler.h:1365
> +
> +    void moveDoubleConditionallyFloat(DoubleCondition cond, FPRegisterID left, FPRegisterID right, FPRegisterID src, FPRegisterID dest)
> +    {
> +        Jump falseCase = branchFloat(invert(cond), left, right);
> +        moveDouble(src, dest);
> +        falseCase.link(this);
> +    }

What about moveFloatConditionally?

> Source/JavaScriptCore/b3/B3Generate.cpp:78
> +        reduceDoubleToFloat(procedure);
> +

Any particular reason why this isn't run after reduceStrength()?

Actually, why isn't this just part of reduceStrength()?

> Source/JavaScriptCore/b3/B3LowerToAir.cpp:783
> +        case Float:

This doesn't seem right.  Is it really optimal to use movsd when we just need movss?
Comment 10 Filip Pizlo 2015-12-07 18:13:42 PST
Comment on attachment 266837 [details]
Patch

We talked about the moveFloat/moveFloatConditionally issue offline.
Comment 11 Filip Pizlo 2015-12-07 18:22:59 PST
Comment on attachment 266837 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=266837&action=review

> Source/JavaScriptCore/b3/B3ReduceDoubleToFloat.cpp:85
> +    HashSet<Value*> candidates;

Why not IndexSet<Value> candidates?
Comment 12 Benjamin Poulain 2015-12-07 18:56:33 PST
Committed r193683: <http://trac.webkit.org/changeset/193683>
Comment 13 Geoffrey Garen 2015-12-08 10:25:16 PST
Comment on attachment 266837 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=266837&action=review

> Source/JavaScriptCore/b3/B3ReduceDoubleToFloat.cpp:72
> +// Such operation arise in JS because there are is no Float type

are is

> Source/JavaScriptCore/b3/B3ReduceDoubleToFloat.cpp:76
> +// Using float in place remove the useless conversion, and the float

removes

> Source/JavaScriptCore/b3/B3ReduceDoubleToFloat.cpp:77
> +// ops is sometime massively cheaper (SQRT for example).

op