WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
228675
Add new patterns to instruction selector to utilize AND/EOR/ORR-with-shift supported by ARM64
https://bugs.webkit.org/show_bug.cgi?id=228675
Summary
Add new patterns to instruction selector to utilize AND/EOR/ORR-with-shift su...
Yijia Huang
Reported
2021-07-30 20:59:22 PDT
...
Attachments
Patch
(80.62 KB, patch)
2021-07-30 21:01 PDT
,
Yijia Huang
no flags
Details
Formatted Diff
Diff
Patch
(83.88 KB, patch)
2021-07-31 07:53 PDT
,
Yijia Huang
no flags
Details
Formatted Diff
Diff
Patch
(87.49 KB, patch)
2021-07-31 20:54 PDT
,
Yijia Huang
no flags
Details
Formatted Diff
Diff
Patch
(91.04 KB, patch)
2021-08-02 15:52 PDT
,
Yijia Huang
no flags
Details
Formatted Diff
Diff
Patch
(64.87 KB, patch)
2021-08-02 17:15 PDT
,
Yijia Huang
saam
: review+
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch for landing
(64.73 KB, patch)
2021-08-02 19:17 PDT
,
Yijia Huang
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch for landing
(64.72 KB, patch)
2021-08-02 19:21 PDT
,
Yijia Huang
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Yijia Huang
Comment 1
2021-07-30 21:01:57 PDT
Created
attachment 434688
[details]
Patch
Mark Lam
Comment 2
2021-07-30 21:24:44 PDT
Comment on
attachment 434688
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=434688&action=review
> Source/JavaScriptCore/ChangeLog:3 > + Add new patternes to instruction selector to utilize AND/EOR/ORR-with-shift and UMULL supported by ARM64
nit: typo: /patternes/patterns/. Can you fix the bugzilla title as well?
Yijia Huang
Comment 3
2021-07-31 07:53:08 PDT
Created
attachment 434698
[details]
Patch
Yijia Huang
Comment 4
2021-07-31 20:54:44 PDT
Created
attachment 434713
[details]
Patch
Saam Barati
Comment 5
2021-08-02 14:49:00 PDT
Comment on
attachment 434713
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=434713&action=review
New bitop+shift selection looks good. One suggestion there. But I'm confused by changes in call sites of isMergeableValue
> Source/JavaScriptCore/b3/B3LowerToAir.cpp:2675 > + if (isMergeableValue(multiplyLeft, SExt32) && isMergeableValue(multiplyRight, SExt32))
How is this behavior change sound? We're no longer checking canBeInternal, but we're still calling commitInternal.
> Source/JavaScriptCore/b3/B3LowerToAir.cpp:2678 > + if (isMergeableValue(multiplyLeft, ZExt32) && isMergeableValue(multiplyRight, ZExt32))
ditto
> Source/JavaScriptCore/b3/B3LowerToAir.cpp:2753 > + if (isMergeableValue(multiplyLeft, SExt32) && isMergeableValue(multiplyRight, SExt32))
ditto
> Source/JavaScriptCore/b3/B3LowerToAir.cpp:2876 > + commitInternal(left); > + commitInternal(right);
ditto regarding not checking canBeInternal.
> Source/JavaScriptCore/b3/B3LowerToAir.cpp:2998 > + // and-with-shift Pattern: n & (m ShiftType amount)
nit: I'd use the names the function uses in this comment: "and-with-shift Pattern: left & (right ShiftType amount)"
> Source/JavaScriptCore/b3/B3LowerToAir.cpp:3284 > + auto tryAppendXorWithShift = [&] (Value* left, Value* right) -> bool {
tryAppendXorWithShift and tryAppendAndWithShift and tryAppendOrWithShift are all identical minus the opcodes passed to the opcodeBasedOnShiftKind call. Can we abstract these 3 into a function shared by all? Maybe tryAppendBitOpWithShift or something? You can still keep all 3 lambdas, just so it's easier to call with (left, right) and (right, left), but the lambdas can call a shared helper.
Yijia Huang
Comment 6
2021-08-02 15:52:59 PDT
Created
attachment 434795
[details]
Patch
Yijia Huang
Comment 7
2021-08-02 17:15:27 PDT
Created
attachment 434806
[details]
Patch
Saam Barati
Comment 8
2021-08-02 18:55:22 PDT
Comment on
attachment 434806
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=434806&action=review
Nice. r=me
> Source/JavaScriptCore/b3/B3LowerToAir.cpp:2550 > + auto tryAppendBitOpWithShift = [&] (Value* left, Value* right, Air::Opcode opcode) -> bool { > + if (!isValidForm(opcode, Arg::Tmp, Arg::Tmp, Arg::Imm, Arg::Tmp)) > + return false; > + if (!canBeInternal(right) || !imm(right->child(1)) || right->child(1)->asInt() < 0) > + return false; > + > + uint64_t amount = right->child(1)->asInt(); > + uint64_t datasize = m_value->type() == Int32 ? 32 : 64; > + if (amount >= datasize) > + return false; > + > + append(opcode, tmp(left), tmp(right->child(0)), imm(right->child(1)), tmp(m_value)); > + commitInternal(right); > + return true; > + };
I think the way we normally do this is just by making it a member function.
Yijia Huang
Comment 9
2021-08-02 19:17:56 PDT
Created
attachment 434809
[details]
Patch for landing
Yijia Huang
Comment 10
2021-08-02 19:21:24 PDT
Created
attachment 434810
[details]
Patch for landing
EWS
Comment 11
2021-08-02 20:11:45 PDT
Committed
r280579
(
240201@main
): <
https://commits.webkit.org/240201@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 434810
[details]
.
Radar WebKit Bug Importer
Comment 12
2021-08-02 20:17:20 PDT
<
rdar://problem/81441719
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug