-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[RISCV] Xqci with Short Forward Branches #161407
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 2 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 | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,7 +1,7 @@ | ||||||||||||||||||
| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py | ||||||||||||||||||
| ; RUN: llc -mtriple=riscv32 -disable-block-placement -verify-machineinstrs < %s \ | ||||||||||||||||||
| ; RUN: | FileCheck -check-prefixes=RV32I %s | ||||||||||||||||||
| ; RUN: llc -mtriple=riscv32 -mattr=+experimental-xqcicm,+experimental-xqcics,+experimental-xqcicli -verify-machineinstrs < %s \ | ||||||||||||||||||
| ; RUN: llc -mtriple=riscv32 -mattr=+experimental-xqcicm,+experimental-xqcics,+experimental-xqcicli,+zca,+short-forward-branch-opt,+conditional-cmv-fusion -verify-machineinstrs < %s \ | ||||||||||||||||||
| ; RUN: | FileCheck %s --check-prefixes=RV32IXQCI | ||||||||||||||||||
| ; RUN: llc -mtriple=riscv64 -disable-block-placement -verify-machineinstrs < %s \ | ||||||||||||||||||
| ; RUN: | FileCheck -check-prefixes=RV64I %s | ||||||||||||||||||
|
|
@@ -88,39 +88,38 @@ define signext i32 @foo(i32 signext %a, ptr %b) nounwind { | |||||||||||||||||
| ; RV32IXQCI-LABEL: foo: | ||||||||||||||||||
| ; RV32IXQCI: # %bb.0: | ||||||||||||||||||
| ; RV32IXQCI-NEXT: lw a2, 0(a1) | ||||||||||||||||||
| ; RV32IXQCI-NEXT: lw a4, 0(a1) | ||||||||||||||||||
| ; RV32IXQCI-NEXT: lw t5, 0(a1) | ||||||||||||||||||
| ; RV32IXQCI-NEXT: lw t4, 0(a1) | ||||||||||||||||||
| ; RV32IXQCI-NEXT: lw t3, 0(a1) | ||||||||||||||||||
| ; RV32IXQCI-NEXT: lw t2, 0(a1) | ||||||||||||||||||
| ; RV32IXQCI-NEXT: lw t0, 0(a1) | ||||||||||||||||||
| ; RV32IXQCI-NEXT: lw a7, 0(a1) | ||||||||||||||||||
| ; RV32IXQCI-NEXT: lw a6, 0(a1) | ||||||||||||||||||
| ; RV32IXQCI-NEXT: lw a3, 0(a1) | ||||||||||||||||||
| ; RV32IXQCI-NEXT: lw t1, 0(a1) | ||||||||||||||||||
| ; RV32IXQCI-NEXT: lw a4, 0(a1) | ||||||||||||||||||
| ; RV32IXQCI-NEXT: lw a5, 0(a1) | ||||||||||||||||||
| ; RV32IXQCI-NEXT: bltz t1, .LBB0_2 | ||||||||||||||||||
|
Collaborator
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. Why was there a branch here before?
Member
Author
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. Broadly because This is due to the pattern here: llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfo.td Lines 1666 to 1669 in 5b40491
Complexity=8.
There was only the generic llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfoXqci.td Lines 1544 to 1547 in 5b40491
This PR wrapped up the latter patterns into These two patterns being almost identical and having the same complexity is not a problem, because the I've been trying to work through internally to make sure that all our patterns are totally ordered with |
||||||||||||||||||
| ; RV32IXQCI-NEXT: qc.mvne a0, a0, a2, a2 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: qc.mveq a0, a0, a3, a3 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: lw a2, 0(a1) | ||||||||||||||||||
| ; RV32IXQCI-NEXT: qc.mvgeu a0, a4, a0, a4 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: lw a3, 0(a1) | ||||||||||||||||||
| ; RV32IXQCI-NEXT: qc.mvltu a0, a0, a5, a5 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: lw a4, 0(a1) | ||||||||||||||||||
| ; RV32IXQCI-NEXT: qc.mvgeu a0, a0, a2, a2 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: lw a2, 0(a1) | ||||||||||||||||||
| ; RV32IXQCI-NEXT: qc.mvltu a0, a3, a0, a3 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: lw a3, 0(a1) | ||||||||||||||||||
| ; RV32IXQCI-NEXT: qc.mvge a0, a4, a0, a4 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: lw a4, 0(a1) | ||||||||||||||||||
| ; RV32IXQCI-NEXT: qc.mvlt a0, a0, a2, a2 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: lw a2, 0(a1) | ||||||||||||||||||
| ; RV32IXQCI-NEXT: qc.mvge a0, a0, a3, a3 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: lw a3, 0(a1) | ||||||||||||||||||
| ; RV32IXQCI-NEXT: qc.mvlt a0, a4, a0, a4 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: lw a4, 0(a1) | ||||||||||||||||||
| ; RV32IXQCI-NEXT: lw a1, 0(a1) | ||||||||||||||||||
| ; RV32IXQCI-NEXT: blez a2, .LBB0_2 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: # %bb.1: | ||||||||||||||||||
| ; RV32IXQCI-NEXT: li a5, 0 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: qc.mveq a2, a0, a2, a0 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: qc.mvne a4, a2, a4, a2 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: qc.mvltu t5, t5, a4, a4 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: qc.mvgeu t4, t5, t4, t5 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: qc.mvltu t3, t4, t3, t4 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: qc.mvgeu t2, t2, t3, t3 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: qc.mvlt t0, t0, t2, t2 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: qc.mvge a7, t0, a7, t0 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: qc.mvlt a6, a7, a6, a7 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: qc.mvge a3, a3, a6, a6 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: qc.mvlt a3, a5, t1, t1 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: mv a5, a3 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: mv a0, a2 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: .LBB0_2: | ||||||||||||||||||
| ; RV32IXQCI-NEXT: lw a2, 0(a1) | ||||||||||||||||||
| ; RV32IXQCI-NEXT: lw a0, 0(a1) | ||||||||||||||||||
| ; RV32IXQCI-NEXT: li a1, 1024 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: qc.mvlt a2, a1, a2, a5 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: li a1, 2046 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: qc.mvltu a0, a1, t1, a2 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: qc.mvnei a0, a2, 0, a3 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: li a3, 1024 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: qc.mvge a0, a3, a4, a4 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: li a3, 2046 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: qc.mvgeu a0, a3, a2, a1 | ||||||||||||||||||
| ; RV32IXQCI-NEXT: ret | ||||||||||||||||||
| ; | ||||||||||||||||||
| ; RV64I-LABEL: foo: | ||||||||||||||||||
|
|
||||||||||||||||||
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.
Should this be MVLTI?
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.
Yes, which shows my testing isn't good enough yet. Will look at adding additional relevant RUN lines