1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -constprop -S | FileCheck %s
4 declare i31 @llvm.ctpop.i31(i31 %val)
5 declare i32 @llvm.cttz.i32(i32 %val, i1)
6 declare i33 @llvm.ctlz.i33(i33 %val, i1)
7 declare <2 x i31> @llvm.ctpop.v2i31(<2 x i31> %val)
8 declare <2 x i32> @llvm.cttz.v2i32(<2 x i32> %val, i1)
9 declare <2 x i33> @llvm.ctlz.v2i33(<2 x i33> %val, i1)
11 define i31 @ctpop_const() {
12 ; CHECK-LABEL: @ctpop_const(
13 ; CHECK-NEXT: ret i31 12
15 %x = call i31 @llvm.ctpop.i31(i31 12415124)
19 define i32 @cttz_const() {
20 ; CHECK-LABEL: @cttz_const(
21 ; CHECK-NEXT: ret i32 1
23 %x = call i32 @llvm.cttz.i32(i32 87359874, i1 true)
27 define i33 @ctlz_const() {
28 ; CHECK-LABEL: @ctlz_const(
29 ; CHECK-NEXT: ret i33 6
31 %x = call i33 @llvm.ctlz.i33(i33 87359874, i1 true)
35 define i31 @ctpop_zero() {
36 ; CHECK-LABEL: @ctpop_zero(
37 ; CHECK-NEXT: ret i31 0
39 %x = call i31 @llvm.ctpop.i31(i31 0)
43 define i32 @cttz_zero_defined() {
44 ; CHECK-LABEL: @cttz_zero_defined(
45 ; CHECK-NEXT: ret i32 32
47 %x = call i32 @llvm.cttz.i32(i32 0, i1 false)
51 define i32 @cttz_zero_undefined() {
52 ; CHECK-LABEL: @cttz_zero_undefined(
53 ; CHECK-NEXT: ret i32 undef
55 %x = call i32 @llvm.cttz.i32(i32 0, i1 true)
59 define i33 @ctlz_zero_defined() {
60 ; CHECK-LABEL: @ctlz_zero_defined(
61 ; CHECK-NEXT: ret i33 33
63 %x = call i33 @llvm.ctlz.i33(i33 0, i1 false)
67 define i33 @ctlz_zero_undefined() {
68 ; CHECK-LABEL: @ctlz_zero_undefined(
69 ; CHECK-NEXT: ret i33 undef
71 %x = call i33 @llvm.ctlz.i33(i33 0, i1 true)
75 define i31 @ctpop_undef() {
76 ; CHECK-LABEL: @ctpop_undef(
77 ; CHECK-NEXT: ret i31 0
79 %x = call i31 @llvm.ctpop.i31(i31 undef)
83 define i32 @cttz_undef_defined() {
84 ; CHECK-LABEL: @cttz_undef_defined(
85 ; CHECK-NEXT: ret i32 0
87 %x = call i32 @llvm.cttz.i32(i32 undef, i1 false)
91 define i32 @cttz_undef_undefined() {
92 ; CHECK-LABEL: @cttz_undef_undefined(
93 ; CHECK-NEXT: ret i32 undef
95 %x = call i32 @llvm.cttz.i32(i32 undef, i1 true)
99 define i33 @ctlz_undef_defined() {
100 ; CHECK-LABEL: @ctlz_undef_defined(
101 ; CHECK-NEXT: ret i33 0
103 %x = call i33 @llvm.ctlz.i33(i33 undef, i1 false)
107 define i33 @ctlz_undef_undefined() {
108 ; CHECK-LABEL: @ctlz_undef_undefined(
109 ; CHECK-NEXT: ret i33 undef
111 %x = call i33 @llvm.ctlz.i33(i33 undef, i1 true)
115 define <2 x i31> @ctpop_vector() {
116 ; CHECK-LABEL: @ctpop_vector(
117 ; CHECK-NEXT: ret <2 x i31> <i31 8, i31 1>
119 %x = call <2 x i31> @llvm.ctpop.v2i31(<2 x i31> <i31 255, i31 16>)
123 define <2 x i31> @ctpop_vector_undef() {
124 ; CHECK-LABEL: @ctpop_vector_undef(
125 ; CHECK-NEXT: ret <2 x i31> zeroinitializer
127 %x = call <2 x i31> @llvm.ctpop.v2i31(<2 x i31> <i31 0, i31 undef>)
131 define <2 x i32> @cttz_vector() {
132 ; CHECK-LABEL: @cttz_vector(
133 ; CHECK-NEXT: ret <2 x i32> <i32 0, i32 4>
135 %x = call <2 x i32> @llvm.cttz.v2i32(<2 x i32> <i32 255, i32 16>, i1 true)
139 define <2 x i32> @cttz_vector_undef_defined() {
140 ; CHECK-LABEL: @cttz_vector_undef_defined(
141 ; CHECK-NEXT: ret <2 x i32> <i32 32, i32 0>
143 %x = call <2 x i32> @llvm.cttz.v2i32(<2 x i32> <i32 0, i32 undef>, i1 false)
147 define <2 x i32> @cttz_vector_undef_undefined() {
148 ; CHECK-LABEL: @cttz_vector_undef_undefined(
149 ; CHECK-NEXT: ret <2 x i32> undef
151 %x = call <2 x i32> @llvm.cttz.v2i32(<2 x i32> <i32 0, i32 undef>, i1 true)
155 define <2 x i33> @ctlz_vector() {
156 ; CHECK-LABEL: @ctlz_vector(
157 ; CHECK-NEXT: ret <2 x i33> <i33 25, i33 28>
159 %x = call <2 x i33> @llvm.ctlz.v2i33(<2 x i33> <i33 255, i33 16>, i1 true)
163 define <2 x i33> @ctlz_vector_undef_defined() {
164 ; CHECK-LABEL: @ctlz_vector_undef_defined(
165 ; CHECK-NEXT: ret <2 x i33> <i33 33, i33 0>
167 %x = call <2 x i33> @llvm.ctlz.v2i33(<2 x i33> <i33 0, i33 undef>, i1 false)
171 define <2 x i33> @ctlz_vector_undef_undefined() {
172 ; CHECK-LABEL: @ctlz_vector_undef_undefined(
173 ; CHECK-NEXT: ret <2 x i33> undef
175 %x = call <2 x i33> @llvm.ctlz.v2i33(<2 x i33> <i33 0, i33 undef>, i1 true)