1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -instcombine -S < %s | FileCheck %s
4 define i32 @ctpop_bitreverse(i32 %x) {
5 ; CHECK-LABEL: @ctpop_bitreverse(
6 ; CHECK-NEXT: [[B:%.*]] = tail call i32 @llvm.ctpop.i32(i32 [[X:%.*]]), !range !0
7 ; CHECK-NEXT: ret i32 [[B]]
9 %a = tail call i32 @llvm.bitreverse.i32(i32 %x)
10 %b = tail call i32 @llvm.ctpop.i32(i32 %a)
14 define <2 x i64> @ctpop_bitreverse_vec(<2 x i64> %x) {
15 ; CHECK-LABEL: @ctpop_bitreverse_vec(
16 ; CHECK-NEXT: [[B:%.*]] = tail call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> [[X:%.*]])
17 ; CHECK-NEXT: ret <2 x i64> [[B]]
19 %a = tail call <2 x i64> @llvm.bitreverse.v2i64(<2 x i64> %x)
20 %b = tail call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %a)
24 define i32 @ctpop_bswap(i32 %x) {
25 ; CHECK-LABEL: @ctpop_bswap(
26 ; CHECK-NEXT: [[B:%.*]] = tail call i32 @llvm.ctpop.i32(i32 [[X:%.*]]), !range !0
27 ; CHECK-NEXT: ret i32 [[B]]
29 %a = tail call i32 @llvm.bswap.i32(i32 %x)
30 %b = tail call i32 @llvm.ctpop.i32(i32 %a)
34 define <2 x i64> @ctpop_bswap_vec(<2 x i64> %x) {
35 ; CHECK-LABEL: @ctpop_bswap_vec(
36 ; CHECK-NEXT: [[B:%.*]] = tail call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> [[X:%.*]])
37 ; CHECK-NEXT: ret <2 x i64> [[B]]
39 %a = tail call <2 x i64> @llvm.bswap.v2i64(<2 x i64> %x)
40 %b = tail call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %a)
44 declare i32 @llvm.bitreverse.i32(i32)
45 declare <2 x i64> @llvm.bitreverse.v2i64(<2 x i64>)
46 declare i32 @llvm.bswap.i32(i32)
47 declare <2 x i64> @llvm.bswap.v2i64(<2 x i64>)
48 declare i32 @llvm.ctpop.i32(i32)
49 declare <2 x i64> @llvm.ctpop.v2i64(<2 x i64>)