-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[ARM]Adjust cost of muls in (U/S)MLAL and patterns #122713
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bb3c2fc
[ARM][SLP] Fix incorrect cost function for SLP Vectorization of ZExt/…
nasherm 1921822
Adjust extended reduction cost
nasherm a602844
[ARM]Reduce scalar cost of SMLAL muls
nasherm 6a38c9a
Responding to review comments
nasherm 55f3c72
Further review comments
nasherm df802a3
Minor comments
nasherm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
80 changes: 80 additions & 0 deletions
80
llvm/test/Analysis/CostModel/ARM/muls-in-smlal-patterns.ll
This file contains hidden or 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,80 @@ | ||
| ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 5 | ||
| ; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple thumbv8.1-m.main -mattr=+dsp < %s | FileCheck %s | ||
| ; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple thumbv8.1-m.main < %s | FileCheck %s --check-prefix=CHECK-NO-DSP | ||
| define i64 @test(i16 %a, i16 %b) { | ||
nasherm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ; CHECK-LABEL: 'test' | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %as = sext i16 %a to i32 | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bs = sext i16 %b to i32 | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %m = mul i32 %as, %bs | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ms = sext i32 %m to i64 | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %ms | ||
| ; | ||
| ; CHECK-NO-DSP-LABEL: 'test' | ||
| ; CHECK-NO-DSP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %as = sext i16 %a to i32 | ||
| ; CHECK-NO-DSP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bs = sext i16 %b to i32 | ||
| ; CHECK-NO-DSP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %m = mul i32 %as, %bs | ||
| ; CHECK-NO-DSP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ms = sext i32 %m to i64 | ||
| ; CHECK-NO-DSP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %ms | ||
| ; | ||
| %as = sext i16 %a to i32 | ||
| %bs = sext i16 %b to i32 | ||
nasherm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| %m = mul i32 %as, %bs | ||
| %ms = sext i32 %m to i64 | ||
| ret i64 %ms | ||
| } | ||
|
|
||
| define i64 @withadd(i16 %a, i16 %b, i64 %c) { | ||
| ; CHECK-LABEL: 'withadd' | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %as = sext i16 %a to i32 | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bs = sext i16 %b to i32 | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %m = mul i32 %as, %bs | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ms = sext i32 %m to i64 | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = add i64 %c, %ms | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r | ||
| ; | ||
| ; CHECK-NO-DSP-LABEL: 'withadd' | ||
| ; CHECK-NO-DSP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %as = sext i16 %a to i32 | ||
| ; CHECK-NO-DSP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %bs = sext i16 %b to i32 | ||
| ; CHECK-NO-DSP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %m = mul i32 %as, %bs | ||
| ; CHECK-NO-DSP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ms = sext i32 %m to i64 | ||
| ; CHECK-NO-DSP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = add i64 %c, %ms | ||
| ; CHECK-NO-DSP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r | ||
| ; | ||
| %as = sext i16 %a to i32 | ||
| %bs = sext i16 %b to i32 | ||
| %m = mul i32 %as, %bs | ||
| %ms = sext i32 %m to i64 | ||
| %r = add i64 %c, %ms | ||
| ret i64 %r | ||
| } | ||
|
|
||
| define i64 @withloads(ptr %pa, ptr %pb, i64 %c) { | ||
| ; CHECK-LABEL: 'withloads' | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a = load i16, ptr %pa, align 2 | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %b = load i16, ptr %pb, align 2 | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %as = sext i16 %a to i32 | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %bs = sext i16 %b to i32 | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %m = mul i32 %as, %bs | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ms = sext i32 %m to i64 | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = add i64 %c, %ms | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r | ||
| ; | ||
| ; CHECK-NO-DSP-LABEL: 'withloads' | ||
| ; CHECK-NO-DSP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %a = load i16, ptr %pa, align 2 | ||
| ; CHECK-NO-DSP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %b = load i16, ptr %pb, align 2 | ||
| ; CHECK-NO-DSP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %as = sext i16 %a to i32 | ||
| ; CHECK-NO-DSP-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %bs = sext i16 %b to i32 | ||
| ; CHECK-NO-DSP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %m = mul i32 %as, %bs | ||
| ; CHECK-NO-DSP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %ms = sext i32 %m to i64 | ||
| ; CHECK-NO-DSP-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r = add i64 %c, %ms | ||
| ; CHECK-NO-DSP-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret i64 %r | ||
| ; | ||
| %a = load i16, ptr %pa | ||
| %b = load i16, ptr %pb | ||
| %as = sext i16 %a to i32 | ||
| %bs = sext i16 %b to i32 | ||
| %m = mul i32 %as, %bs | ||
| %ms = sext i32 %m to i64 | ||
| %r = add i64 %c, %ms | ||
| ret i64 %r | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.