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

[JIT] X64/ARM64 - CAST removals for small types on ADD, SUB, MUL, AND, OR, XOR, NOT, NEG #77874

Merged
merged 71 commits into from
Jan 31, 2023
Merged
Changes from 1 commit
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
f6bb7d4
Trying to optimize Add
TIHan Nov 4, 2022
81a1bcb
Trying to optimize Add
TIHan Nov 4, 2022
1b29b47
Trying to optimize Add
TIHan Nov 4, 2022
2599997
Merge remote-tracking branch 'upstream/main' into add-opt-x64
TIHan Nov 4, 2022
5e3741c
Added IntAdd disasm tests. Expanded cast removals to all arithmetic a…
TIHan Nov 5, 2022
371ca7d
Merge branch 'main' into add-opt-x64
TIHan Nov 5, 2022
2a43021
Checked unsigned
TIHan Nov 5, 2022
5428df9
Limit arithmetic opt
TIHan Nov 7, 2022
ac58639
Merge branch 'add-opt-x64' of https://github.com/TIHan/runtime into a…
TIHan Nov 7, 2022
7badcc0
Merge remote-tracking branch 'upstream/main' into add-opt-x64
TIHan Nov 8, 2022
6d85c1a
Moving optimization to Morph
TIHan Nov 8, 2022
02dbb22
Cleanup. Allow more opts.
TIHan Nov 8, 2022
779dd21
Fix build
TIHan Nov 8, 2022
a263faa
More opts
TIHan Nov 8, 2022
f7c8b68
Added regression test. Allowing all arithmetic ops. Only do transform…
TIHan Nov 9, 2022
3eba2fa
Do not do optimization for unsigned ops
TIHan Nov 9, 2022
ec3dcda
Added more division test cases
TIHan Nov 9, 2022
183d570
Fixed test. Checking overflows on cast. Comparing actual types proper…
TIHan Nov 9, 2022
4378c1b
Added flag
TIHan Nov 10, 2022
4a0b63d
Remove flag
TIHan Nov 10, 2022
73fbc61
Formatting
TIHan Nov 10, 2022
38ec57f
Revert minor change
TIHan Nov 10, 2022
343badf
Removed ClearRegOptionalAndContained
TIHan Nov 10, 2022
2e5c716
Merge remote-tracking branch 'upstream/main' into add-opt-x64
TIHan Nov 11, 2022
e417b63
Merge remote-tracking branch 'upstream/main' into add-opt-x64
TIHan Nov 13, 2022
95840b2
Trying out lowering
TIHan Nov 13, 2022
1c2e139
Expanded lowering cast removal to arm
TIHan Nov 13, 2022
49341e6
Added regression test
TIHan Nov 13, 2022
60f48ba
Do not use disasm checks for these tests
TIHan Nov 13, 2022
b267aa5
Update lower.cpp
TIHan Nov 13, 2022
caefb4a
Fixing
TIHan Nov 13, 2022
e226f30
For JCC, do not change castOp type if it is a bool
TIHan Nov 13, 2022
84ae5a7
Added more regression tests made from Fuzzlyn. Reverted minor cast ch…
TIHan Nov 13, 2022
937596b
Remove Morph impl as we are not favoring Lowering. Do not change var …
TIHan Nov 13, 2022
6cc95ca
Formatting
TIHan Nov 13, 2022
e5c9b93
Re-arranging regression tests. Some comments. Some And and Or disasm …
TIHan Nov 14, 2022
966df08
Fixed a few minor regressions
TIHan Nov 14, 2022
94411b5
minor change
TIHan Nov 14, 2022
4cb4d6d
Merge remote-tracking branch 'upstream/main' into add-opt-x64
TIHan Nov 14, 2022
3ec0f0d
Moving optimization to simple lowering
TIHan Nov 14, 2022
cb1983c
Moving back to morph
TIHan Nov 15, 2022
6f71cff
Add print for implicit cast
TIHan Nov 16, 2022
ca60055
Do it a little earlier
TIHan Nov 16, 2022
e445092
Mark as do-not-cse to prevent the CAST from being removed on assignment
TIHan Nov 16, 2022
4b9d344
Fix test
TIHan Nov 17, 2022
7022968
Remove do-not-set cse
TIHan Nov 17, 2022
ec5088f
Moving optimization to simple lowering again for correctness
TIHan Nov 18, 2022
62938ba
Disable some of the regression tests for mono
TIHan Nov 18, 2022
e90ce88
Fixing IntOr disasm test
TIHan Nov 18, 2022
769d1c1
Formatting, fixing test again
TIHan Nov 18, 2022
6903869
Smaller size operators can contain/reg-optional operands that are larger
TIHan Nov 18, 2022
de34d34
Formatting
TIHan Nov 18, 2022
f1ef6f3
Added subtract tests
TIHan Nov 28, 2022
38386d5
Update IntAnd.cs
TIHan Nov 29, 2022
f34f943
Update IntAnd.cs
TIHan Nov 29, 2022
232fe85
Update IntOr.cs
TIHan Nov 29, 2022
476143e
Update IntSubtract.cs
TIHan Nov 30, 2022
e0d49b3
Added IsContainableMemoryOpSize
TIHan Dec 2, 2022
21f3a8b
Merged
TIHan Dec 2, 2022
aad9ca3
Merge branch 'add-opt-x64' of https://github.com/TIHan/runtime into a…
TIHan Dec 2, 2022
37fc2fb
Merge remote-tracking branch 'upstream/main' into add-opt-x64
TIHan Jan 11, 2023
23427f6
Removed unnecessary code.
TIHan Jan 13, 2023
520be33
Update IntAnd.cs
TIHan Jan 13, 2023
7cac5e2
Update Regression1.cs
TIHan Jan 13, 2023
c6a31fe
Update Regression1.cs
TIHan Jan 13, 2023
2fbe829
Update Regression2.cs
TIHan Jan 13, 2023
3384759
Update Regression2.cs
TIHan Jan 14, 2023
2ea70d4
Merge remote-tracking branch 'upstream/main' into add-opt-x64
TIHan Jan 30, 2023
40b59c2
Disable if optimizations are disabled
TIHan Jan 30, 2023
051d513
Merge branch 'add-opt-x64' of https://github.com/TIHan/runtime into a…
TIHan Jan 30, 2023
25784fb
Merge
TIHan Jan 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
minor change
  • Loading branch information
TIHan committed Nov 14, 2022
commit 94411b5ba5dcd193b5b90f13f3a7109a13bd54b2
9 changes: 4 additions & 5 deletions src/coreclr/jit/lower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3013,14 +3013,13 @@ GenTree* Lowering::OptimizeConstCompare(GenTree* cmp)
GenTree* op2 = castOp->gtGetOp2();

#ifdef TARGET_XARCH
// If one of the ops is not already contained and one of the ops is a GT_LCL_VAR,
// then change its type to the castToType. We do this to take advantage of
// containment for a memory op.
if (op1->OperIs(GT_LCL_VAR) && !op2->isContained())
// If one of the ops is a GT_LCL_VAR, then change its type to the castToType.
// We do this to take advantage of containment for a memory op.
if (op1->OperIs(GT_LCL_VAR) && !op2->IsCnsIntOrI())
{
op1->ChangeType(castToType);
TIHan marked this conversation as resolved.
Show resolved Hide resolved
}
else if (op2->OperIs(GT_LCL_VAR) && !op1->isContained())
else if (op2->OperIs(GT_LCL_VAR))
{
op2->ChangeType(castToType);
}
Expand Down