[llvm] 39f64b9 - [RISCV] Fix Predicates in SFB to MVccI (#207806)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 6 23:52:44 PDT 2026
Author: Sam Elliott
Date: 2026-07-06T23:52:39-07:00
New Revision: 39f64b9045441225f6229d3ea5502ae5a03307f8
URL: https://github.com/llvm/llvm-project/commit/39f64b9045441225f6229d3ea5502ae5a03307f8
DIFF: https://github.com/llvm/llvm-project/commit/39f64b9045441225f6229d3ea5502ae5a03307f8.diff
LOG: [RISCV] Fix Predicates in SFB to MVccI (#207806)
Added:
Modified:
llvm/lib/Target/RISCV/RISCVExpandPseudoInsts.cpp
llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_eq.ll
llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_ne.ll
llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_sge.ll
llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_slt.ll
llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_uge.ll
llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_ult.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVExpandPseudoInsts.cpp b/llvm/lib/Target/RISCV/RISCVExpandPseudoInsts.cpp
index f7652f0bb5df1..a716d5206e556 100644
--- a/llvm/lib/Target/RISCV/RISCVExpandPseudoInsts.cpp
+++ b/llvm/lib/Target/RISCV/RISCVExpandPseudoInsts.cpp
@@ -382,22 +382,22 @@ bool RISCVExpandPseudo::expandCCOpToCMov(MachineBasicBlock &MBB,
CMovImmOpcode = RISCV::QC_MVGEUI;
break;
case RISCV::QC_BEQI:
- CMovImmOpcode = RISCV::QC_MVEQI;
+ CMovImmOpcode = RISCV::QC_MVNEI;
break;
case RISCV::QC_BNEI:
- CMovImmOpcode = RISCV::QC_MVNEI;
+ CMovImmOpcode = RISCV::QC_MVEQI;
break;
case RISCV::QC_BLTI:
- CMovImmOpcode = RISCV::QC_MVLTI;
+ CMovImmOpcode = RISCV::QC_MVGEI;
break;
case RISCV::QC_BGEI:
- CMovImmOpcode = RISCV::QC_MVGEI;
+ CMovImmOpcode = RISCV::QC_MVLTI;
break;
case RISCV::QC_BLTUI:
- CMovImmOpcode = RISCV::QC_MVLTUI;
+ CMovImmOpcode = RISCV::QC_MVGEUI;
break;
case RISCV::QC_BGEUI:
- CMovImmOpcode = RISCV::QC_MVGEUI;
+ CMovImmOpcode = RISCV::QC_MVLTUI;
break;
}
diff --git a/llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_eq.ll b/llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_eq.ll
index cac58118d74b4..5dca26357cfe7 100644
--- a/llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_eq.ll
+++ b/llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_eq.ll
@@ -15,7 +15,7 @@ define i32 @branch_with_immSFB_mv(i32 %a, i32 %c, i32 %d) {
;
; RV32I-SFB-WITH-IMM-LABEL: branch_with_immSFB_mv:
; RV32I-SFB-WITH-IMM: # %bb.0: # %entry
-; RV32I-SFB-WITH-IMM-NEXT: qc.mveqi a0, a2, 2, a1
+; RV32I-SFB-WITH-IMM-NEXT: qc.mvnei a0, a2, 2, a1
; RV32I-SFB-WITH-IMM-NEXT: ret
entry:
%x = icmp eq i32 %d, 2
diff --git a/llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_ne.ll b/llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_ne.ll
index 3cfb32886ea98..6b04167d98b44 100644
--- a/llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_ne.ll
+++ b/llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_ne.ll
@@ -15,7 +15,7 @@ define i32 @branch_with_immSFB_mv(i32 %a, i32 %c, i32 %d) {
;
; RV32I-SFB-WITH-IMM-LABEL: branch_with_immSFB_mv:
; RV32I-SFB-WITH-IMM: # %bb.0: # %entry
-; RV32I-SFB-WITH-IMM-NEXT: qc.mvnei a0, a2, 2, a1
+; RV32I-SFB-WITH-IMM-NEXT: qc.mveqi a0, a2, 2, a1
; RV32I-SFB-WITH-IMM-NEXT: ret
entry:
%x = icmp ne i32 %d, 2
diff --git a/llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_sge.ll b/llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_sge.ll
index d0379ba5d9bd6..20fe6f4b14218 100644
--- a/llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_sge.ll
+++ b/llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_sge.ll
@@ -15,7 +15,7 @@ define i32 @branch_with_immSFB_mv(i32 %a, i32 %c, i32 %d) {
;
; RV32I-SFB-WITH-IMM-LABEL: branch_with_immSFB_mv:
; RV32I-SFB-WITH-IMM: # %bb.0: # %entry
-; RV32I-SFB-WITH-IMM-NEXT: qc.mvgei a0, a2, 2, a1
+; RV32I-SFB-WITH-IMM-NEXT: qc.mvlti a0, a2, 2, a1
; RV32I-SFB-WITH-IMM-NEXT: ret
entry:
%x = icmp sge i32 %d, 2
diff --git a/llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_slt.ll b/llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_slt.ll
index 0686029b5bb83..705bbc8a67598 100644
--- a/llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_slt.ll
+++ b/llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_slt.ll
@@ -15,7 +15,7 @@ define i32 @branch_with_immSFB_mv(i32 %a, i32 %c, i32 %d) {
;
; RV32I-SFB-WITH-IMM-LABEL: branch_with_immSFB_mv:
; RV32I-SFB-WITH-IMM: # %bb.0: # %entry
-; RV32I-SFB-WITH-IMM-NEXT: qc.mvlti a0, a2, 2, a1
+; RV32I-SFB-WITH-IMM-NEXT: qc.mvgei a0, a2, 2, a1
; RV32I-SFB-WITH-IMM-NEXT: ret
entry:
%x = icmp slt i32 %d, 2
diff --git a/llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_uge.ll b/llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_uge.ll
index f611958ef6afd..2351a0ff5185f 100644
--- a/llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_uge.ll
+++ b/llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_uge.ll
@@ -15,7 +15,7 @@ define i32 @branch_with_immSFB_mv(i32 %a, i32 %c, i32 %d) {
;
; RV32I-SFB-WITH-IMM-LABEL: branch_with_immSFB_mv:
; RV32I-SFB-WITH-IMM: # %bb.0: # %entry
-; RV32I-SFB-WITH-IMM-NEXT: qc.mvgeui a0, a2, 2, a1
+; RV32I-SFB-WITH-IMM-NEXT: qc.mvltui a0, a2, 2, a1
; RV32I-SFB-WITH-IMM-NEXT: ret
entry:
%x = icmp uge i32 %d, 2
diff --git a/llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_ult.ll b/llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_ult.ll
index 5aeeb667533e4..0a52fc4757c06 100644
--- a/llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_ult.ll
+++ b/llvm/test/CodeGen/RISCV/short-forward-branch-opt-with-branch-with-immediates_32_ult.ll
@@ -15,7 +15,7 @@ define i32 @branch_with_immSFB_mv(i32 %a, i32 %c, i32 %d) {
;
; RV32I-SFB-WITH-IMM-LABEL: branch_with_immSFB_mv:
; RV32I-SFB-WITH-IMM: # %bb.0: # %entry
-; RV32I-SFB-WITH-IMM-NEXT: qc.mvltui a0, a2, 2, a1
+; RV32I-SFB-WITH-IMM-NEXT: qc.mvgeui a0, a2, 2, a1
; RV32I-SFB-WITH-IMM-NEXT: ret
entry:
%x = icmp ult i32 %d, 2
More information about the llvm-commits
mailing list