-
Notifications
You must be signed in to change notification settings - Fork 17.3k
[LLVM][CodeGen][SVE] Lower bfloat ISD::VECREDUCE_SEQ_FADD operations. #199732
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
Open
paulwalker-arm
wants to merge
1
commit into
llvm:main
Choose a base branch
from
paulwalker-arm:sve-bfloat-reductions-ordered
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+92
−2
Open
Changes from all commits
Commits
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
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
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
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,49 @@ | ||
| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 | ||
| ; RUN: llc -mattr=+sve,+bf16 < %s | FileCheck %s | ||
|
|
||
| target triple = "aarch64-unknown-linux-gnu" | ||
|
|
||
| define bfloat @fadd_ordered_nxv2bf16(bfloat %a, <vscale x 2 x bfloat> %b) { | ||
| ; CHECK-LABEL: fadd_ordered_nxv2bf16: | ||
| ; CHECK: // %bb.0: | ||
| ; CHECK-NEXT: // kill: def $h0 killed $h0 def $d0 | ||
| ; CHECK-NEXT: lsl z1.s, z1.s, #16 | ||
| ; CHECK-NEXT: ptrue p0.d | ||
| ; CHECK-NEXT: shll v0.4s, v0.4h, #16 | ||
| ; CHECK-NEXT: fadda s0, p0, s0, z1.s | ||
| ; CHECK-NEXT: bfcvt h0, s0 | ||
| ; CHECK-NEXT: ret | ||
| %res = call bfloat @llvm.vector.reduce.fadd(bfloat %a, <vscale x 2 x bfloat> %b) | ||
| ret bfloat %res | ||
| } | ||
|
|
||
| define bfloat @fadd_ordered_nxv4bf16(bfloat %a, <vscale x 4 x bfloat> %b) { | ||
| ; CHECK-LABEL: fadd_ordered_nxv4bf16: | ||
| ; CHECK: // %bb.0: | ||
| ; CHECK-NEXT: // kill: def $h0 killed $h0 def $d0 | ||
| ; CHECK-NEXT: lsl z1.s, z1.s, #16 | ||
| ; CHECK-NEXT: ptrue p0.s | ||
| ; CHECK-NEXT: shll v0.4s, v0.4h, #16 | ||
| ; CHECK-NEXT: fadda s0, p0, s0, z1.s | ||
| ; CHECK-NEXT: bfcvt h0, s0 | ||
| ; CHECK-NEXT: ret | ||
| %res = call bfloat @llvm.vector.reduce.fadd(bfloat %a, <vscale x 4 x bfloat> %b) | ||
| ret bfloat %res | ||
| } | ||
|
|
||
| define bfloat @fadd_ordered_nxv8bf16(bfloat %a, <vscale x 8 x bfloat> %b) { | ||
| ; CHECK-LABEL: fadd_ordered_nxv8bf16: | ||
| ; CHECK: // %bb.0: | ||
| ; CHECK-NEXT: movi v2.2d, #0000000000000000 | ||
| ; CHECK-NEXT: // kill: def $h0 killed $h0 def $d0 | ||
| ; CHECK-NEXT: ptrue p0.s | ||
| ; CHECK-NEXT: shll v0.4s, v0.4h, #16 | ||
| ; CHECK-NEXT: zip1 z3.h, z2.h, z1.h | ||
| ; CHECK-NEXT: zip2 z1.h, z2.h, z1.h | ||
| ; CHECK-NEXT: fadda s0, p0, s0, z3.s | ||
| ; CHECK-NEXT: fadda s0, p0, s0, z1.s | ||
| ; CHECK-NEXT: bfcvt h0, s0 | ||
| ; CHECK-NEXT: ret | ||
| %res = call bfloat @llvm.vector.reduce.fadd(bfloat %a, <vscale x 8 x bfloat> %b) | ||
| ret bfloat %res | ||
| } |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe add a little comment here to describe the intent?
I was actually surprised it went the 'expand' route here, rather than SplitVector legalisation step. Do you know why that is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's because the promotion is happening during operation legalisation rather than type legalisation. Essentially LegalizeVectorOps sometimes creates illegal types but they are legalised during the same phase (in this instance by expanding the promoted operation) so the illegal types do not escape.