-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[RISCV][GISEL] regbankselect and instruction-select for G_IMPLICIT_DEF #73060
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py | ||
# RUN: llc -mtriple=riscv32 -mattr=+f -run-pass=instruction-select -simplify-mir -verify-machineinstrs %s -o - \ | ||
# RUN: | FileCheck -check-prefix=RV32F %s | ||
|
||
--- | ||
name: implicit_def_gpr | ||
legalized: true | ||
regBankSelected: true | ||
body: | | ||
bb.0: | ||
; RV32F-LABEL: name: implicit_def_gpr | ||
; RV32F: [[DEF:%[0-9]+]]:gpr = IMPLICIT_DEF | ||
; RV32F-NEXT: [[ADD:%[0-9]+]]:gpr = ADD [[DEF]], [[DEF]] | ||
; RV32F-NEXT: $x10 = COPY [[ADD]] | ||
%0:gprb(s32) = G_IMPLICIT_DEF | ||
%1:gprb(s32) = G_ADD %0, %0 | ||
$x10 = COPY %1(s32) | ||
... | ||
--- | ||
name: implicit_def_copy_gpr | ||
legalized: true | ||
regBankSelected: true | ||
body: | | ||
bb.0: | ||
; RV32F-LABEL: name: implicit_def_copy_gpr | ||
; RV32F: [[DEF:%[0-9]+]]:gpr = IMPLICIT_DEF | ||
; RV32F-NEXT: $x10 = COPY [[DEF]] | ||
%0:gprb(s32) = G_IMPLICIT_DEF | ||
%1:gprb(s32) = COPY %0(s32) | ||
$x10 = COPY %1(s32) | ||
... | ||
|
||
--- | ||
name: implicit_def_fpr | ||
legalized: true | ||
regBankSelected: true | ||
body: | | ||
bb.0: | ||
; RV32F-LABEL: name: implicit_def_fpr | ||
; RV32F: [[DEF:%[0-9]+]]:fpr32 = IMPLICIT_DEF | ||
; RV32F-NEXT: [[FADD_S:%[0-9]+]]:fpr32 = nofpexcept FADD_S [[DEF]], [[DEF]], 7 | ||
; RV32F-NEXT: $f10_f = COPY [[FADD_S]] | ||
%0:fprb(s32) = G_IMPLICIT_DEF | ||
%1:fprb(s32) = G_FADD %0, %0 | ||
$f10_f = COPY %1(s32) | ||
... | ||
--- | ||
name: implicit_def_copy_fpr | ||
legalized: true | ||
regBankSelected: true | ||
body: | | ||
bb.0: | ||
; RV32F-LABEL: name: implicit_def_copy_fpr | ||
; RV32F: [[DEF:%[0-9]+]]:fpr32 = IMPLICIT_DEF | ||
; RV32F-NEXT: $f10_f = COPY [[DEF]] | ||
%0:fprb(s32) = G_IMPLICIT_DEF | ||
%1:fprb(s32) = COPY %0(s32) | ||
$f10_f = COPY %1(s32) | ||
... | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add a test with a user with a user that has constraints, such that the selection of the user will have already pre-constrained the register? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is that different than Are you asking to test something else? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, that's what I meant. I was looking at the copy chains below |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py | ||
# RUN: llc -mtriple=riscv64 -mattr=+d -run-pass=instruction-select -simplify-mir -verify-machineinstrs %s -o - \ | ||
# RUN: | FileCheck -check-prefix=RV64D %s | ||
|
||
--- | ||
name: implicit_def_gpr | ||
legalized: true | ||
regBankSelected: true | ||
body: | | ||
bb.0: | ||
; RV64D-LABEL: name: implicit_def_gpr | ||
; RV64D: [[DEF:%[0-9]+]]:gpr = IMPLICIT_DEF | ||
; RV64D-NEXT: [[ADD:%[0-9]+]]:gpr = ADD [[DEF]], [[DEF]] | ||
; RV64D-NEXT: $x10 = COPY [[ADD]] | ||
%0:gprb(s64) = G_IMPLICIT_DEF | ||
%1:gprb(s64) = G_ADD %0, %0 | ||
$x10 = COPY %1(s64) | ||
... | ||
--- | ||
name: implicit_def_copy_gpr | ||
legalized: true | ||
regBankSelected: true | ||
body: | | ||
bb.0: | ||
; RV64D-LABEL: name: implicit_def_copy_gpr | ||
; RV64D: [[DEF:%[0-9]+]]:gpr = IMPLICIT_DEF | ||
; RV64D-NEXT: $x10 = COPY [[DEF]] | ||
%0:gprb(s64) = G_IMPLICIT_DEF | ||
%1:gprb(s64) = COPY %0(s64) | ||
$x10 = COPY %1(s64) | ||
... | ||
|
||
--- | ||
name: implicit_def_fpr | ||
legalized: true | ||
regBankSelected: true | ||
body: | | ||
bb.0: | ||
; RV64D-LABEL: name: implicit_def_fpr | ||
; RV64D: [[DEF:%[0-9]+]]:fpr64 = IMPLICIT_DEF | ||
; RV64D-NEXT: [[FADD_D:%[0-9]+]]:fpr64 = nofpexcept FADD_D [[DEF]], [[DEF]], 7 | ||
; RV64D-NEXT: $f10_d = COPY [[FADD_D]] | ||
%0:fprb(s64) = G_IMPLICIT_DEF | ||
%1:fprb(s64) = G_FADD %0, %0 | ||
$f10_d = COPY %1(s64) | ||
... | ||
--- | ||
name: implicit_def_copy_fpr | ||
legalized: true | ||
regBankSelected: true | ||
body: | | ||
bb.0: | ||
; RV64D-LABEL: name: implicit_def_copy_fpr | ||
; RV64D: [[DEF:%[0-9]+]]:fpr64 = IMPLICIT_DEF | ||
; RV64D-NEXT: $f10_d = COPY [[DEF]] | ||
%0:fprb(s64) = G_IMPLICIT_DEF | ||
%1:fprb(s64) = COPY %0(s64) | ||
$f10_d = COPY %1(s64) | ||
... |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py | ||
# RUN: llc -mtriple=riscv32 -mattr=+f -run-pass=regbankselect -simplify-mir -verify-machineinstrs %s -o - \ | ||
# RUN: | FileCheck -check-prefix=RV32F %s | ||
|
||
--- | ||
name: implicit_def_gpr | ||
legalized: true | ||
body: | | ||
bb.0: | ||
; RV32F-LABEL: name: implicit_def_gpr | ||
; RV32F: [[DEF:%[0-9]+]]:gprb(s32) = G_IMPLICIT_DEF | ||
; RV32F-NEXT: [[ADD:%[0-9]+]]:gprb(s32) = G_ADD [[DEF]], [[DEF]] | ||
; RV32F-NEXT: $x10 = COPY [[ADD]](s32) | ||
%0:_(s32) = G_IMPLICIT_DEF | ||
%1:_(s32) = G_ADD %0, %0 | ||
$x10 = COPY %1(s32) | ||
... | ||
--- | ||
name: implicit_def_copy_gpr | ||
legalized: true | ||
body: | | ||
bb.0: | ||
; RV32F-LABEL: name: implicit_def_copy_gpr | ||
; RV32F: [[DEF:%[0-9]+]]:gprb(s32) = G_IMPLICIT_DEF | ||
; RV32F-NEXT: [[COPY:%[0-9]+]]:gprb(s32) = COPY [[DEF]](s32) | ||
; RV32F-NEXT: $x10 = COPY [[COPY]](s32) | ||
%0:_(s32) = G_IMPLICIT_DEF | ||
%1:_(s32) = COPY %0(s32) | ||
$x10 = COPY %1(s32) | ||
... | ||
|
||
--- | ||
name: implicit_def_fpr | ||
legalized: true | ||
body: | | ||
bb.0: | ||
; RV32F-LABEL: name: implicit_def_fpr | ||
; RV32F: [[DEF:%[0-9]+]]:fprb(s32) = G_IMPLICIT_DEF | ||
; RV32F-NEXT: [[FADD:%[0-9]+]]:fprb(s32) = G_FADD [[DEF]], [[DEF]] | ||
; RV32F-NEXT: $f10_f = COPY [[FADD]](s32) | ||
%0:_(s32) = G_IMPLICIT_DEF | ||
%1:_(s32) = G_FADD %0, %0 | ||
$f10_f = COPY %1(s32) | ||
... | ||
--- | ||
name: implicit_def_copy_fpr | ||
legalized: true | ||
body: | | ||
bb.0: | ||
; RV32F-LABEL: name: implicit_def_copy_fpr | ||
; RV32F: [[DEF:%[0-9]+]]:fprb(s32) = G_IMPLICIT_DEF | ||
; RV32F-NEXT: $f10_f = COPY [[DEF]](s32) | ||
%0:_(s32) = G_IMPLICIT_DEF | ||
$f10_f = COPY %0(s32) | ||
... |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py | ||
# RUN: llc -mtriple=riscv64 -mattr=+d -run-pass=regbankselect -simplify-mir -verify-machineinstrs %s -o - \ | ||
# RUN: | FileCheck -check-prefix=RV64D %s | ||
|
||
--- | ||
name: implicit_def_gpr | ||
legalized: true | ||
body: | | ||
bb.0: | ||
; RV64D-LABEL: name: implicit_def_gpr | ||
; RV64D: [[DEF:%[0-9]+]]:gprb(s64) = G_IMPLICIT_DEF | ||
; RV64D-NEXT: [[ADD:%[0-9]+]]:gprb(s64) = G_ADD [[DEF]], [[DEF]] | ||
; RV64D-NEXT: $x10 = COPY [[ADD]](s64) | ||
%0:_(s64) = G_IMPLICIT_DEF | ||
%1:_(s64) = G_ADD %0, %0 | ||
$x10 = COPY %1(s64) | ||
... | ||
--- | ||
name: implicit_def_copy_gpr | ||
legalized: true | ||
body: | | ||
bb.0: | ||
; RV64D-LABEL: name: implicit_def_copy_gpr | ||
; RV64D: [[DEF:%[0-9]+]]:gprb(s64) = G_IMPLICIT_DEF | ||
; RV64D-NEXT: [[COPY:%[0-9]+]]:gprb(s64) = COPY [[DEF]](s64) | ||
; RV64D-NEXT: $x10 = COPY [[COPY]](s64) | ||
%0:_(s64) = G_IMPLICIT_DEF | ||
%1:_(s64) = COPY %0(s64) | ||
$x10 = COPY %1(s64) | ||
... | ||
|
||
--- | ||
name: implicit_def_fpr | ||
legalized: true | ||
body: | | ||
bb.0: | ||
; RV64D-LABEL: name: implicit_def_fpr | ||
; RV64D: [[DEF:%[0-9]+]]:fprb(s64) = G_IMPLICIT_DEF | ||
; RV64D-NEXT: [[FADD:%[0-9]+]]:fprb(s64) = G_FADD [[DEF]], [[DEF]] | ||
; RV64D-NEXT: $f10_d = COPY [[FADD]](s64) | ||
%0:_(s64) = G_IMPLICIT_DEF | ||
%1:_(s64) = G_FADD %0, %0 | ||
$f10_d = COPY %1(s64) | ||
... | ||
--- | ||
name: implicit_def_copy_fpr | ||
legalized: true | ||
body: | | ||
bb.0: | ||
%0:_(s64) = G_IMPLICIT_DEF | ||
$f10_d = COPY %0(s64) | ||
... |
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.
Can register bank selection produce this? There's no code for G_IMPLICIT_DEF in RISCVRegistrBankInfo so it would always have gprb?
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.
That is a good point. I should add support and test regbankselection for this case.