[llvm] d517500 - [InstCombine] add test for ctpop; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 23 10:25:39 PDT 2021
Author: Sanjay Patel
Date: 2021-04-23T13:23:24-04:00
New Revision: d5175005abe15b041021f36de20cb5fde9a0685c
URL: https://github.com/llvm/llvm-project/commit/d5175005abe15b041021f36de20cb5fde9a0685c
DIFF: https://github.com/llvm/llvm-project/commit/d5175005abe15b041021f36de20cb5fde9a0685c.diff
LOG: [InstCombine] add test for ctpop; NFC
Goes with 2912f42a / PR50096.
Added:
Modified:
llvm/test/Transforms/InstCombine/ctpop.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/ctpop.ll b/llvm/test/Transforms/InstCombine/ctpop.ll
index 97d4d94cf06f..c25b1f3b8729 100644
--- a/llvm/test/Transforms/InstCombine/ctpop.ll
+++ b/llvm/test/Transforms/InstCombine/ctpop.ll
@@ -3,6 +3,7 @@
declare i32 @llvm.ctpop.i32(i32)
declare i8 @llvm.ctpop.i8(i8)
+declare i7 @llvm.ctpop.i7(i7)
declare i1 @llvm.ctpop.i1(i1)
declare <2 x i32> @llvm.ctpop.v2i32(<2 x i32>)
declare void @llvm.assume(i1)
@@ -131,6 +132,18 @@ define i32 @_parity_of_not(i32 %x) {
ret i32 %r
}
+define i7 @_parity_of_not_odd_type(i7 %x) {
+; CHECK-LABEL: @_parity_of_not_odd_type(
+; CHECK-NEXT: [[NEG:%.*]] = xor i7 [[X:%.*]], -1
+; CHECK-NEXT: [[CNT:%.*]] = tail call i7 @llvm.ctpop.i7(i7 [[NEG]]), !range [[RNG2:![0-9]+]]
+; CHECK-NEXT: [[R:%.*]] = and i7 [[CNT]], 1
+; CHECK-NEXT: ret i7 [[R]]
+;
+ %neg = xor i7 %x, -1
+ %cnt = tail call i7 @llvm.ctpop.i7(i7 %neg)
+ %r = and i7 %cnt, 1
+ ret i7 %r
+}
define <2 x i32> @_parity_of_not_vec(<2 x i32> %x) {
; CHECK-LABEL: @_parity_of_not_vec(
More information about the llvm-commits
mailing list