[llvm] e77cb4a - [SystemZ] Return true from preferZeroCompareBranch().
Jonas Paulsson via llvm-commits
llvm-commits at lists.llvm.org
Tue May 25 08:26:46 PDT 2021
Author: Jonas Paulsson
Date: 2021-05-25T10:24:14-05:00
New Revision: e77cb4ae63e932aa8d5d825970c9e67c1491edec
URL: https://github.com/llvm/llvm-project/commit/e77cb4ae63e932aa8d5d825970c9e67c1491edec
DIFF: https://github.com/llvm/llvm-project/commit/e77cb4ae63e932aa8d5d825970c9e67c1491edec.diff
LOG: [SystemZ] Return true from preferZeroCompareBranch().
Review: Ulrich Weigand
Differential Revision: https://reviews.llvm.org/D103057
Added:
Modified:
llvm/lib/Target/SystemZ/SystemZISelLowering.h
llvm/test/CodeGen/SystemZ/codegenprepare-form-OF-ops.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.h b/llvm/lib/Target/SystemZ/SystemZISelLowering.h
index a9f6cd3ae8a4c..21b3e3a1f67fd 100644
--- a/llvm/lib/Target/SystemZ/SystemZISelLowering.h
+++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.h
@@ -423,6 +423,7 @@ class SystemZTargetLowering : public TargetLowering {
return TargetLoweringBase::getPreferredVectorAction(VT);
}
bool isCheapToSpeculateCtlz() const override { return true; }
+ bool preferZeroCompareBranch() const override { return true; }
EVT getSetCCResultType(const DataLayout &DL, LLVMContext &,
EVT) const override;
bool isFMAFasterThanFMulAndFAdd(const MachineFunction &MF,
diff --git a/llvm/test/CodeGen/SystemZ/codegenprepare-form-OF-ops.ll b/llvm/test/CodeGen/SystemZ/codegenprepare-form-OF-ops.ll
index 161f4bc2b7658..23d69f5bf1c93 100644
--- a/llvm/test/CodeGen/SystemZ/codegenprepare-form-OF-ops.ll
+++ b/llvm/test/CodeGen/SystemZ/codegenprepare-form-OF-ops.ll
@@ -52,3 +52,41 @@ bb:
%tmp12 = select i1 %tmp10, i64 %tmp11, i64 %arg
ret i64 %tmp12
}
+
+define i32 @optbranch_32(i32 %Arg) {
+; CHECK-LABEL: optbranch_32:
+; CHECK: alhsik %r2, %r2, 1
+; CHECK-NEXT: bler %r14
+; CHECK-NEXT: .LBB4_1:
+; CHECK-NEXT: lhi %r2, -1
+; CHECK-NEXT: br %r14
+bb:
+ %i1 = icmp eq i32 %Arg, -1
+ br i1 %i1, label %bb2, label %bb3
+
+bb2:
+ ret i32 -1
+
+bb3:
+ %i4 = add nuw i32 %Arg, 1
+ ret i32 %i4
+}
+
+define i64 @optbranch_64(i64 %Arg) {
+; CHECK-LABEL: optbranch_64:
+; CHECK: alghsik %r2, %r2, 1
+; CHECK-NEXT: bler %r14
+; CHECK-NEXT: .LBB5_1:
+; CHECK-NEXT: lghi %r2, -1
+; CHECK-NEXT: br %r14
+bb:
+ %i1 = icmp eq i64 %Arg, -1
+ br i1 %i1, label %bb2, label %bb3
+
+bb2:
+ ret i64 -1
+
+bb3:
+ %i4 = add nuw i64 %Arg, 1
+ ret i64 %i4
+}
More information about the llvm-commits
mailing list