-
Notifications
You must be signed in to change notification settings - Fork 12.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GlobalISel] Add a constant folding combine.
Use it AArch64 post-legal combiner. These don't always get folded because when the instructions are created the constants are obscured by artifacts. Differential Revision: https://reviews.llvm.org/D106776
- Loading branch information
Showing
13 changed files
with
2,651 additions
and
2,786 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
129 changes: 129 additions & 0 deletions
129
llvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-combiner-constant-fold.mir
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,129 @@ | ||
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py | ||
# RUN: llc -mtriple aarch64 -run-pass=aarch64-postlegalizer-combiner -verify-machineinstrs %s -o - | FileCheck %s | ||
|
||
--- | ||
name: add | ||
alignment: 4 | ||
legalized: true | ||
liveins: | ||
- { reg: '$w0' } | ||
body: | | ||
bb.1.entry: | ||
liveins: $x0 | ||
; CHECK-LABEL: name: add | ||
; CHECK: %res:_(s64) = G_CONSTANT i64 42 | ||
; CHECK: $x0 = COPY %res(s64) | ||
; CHECK: RET_ReallyLR implicit $x0 | ||
%a:_(s64) = G_CONSTANT i64 40 | ||
%b:_(s64) = G_CONSTANT i64 2 | ||
%res:_(s64) = G_ADD %a, %b | ||
$x0 = COPY %res(s64) | ||
RET_ReallyLR implicit $x0 | ||
... | ||
--- | ||
name: sub | ||
alignment: 4 | ||
legalized: true | ||
liveins: | ||
- { reg: '$w0' } | ||
body: | | ||
bb.1.entry: | ||
liveins: $x0 | ||
; CHECK-LABEL: name: sub | ||
; CHECK: %res:_(s64) = G_CONSTANT i64 38 | ||
; CHECK: $x0 = COPY %res(s64) | ||
; CHECK: RET_ReallyLR implicit $x0 | ||
%a:_(s64) = G_CONSTANT i64 40 | ||
%b:_(s64) = G_CONSTANT i64 2 | ||
%res:_(s64) = G_SUB %a, %b | ||
$x0 = COPY %res(s64) | ||
RET_ReallyLR implicit $x0 | ||
... | ||
--- | ||
name: mul | ||
alignment: 4 | ||
legalized: true | ||
liveins: | ||
- { reg: '$w0' } | ||
body: | | ||
bb.1.entry: | ||
liveins: $x0 | ||
; CHECK-LABEL: name: mul | ||
; CHECK: %res:_(s64) = G_CONSTANT i64 80 | ||
; CHECK: $x0 = COPY %res(s64) | ||
; CHECK: RET_ReallyLR implicit $x0 | ||
%a:_(s64) = G_CONSTANT i64 40 | ||
%b:_(s64) = G_CONSTANT i64 2 | ||
%res:_(s64) = G_MUL %a, %b | ||
$x0 = COPY %res(s64) | ||
RET_ReallyLR implicit $x0 | ||
... | ||
--- | ||
name: and | ||
alignment: 4 | ||
legalized: true | ||
liveins: | ||
- { reg: '$w0' } | ||
body: | | ||
bb.1.entry: | ||
liveins: $x0 | ||
; CHECK-LABEL: name: and | ||
; CHECK: %res:_(s64) = G_CONSTANT i64 0 | ||
; CHECK: $x0 = COPY %res(s64) | ||
; CHECK: RET_ReallyLR implicit $x0 | ||
%a:_(s64) = G_CONSTANT i64 40 | ||
%b:_(s64) = G_CONSTANT i64 2 | ||
%res:_(s64) = G_AND %a, %b | ||
$x0 = COPY %res(s64) | ||
RET_ReallyLR implicit $x0 | ||
... | ||
--- | ||
name: or | ||
alignment: 4 | ||
legalized: true | ||
liveins: | ||
- { reg: '$w0' } | ||
body: | | ||
bb.1.entry: | ||
liveins: $x0 | ||
; CHECK-LABEL: name: or | ||
; CHECK: %res:_(s64) = G_CONSTANT i64 62 | ||
; CHECK: $x0 = COPY %res(s64) | ||
; CHECK: RET_ReallyLR implicit $x0 | ||
%a:_(s64) = G_CONSTANT i64 42 | ||
%b:_(s64) = G_CONSTANT i64 22 | ||
%res:_(s64) = G_OR %a, %b | ||
$x0 = COPY %res(s64) | ||
RET_ReallyLR implicit $x0 | ||
... | ||
--- | ||
name: xor | ||
alignment: 4 | ||
legalized: true | ||
liveins: | ||
- { reg: '$w0' } | ||
body: | | ||
bb.1.entry: | ||
liveins: $x0 | ||
; CHECK-LABEL: name: xor | ||
; CHECK: %res:_(s64) = G_CONSTANT i64 12 | ||
; CHECK: $x0 = COPY %res(s64) | ||
; CHECK: RET_ReallyLR implicit $x0 | ||
%a:_(s64) = G_CONSTANT i64 8 | ||
%b:_(s64) = G_CONSTANT i64 4 | ||
%res:_(s64) = G_XOR %a, %b | ||
$x0 = COPY %res(s64) | ||
RET_ReallyLR implicit $x0 | ||
... |
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.