Nikita Popov | f17421e | 2018-12-20 19:46:52 +0000 | [diff] [blame] | 1 | ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py |
| 2 | ; RUN: opt < %s -constprop -S | FileCheck %s |
| 3 | |
| 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) |
| 10 | |
| 11 | define i31 @ctpop_const() { |
| 12 | ; CHECK-LABEL: @ctpop_const( |
| 13 | ; CHECK-NEXT: ret i31 12 |
| 14 | ; |
| 15 | %x = call i31 @llvm.ctpop.i31(i31 12415124) |
| 16 | ret i31 %x |
| 17 | } |
| 18 | |
| 19 | define i32 @cttz_const() { |
| 20 | ; CHECK-LABEL: @cttz_const( |
| 21 | ; CHECK-NEXT: ret i32 1 |
| 22 | ; |
| 23 | %x = call i32 @llvm.cttz.i32(i32 87359874, i1 true) |
| 24 | ret i32 %x |
| 25 | } |
| 26 | |
| 27 | define i33 @ctlz_const() { |
| 28 | ; CHECK-LABEL: @ctlz_const( |
| 29 | ; CHECK-NEXT: ret i33 6 |
| 30 | ; |
| 31 | %x = call i33 @llvm.ctlz.i33(i33 87359874, i1 true) |
| 32 | ret i33 %x |
| 33 | } |
| 34 | |
| 35 | define i31 @ctpop_zero() { |
| 36 | ; CHECK-LABEL: @ctpop_zero( |
| 37 | ; CHECK-NEXT: ret i31 0 |
| 38 | ; |
| 39 | %x = call i31 @llvm.ctpop.i31(i31 0) |
| 40 | ret i31 %x |
| 41 | } |
| 42 | |
| 43 | define i32 @cttz_zero_defined() { |
| 44 | ; CHECK-LABEL: @cttz_zero_defined( |
| 45 | ; CHECK-NEXT: ret i32 32 |
| 46 | ; |
| 47 | %x = call i32 @llvm.cttz.i32(i32 0, i1 false) |
| 48 | ret i32 %x |
| 49 | } |
| 50 | |
| 51 | define i32 @cttz_zero_undefined() { |
| 52 | ; CHECK-LABEL: @cttz_zero_undefined( |
| 53 | ; CHECK-NEXT: ret i32 undef |
| 54 | ; |
| 55 | %x = call i32 @llvm.cttz.i32(i32 0, i1 true) |
| 56 | ret i32 %x |
| 57 | } |
| 58 | |
| 59 | define i33 @ctlz_zero_defined() { |
| 60 | ; CHECK-LABEL: @ctlz_zero_defined( |
| 61 | ; CHECK-NEXT: ret i33 33 |
| 62 | ; |
| 63 | %x = call i33 @llvm.ctlz.i33(i33 0, i1 false) |
| 64 | ret i33 %x |
| 65 | } |
| 66 | |
| 67 | define i33 @ctlz_zero_undefined() { |
| 68 | ; CHECK-LABEL: @ctlz_zero_undefined( |
| 69 | ; CHECK-NEXT: ret i33 undef |
| 70 | ; |
| 71 | %x = call i33 @llvm.ctlz.i33(i33 0, i1 true) |
| 72 | ret i33 %x |
| 73 | } |
| 74 | |
| 75 | define i31 @ctpop_undef() { |
| 76 | ; CHECK-LABEL: @ctpop_undef( |
Nikita Popov | 9f6e9cf | 2019-01-11 21:18:00 +0000 | [diff] [blame] | 77 | ; CHECK-NEXT: ret i31 0 |
Nikita Popov | f17421e | 2018-12-20 19:46:52 +0000 | [diff] [blame] | 78 | ; |
| 79 | %x = call i31 @llvm.ctpop.i31(i31 undef) |
| 80 | ret i31 %x |
| 81 | } |
| 82 | |
| 83 | define i32 @cttz_undef_defined() { |
| 84 | ; CHECK-LABEL: @cttz_undef_defined( |
Nikita Popov | 9f6e9cf | 2019-01-11 21:18:00 +0000 | [diff] [blame] | 85 | ; CHECK-NEXT: ret i32 0 |
Nikita Popov | f17421e | 2018-12-20 19:46:52 +0000 | [diff] [blame] | 86 | ; |
| 87 | %x = call i32 @llvm.cttz.i32(i32 undef, i1 false) |
| 88 | ret i32 %x |
| 89 | } |
| 90 | |
| 91 | define i32 @cttz_undef_undefined() { |
| 92 | ; CHECK-LABEL: @cttz_undef_undefined( |
Nikita Popov | 9f6e9cf | 2019-01-11 21:18:00 +0000 | [diff] [blame] | 93 | ; CHECK-NEXT: ret i32 undef |
Nikita Popov | f17421e | 2018-12-20 19:46:52 +0000 | [diff] [blame] | 94 | ; |
| 95 | %x = call i32 @llvm.cttz.i32(i32 undef, i1 true) |
| 96 | ret i32 %x |
| 97 | } |
| 98 | |
| 99 | define i33 @ctlz_undef_defined() { |
| 100 | ; CHECK-LABEL: @ctlz_undef_defined( |
Nikita Popov | 9f6e9cf | 2019-01-11 21:18:00 +0000 | [diff] [blame] | 101 | ; CHECK-NEXT: ret i33 0 |
Nikita Popov | f17421e | 2018-12-20 19:46:52 +0000 | [diff] [blame] | 102 | ; |
| 103 | %x = call i33 @llvm.ctlz.i33(i33 undef, i1 false) |
| 104 | ret i33 %x |
| 105 | } |
| 106 | |
| 107 | define i33 @ctlz_undef_undefined() { |
| 108 | ; CHECK-LABEL: @ctlz_undef_undefined( |
Nikita Popov | 9f6e9cf | 2019-01-11 21:18:00 +0000 | [diff] [blame] | 109 | ; CHECK-NEXT: ret i33 undef |
Nikita Popov | f17421e | 2018-12-20 19:46:52 +0000 | [diff] [blame] | 110 | ; |
| 111 | %x = call i33 @llvm.ctlz.i33(i33 undef, i1 true) |
| 112 | ret i33 %x |
| 113 | } |
| 114 | |
| 115 | define <2 x i31> @ctpop_vector() { |
| 116 | ; CHECK-LABEL: @ctpop_vector( |
| 117 | ; CHECK-NEXT: ret <2 x i31> <i31 8, i31 1> |
| 118 | ; |
| 119 | %x = call <2 x i31> @llvm.ctpop.v2i31(<2 x i31> <i31 255, i31 16>) |
| 120 | ret <2 x i31> %x |
| 121 | } |
| 122 | |
| 123 | define <2 x i31> @ctpop_vector_undef() { |
| 124 | ; CHECK-LABEL: @ctpop_vector_undef( |
Nikita Popov | 9f6e9cf | 2019-01-11 21:18:00 +0000 | [diff] [blame] | 125 | ; CHECK-NEXT: ret <2 x i31> zeroinitializer |
Nikita Popov | f17421e | 2018-12-20 19:46:52 +0000 | [diff] [blame] | 126 | ; |
| 127 | %x = call <2 x i31> @llvm.ctpop.v2i31(<2 x i31> <i31 0, i31 undef>) |
| 128 | ret <2 x i31> %x |
| 129 | } |
| 130 | |
| 131 | define <2 x i32> @cttz_vector() { |
| 132 | ; CHECK-LABEL: @cttz_vector( |
| 133 | ; CHECK-NEXT: ret <2 x i32> <i32 0, i32 4> |
| 134 | ; |
| 135 | %x = call <2 x i32> @llvm.cttz.v2i32(<2 x i32> <i32 255, i32 16>, i1 true) |
| 136 | ret <2 x i32> %x |
| 137 | } |
| 138 | |
| 139 | define <2 x i32> @cttz_vector_undef_defined() { |
| 140 | ; CHECK-LABEL: @cttz_vector_undef_defined( |
Nikita Popov | 9f6e9cf | 2019-01-11 21:18:00 +0000 | [diff] [blame] | 141 | ; CHECK-NEXT: ret <2 x i32> <i32 32, i32 0> |
Nikita Popov | f17421e | 2018-12-20 19:46:52 +0000 | [diff] [blame] | 142 | ; |
| 143 | %x = call <2 x i32> @llvm.cttz.v2i32(<2 x i32> <i32 0, i32 undef>, i1 false) |
| 144 | ret <2 x i32> %x |
| 145 | } |
| 146 | |
| 147 | define <2 x i32> @cttz_vector_undef_undefined() { |
| 148 | ; CHECK-LABEL: @cttz_vector_undef_undefined( |
Nikita Popov | 9f6e9cf | 2019-01-11 21:18:00 +0000 | [diff] [blame] | 149 | ; CHECK-NEXT: ret <2 x i32> undef |
Nikita Popov | f17421e | 2018-12-20 19:46:52 +0000 | [diff] [blame] | 150 | ; |
| 151 | %x = call <2 x i32> @llvm.cttz.v2i32(<2 x i32> <i32 0, i32 undef>, i1 true) |
| 152 | ret <2 x i32> %x |
| 153 | } |
| 154 | |
| 155 | define <2 x i33> @ctlz_vector() { |
| 156 | ; CHECK-LABEL: @ctlz_vector( |
| 157 | ; CHECK-NEXT: ret <2 x i33> <i33 25, i33 28> |
| 158 | ; |
| 159 | %x = call <2 x i33> @llvm.ctlz.v2i33(<2 x i33> <i33 255, i33 16>, i1 true) |
| 160 | ret <2 x i33> %x |
| 161 | } |
| 162 | |
| 163 | define <2 x i33> @ctlz_vector_undef_defined() { |
| 164 | ; CHECK-LABEL: @ctlz_vector_undef_defined( |
Nikita Popov | 9f6e9cf | 2019-01-11 21:18:00 +0000 | [diff] [blame] | 165 | ; CHECK-NEXT: ret <2 x i33> <i33 33, i33 0> |
Nikita Popov | f17421e | 2018-12-20 19:46:52 +0000 | [diff] [blame] | 166 | ; |
| 167 | %x = call <2 x i33> @llvm.ctlz.v2i33(<2 x i33> <i33 0, i33 undef>, i1 false) |
| 168 | ret <2 x i33> %x |
| 169 | } |
| 170 | |
| 171 | define <2 x i33> @ctlz_vector_undef_undefined() { |
| 172 | ; CHECK-LABEL: @ctlz_vector_undef_undefined( |
Nikita Popov | 9f6e9cf | 2019-01-11 21:18:00 +0000 | [diff] [blame] | 173 | ; CHECK-NEXT: ret <2 x i33> undef |
Nikita Popov | f17421e | 2018-12-20 19:46:52 +0000 | [diff] [blame] | 174 | ; |
| 175 | %x = call <2 x i33> @llvm.ctlz.v2i33(<2 x i33> <i33 0, i33 undef>, i1 true) |
| 176 | ret <2 x i33> %x |
| 177 | } |