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.
[globalisel][tablegen] Add support for (set $dst, 1) and test X86's O…
…ptForSize predicate. Summary: It's rare but a small number of patterns use IntInit's at the root of the match. On X86, one such rule is enabled by the OptForSize predicate and causes the compiler to use the smaller: %0 = MOV32r1 instead of the usual: %0 = MOV32ri 1 This patch adds support for matching IntInit's at the root and uses this as a test case for the optsize attribute that was implemented in r301750 Reviewers: qcolombet, ab, t.p.northover, rovka, kristof.beyls, aditya_nandakumar Reviewed By: qcolombet Subscribers: igorb, llvm-commits Differential Revision: https://reviews.llvm.org/D32791 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303678 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
1 parent
87fb232
commit 50acddb
Showing
3 changed files
with
187 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# RUN: llc -mtriple=i586-linux-gnu -global-isel -run-pass=instruction-select %s -o - | FileCheck %s --check-prefix=CHECK | ||
# | ||
# This is necessary to test that attribute-based rule predicates work and that | ||
# they properly reset between functions. | ||
|
||
--- | | ||
define i32 @const_i32_1() { | ||
ret i32 1 | ||
} | ||
|
||
define i32 @const_i32_1_optsize() #0 { | ||
ret i32 1 | ||
} | ||
|
||
define i32 @const_i32_1b() { | ||
ret i32 1 | ||
} | ||
|
||
define i32 @const_i32_1_optsizeb() #0 { | ||
ret i32 1 | ||
} | ||
|
||
attributes #0 = { optsize } | ||
... | ||
--- | ||
name: const_i32_1 | ||
legalized: true | ||
regBankSelected: true | ||
selected: false | ||
# CHECK-LABEL: name: const_i32_1 | ||
# CHECK: registers: | ||
# CHECK-NEXT: - { id: 0, class: gr32 } | ||
registers: | ||
- { id: 0, class: gpr } | ||
# CHECK: body: | ||
# CHECK: %0 = MOV32ri 1 | ||
body: | | ||
bb.1 (%ir-block.0): | ||
%0(s32) = G_CONSTANT i32 1 | ||
%eax = COPY %0(s32) | ||
RET 0, implicit %eax | ||
... | ||
--- | ||
name: const_i32_1_optsize | ||
legalized: true | ||
regBankSelected: true | ||
selected: false | ||
# CHECK-LABEL: name: const_i32_1_optsize | ||
# CHECK: registers: | ||
# CHECK-NEXT: - { id: 0, class: gr32 } | ||
registers: | ||
- { id: 0, class: gpr } | ||
# CHECK: body: | ||
# CHECK: %0 = MOV32r1 | ||
body: | | ||
bb.1 (%ir-block.0): | ||
%0(s32) = G_CONSTANT i32 1 | ||
%eax = COPY %0(s32) | ||
RET 0, implicit %eax | ||
... | ||
--- | ||
name: const_i32_1b | ||
legalized: true | ||
regBankSelected: true | ||
selected: false | ||
# CHECK-LABEL: name: const_i32_1b | ||
# CHECK: registers: | ||
# CHECK-NEXT: - { id: 0, class: gr32 } | ||
registers: | ||
- { id: 0, class: gpr } | ||
# CHECK: body: | ||
# CHECK: %0 = MOV32ri 1 | ||
body: | | ||
bb.1 (%ir-block.0): | ||
%0(s32) = G_CONSTANT i32 1 | ||
%eax = COPY %0(s32) | ||
RET 0, implicit %eax | ||
... | ||
--- | ||
name: const_i32_1_optsizeb | ||
legalized: true | ||
regBankSelected: true | ||
selected: false | ||
# CHECK-LABEL: name: const_i32_1_optsizeb | ||
# CHECK: registers: | ||
# CHECK-NEXT: - { id: 0, class: gr32 } | ||
registers: | ||
- { id: 0, class: gpr } | ||
# CHECK: body: | ||
# CHECK: %0 = MOV32r1 | ||
body: | | ||
bb.1 (%ir-block.0): | ||
%0(s32) = G_CONSTANT i32 1 | ||
%eax = COPY %0(s32) | ||
RET 0, implicit %eax | ||
... |
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