[PATCH] D159511: [InstCombine] Pre-commit test for D159510
Qi Hu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 13 16:49:34 PDT 2023
Qi-Hu created this revision.
Qi-Hu added a reviewer: bryanpkc.
Herald added a project: All.
Qi-Hu requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D159511
Files:
llvm/test/Transforms/InstCombine/fold-xor-and-select-i1.ll
Index: llvm/test/Transforms/InstCombine/fold-xor-and-select-i1.ll
===================================================================
--- /dev/null
+++ llvm/test/Transforms/InstCombine/fold-xor-and-select-i1.ll
@@ -0,0 +1,16 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -passes=instcombine -S | FileCheck %s
+
+define i1 @max_if(i1 %a, i1 %b) {
+; CHECK-LABEL: define i1 @max_if
+; CHECK-SAME: (i1 [[A:%.*]], i1 [[B:%.*]]) {
+; CHECK-NEXT: [[TMP1:%.*]] = xor i1 [[B]], true
+; CHECK-NEXT: [[CMP:%.*]] = and i1 [[TMP1]], [[A]]
+; CHECK-NEXT: [[TMP2:%.*]] = select i1 [[CMP]], i1 [[A]], i1 [[B]]
+; CHECK-NEXT: ret i1 [[TMP2]]
+;
+ %1 = xor i1 %b, true
+ %cmp = and i1 %1, %a
+ %2 = select i1 %cmp, i1 %a, i1 %b
+ ret i1 %2
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159511.556735.patch
Type: text/x-patch
Size: 791 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230913/340be878/attachment.bin>
More information about the llvm-commits
mailing list