[PATCH] D156081: [RISCV] Add CZERO_EQZ/CZERO_NEZ to computeKnownBitsForTargetNode.
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 24 07:42:35 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9da0db4dd8cf: [RISCV] Add CZERO_EQZ/CZERO_NEZ to computeKnownBitsForTargetNode. (authored by craig.topper).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156081/new/
https://reviews.llvm.org/D156081
Files:
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/test/CodeGen/RISCV/xaluo.ll
Index: llvm/test/CodeGen/RISCV/xaluo.ll
===================================================================
--- llvm/test/CodeGen/RISCV/xaluo.ll
+++ llvm/test/CodeGen/RISCV/xaluo.ll
@@ -4395,8 +4395,7 @@
; RV32ZICOND-NEXT: czero.eqz a1, a1, a2
; RV32ZICOND-NEXT: czero.nez a0, a0, a2
; RV32ZICOND-NEXT: or a0, a1, a0
-; RV32ZICOND-NEXT: li a1, 1
-; RV32ZICOND-NEXT: bne a0, a1, .LBB55_2
+; RV32ZICOND-NEXT: beqz a0, .LBB55_2
; RV32ZICOND-NEXT: # %bb.1: # %overflow
; RV32ZICOND-NEXT: li a0, 0
; RV32ZICOND-NEXT: ret
@@ -4769,8 +4768,7 @@
; RV32ZICOND-NEXT: sltu a0, a0, a2
; RV32ZICOND-NEXT: czero.nez a0, a0, a4
; RV32ZICOND-NEXT: or a0, a1, a0
-; RV32ZICOND-NEXT: li a1, 1
-; RV32ZICOND-NEXT: bne a0, a1, .LBB59_2
+; RV32ZICOND-NEXT: beqz a0, .LBB59_2
; RV32ZICOND-NEXT: # %bb.1: # %overflow
; RV32ZICOND-NEXT: li a0, 0
; RV32ZICOND-NEXT: ret
@@ -5602,8 +5600,7 @@
; RV32ZICOND-NEXT: sltu a1, a2, a1
; RV32ZICOND-NEXT: czero.eqz a1, a1, a3
; RV32ZICOND-NEXT: or a0, a1, a0
-; RV32ZICOND-NEXT: li a1, 1
-; RV32ZICOND-NEXT: bne a0, a1, .LBB65_2
+; RV32ZICOND-NEXT: beqz a0, .LBB65_2
; RV32ZICOND-NEXT: # %bb.1: # %overflow
; RV32ZICOND-NEXT: li a0, 0
; RV32ZICOND-NEXT: ret
Index: llvm/lib/Target/RISCV/RISCVISelLowering.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -13716,6 +13716,13 @@
Known = Known.intersectWith(Known2);
break;
}
+ case RISCVISD::CZERO_EQZ:
+ case RISCVISD::CZERO_NEZ:
+ Known = DAG.computeKnownBits(Op.getOperand(0), Depth + 1);
+ // Result is either all zero or operand 0. We can propagate zeros, but not
+ // ones.
+ Known.One.clearAllBits();
+ break;
case RISCVISD::REMUW: {
KnownBits Known2;
Known = DAG.computeKnownBits(Op.getOperand(0), DemandedElts, Depth + 1);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156081.543547.patch
Type: text/x-patch
Size: 1953 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230724/bdff950e/attachment.bin>
More information about the llvm-commits
mailing list