Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tablegen][globalisel] Add support for nested instruction matching.
Summary: Lift the restrictions that prevented the tree walking introduced in the previous change and add support for patterns like: (G_ADD (G_MUL (G_SEXT $src1), (G_SEXT $src2)), $src3) -> SMADDWrrr $dst, $src1, $src2, $src3 Also adds support for G_SEXT and G_ZEXT to support these cases. One particular aspect of this that I should draw attention to is that I've tried to be overly conservative in determining the safety of matches that involve non-adjacent instructions and multiple basic blocks. This is intended to be used as a cheap initial check and we may add a more expensive check in the future. The current rules are: * Reject if any instruction may load/store (we'd need to check for intervening memory operations. * Reject if any instruction has implicit operands. * Reject if any instruction has unmodelled side-effects. See isObviouslySafeToFold(). Reviewers: t.p.northover, javed.absar, qcolombet, aditya_nandakumar, ab, rovka Reviewed By: ab Subscribers: igorb, dberris, llvm-commits, kristof.beyls Differential Revision: https://reviews.llvm.org/D30539 llvm-svn: 299430
- Loading branch information
1 parent
bcbfdad
commit bee5739
Showing
8 changed files
with
408 additions
and
77 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
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,50 @@ | ||
# RUN: llc -O0 -mtriple=aarch64-- -run-pass=instruction-select -verify-machineinstrs -global-isel %s -o - | FileCheck %s | ||
|
||
--- | | ||
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" | ||
|
||
define void @SMADDLrrr_gpr() { ret void } | ||
... | ||
|
||
--- | ||
# CHECK-LABEL: name: SMADDLrrr_gpr | ||
name: SMADDLrrr_gpr | ||
legalized: true | ||
regBankSelected: true | ||
|
||
# CHECK: registers: | ||
# CHECK-NEXT: - { id: 0, class: gpr64 } | ||
# CHECK-NEXT: - { id: 1, class: gpr32 } | ||
# CHECK-NEXT: - { id: 2, class: gpr32 } | ||
# CHECK-NEXT: - { id: 3, class: gpr } | ||
# CHECK-NEXT: - { id: 4, class: gpr } | ||
# CHECK-NEXT: - { id: 5, class: gpr } | ||
# CHECK-NEXT: - { id: 6, class: gpr64 } | ||
registers: | ||
- { id: 0, class: gpr } | ||
- { id: 1, class: gpr } | ||
- { id: 2, class: gpr } | ||
- { id: 3, class: gpr } | ||
- { id: 4, class: gpr } | ||
- { id: 5, class: gpr } | ||
- { id: 6, class: gpr } | ||
|
||
# CHECK: body: | ||
# CHECK: %0 = COPY %x0 | ||
# CHECK: %1 = COPY %w1 | ||
# CHECK: %2 = COPY %w2 | ||
# CHECK: %6 = SMADDLrrr %1, %2, %0 | ||
body: | | ||
bb.0: | ||
liveins: %x0, %w1, %w2 | ||
%0(s64) = COPY %x0 | ||
%1(s32) = COPY %w1 | ||
%2(s32) = COPY %w2 | ||
%3(s64) = G_SEXT %1 | ||
%4(s64) = G_SEXT %2 | ||
%5(s64) = G_MUL %3, %4 | ||
%6(s64) = G_ADD %0, %5 | ||
%x0 = COPY %6 | ||
... | ||
|
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
Oops, something went wrong.