forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AMDGPU] Turn s_and_saveexec_b64 into s_and_b64 if result is unused
With SI_END_CF elimination for some nested control flow we can now eliminate saved exec register completely by turning a saveexec version of instruction into just a logical instruction. Differential Revision: https://reviews.llvm.org/D36007 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309766 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
Showing
4 changed files
with
213 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 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 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 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,147 @@ | ||
# RUN: llc -march=amdgcn -verify-machineinstrs -run-pass si-optimize-exec-masking %s -o - | FileCheck -check-prefix=GCN %s | ||
|
||
--- | ||
# GCN-LABEL: name: reduce_and_saveexec | ||
# GCN: %exec = S_AND_B64 %exec, killed %vcc | ||
# GCN-NEXT: S_ENDPGM | ||
name: reduce_and_saveexec | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
%vcc = IMPLICIT_DEF | ||
%sgpr0_sgpr1 = S_AND_B64 %exec, killed %vcc, implicit-def %scc | ||
%exec = COPY killed %sgpr0_sgpr1 | ||
S_ENDPGM | ||
... | ||
--- | ||
# GCN-LABEL: name: reduce_and_saveexec_commuted | ||
# GCN: %exec = S_AND_B64 killed %vcc, %exec | ||
# GCN-NEXT: S_ENDPGM | ||
name: reduce_and_saveexec_commuted | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
%vcc = IMPLICIT_DEF | ||
%sgpr0_sgpr1 = S_AND_B64 killed %vcc, %exec, implicit-def %scc | ||
%exec = COPY killed %sgpr0_sgpr1 | ||
S_ENDPGM | ||
... | ||
--- | ||
# GCN-LABEL: name: reduce_and_saveexec_liveout | ||
# GCN: %sgpr0_sgpr1 = S_AND_B64 %exec, killed %vcc | ||
# GCN-NEXT: %exec = COPY | ||
name: reduce_and_saveexec_liveout | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
%vcc = IMPLICIT_DEF | ||
%sgpr0_sgpr1 = S_AND_B64 %exec, killed %vcc, implicit-def %scc | ||
%exec = COPY %sgpr0_sgpr1 | ||
S_ENDPGM | ||
... | ||
--- | ||
# GCN-LABEL: name: and_saveexec | ||
# GCN: %sgpr0_sgpr1 = S_AND_SAVEEXEC_B64 %vcc | ||
# GCN-NEXT: S_ENDPGM | ||
name: and_saveexec | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
%vcc = IMPLICIT_DEF | ||
%sgpr0_sgpr1 = COPY %exec | ||
%sgpr2_sgpr3 = S_AND_B64 %sgpr0_sgpr1, killed %vcc, implicit-def %scc | ||
%exec = S_MOV_B64_term %sgpr2_sgpr3 | ||
S_ENDPGM | ||
... | ||
--- | ||
# GCN-LABEL: name: reduce_or_saveexec | ||
# GCN: %exec = S_OR_B64 %exec, killed %vcc | ||
# GCN-NEXT: S_ENDPGM | ||
name: reduce_or_saveexec | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
%vcc = IMPLICIT_DEF | ||
%sgpr0_sgpr1 = S_OR_B64 %exec, killed %vcc, implicit-def %scc | ||
%exec = COPY killed %sgpr0_sgpr1 | ||
S_ENDPGM | ||
... | ||
--- | ||
# GCN-LABEL: name: reduce_xor_saveexec | ||
# GCN: %exec = S_XOR_B64 %exec, killed %vcc | ||
# GCN-NEXT: S_ENDPGM | ||
name: reduce_xor_saveexec | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
%vcc = IMPLICIT_DEF | ||
%sgpr0_sgpr1 = S_XOR_B64 %exec, killed %vcc, implicit-def %scc | ||
%exec = COPY killed %sgpr0_sgpr1 | ||
S_ENDPGM | ||
... | ||
--- | ||
# GCN-LABEL: name: reduce_andn2_saveexec | ||
# GCN: %exec = S_ANDN2_B64 %exec, killed %vcc | ||
# GCN-NEXT: S_ENDPGM | ||
name: reduce_andn2_saveexec | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
%vcc = IMPLICIT_DEF | ||
%sgpr0_sgpr1 = S_ANDN2_B64 %exec, killed %vcc, implicit-def %scc | ||
%exec = COPY killed %sgpr0_sgpr1 | ||
S_ENDPGM | ||
... | ||
--- | ||
# GCN-LABEL: name: reduce_orn2_saveexec | ||
# GCN: %exec = S_ORN2_B64 %exec, killed %vcc | ||
# GCN-NEXT: S_ENDPGM | ||
name: reduce_orn2_saveexec | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
%vcc = IMPLICIT_DEF | ||
%sgpr0_sgpr1 = S_ORN2_B64 %exec, killed %vcc, implicit-def %scc | ||
%exec = COPY killed %sgpr0_sgpr1 | ||
S_ENDPGM | ||
... | ||
--- | ||
# GCN-LABEL: name: reduce_nand_saveexec | ||
# GCN: %exec = S_NAND_B64 %exec, killed %vcc | ||
# GCN-NEXT: S_ENDPGM | ||
name: reduce_nand_saveexec | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
%vcc = IMPLICIT_DEF | ||
%sgpr0_sgpr1 = S_NAND_B64 %exec, killed %vcc, implicit-def %scc | ||
%exec = COPY killed %sgpr0_sgpr1 | ||
S_ENDPGM | ||
... | ||
--- | ||
# GCN-LABEL: name: reduce_nor_saveexec | ||
# GCN: %exec = S_NOR_B64 %exec, killed %vcc | ||
# GCN-NEXT: S_ENDPGM | ||
name: reduce_nor_saveexec | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
%vcc = IMPLICIT_DEF | ||
%sgpr0_sgpr1 = S_NOR_B64 %exec, killed %vcc, implicit-def %scc | ||
%exec = COPY killed %sgpr0_sgpr1 | ||
S_ENDPGM | ||
... | ||
--- | ||
# GCN-LABEL: name: reduce_xnor_saveexec | ||
# GCN: %exec = S_XNOR_B64 %exec, killed %vcc | ||
# GCN-NEXT: S_ENDPGM | ||
name: reduce_xnor_saveexec | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
%vcc = IMPLICIT_DEF | ||
%sgpr0_sgpr1 = S_XNOR_B64 %exec, killed %vcc, implicit-def %scc | ||
%exec = COPY killed %sgpr0_sgpr1 | ||
S_ENDPGM | ||
... | ||
--- |