1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -instcombine -S | FileCheck %s
4 define i23 @test1(i23 %A) {
6 ; CHECK-NEXT: ret i23 0
12 define i47 @test2(i47 %A) {
13 ; CHECK-LABEL: @test2(
14 ; CHECK-NEXT: ret i47 %A
20 define i97 @test3(i97 %A) {
21 ; CHECK-LABEL: @test3(
22 ; CHECK-NEXT: ret i97 %A
29 define i108 @test4(i108 %A, i108 %x) {
30 ; CHECK-LABEL: @test4(
31 ; CHECK-NEXT: [[C:%.*]] = add i108 %x, %A
32 ; CHECK-NEXT: ret i108 [[C]]
39 define i19 @test5(i19 %A, i19 %Bok, i19 %Cok) {
40 ; CHECK-LABEL: @test5(
41 ; CHECK-NEXT: [[D1:%.*]] = sub i19 %Cok, %Bok
42 ; CHECK-NEXT: [[E:%.*]] = add i19 [[D1]], %A
43 ; CHECK-NEXT: ret i19 [[E]]
45 %D = sub i19 %Bok, %Cok
50 define i57 @test6(i57 %A, i57 %B) {
51 ; CHECK-LABEL: @test6(
52 ; CHECK-NEXT: [[B_NOT:%.*]] = xor i57 %B, -1
53 ; CHECK-NEXT: [[D:%.*]] = and i57 [[B_NOT]], %A
54 ; CHECK-NEXT: ret i57 [[D]]
61 define i77 @test7(i77 %A) {
62 ; CHECK-LABEL: @test7(
63 ; CHECK-NEXT: [[B:%.*]] = xor i77 %A, -1
64 ; CHECK-NEXT: ret i77 [[B]]
70 define i27 @test8(i27 %A) {
71 ; CHECK-LABEL: @test8(
72 ; CHECK-NEXT: [[C:%.*]] = shl i27 %A, 3
73 ; CHECK-NEXT: ret i27 [[C]]
80 define i42 @test9(i42 %A) {
81 ; CHECK-LABEL: @test9(
82 ; CHECK-NEXT: [[C:%.*]] = mul i42 %A, -2
83 ; CHECK-NEXT: ret i42 [[C]]
90 define i1 @test11(i9 %A, i9 %B) {
91 ; CHECK-LABEL: @test11(
92 ; CHECK-NEXT: [[CD:%.*]] = icmp ne i9 %A, %B
93 ; CHECK-NEXT: ret i1 [[CD]]
96 %cD = icmp ne i9 %C, 0
100 define i43 @test12(i43 %A) {
101 ; CHECK-LABEL: @test12(
102 ; CHECK-NEXT: [[C:%.*]] = lshr i43 %A, 42
103 ; CHECK-NEXT: ret i43 [[C]]
110 define i79 @test13(i79 %A) {
111 ; CHECK-LABEL: @test13(
112 ; CHECK-NEXT: [[C:%.*]] = ashr i79 %A, 78
113 ; CHECK-NEXT: ret i79 [[C]]
120 define i1024 @test14(i1024 %A) {
121 ; CHECK-LABEL: @test14(
122 ; CHECK-NEXT: [[D:%.*]] = ashr i1024 %A, 1023
123 ; CHECK-NEXT: ret i1024 [[D]]
125 %B = lshr i1024 %A, 1023
126 %C = bitcast i1024 %B to i1024
131 define i51 @test16(i51 %A) {
132 ; CHECK-LABEL: @test16(
133 ; CHECK-NEXT: [[Y:%.*]] = sdiv i51 %A, -1123
134 ; CHECK-NEXT: ret i51 [[Y]]
136 %X = sdiv i51 %A, 1123
141 ; Can't fold subtract here because negation might overflow.
143 define i25 @test17(i25 %Aok) {
144 ; CHECK-LABEL: @test17(
145 ; CHECK-NEXT: [[B:%.*]] = sub i25 0, %Aok
146 ; CHECK-NEXT: [[C:%.*]] = sdiv i25 [[B]], 1234
147 ; CHECK-NEXT: ret i25 [[C]]
150 %C = sdiv i25 %B, 1234
154 define i128 @test18(i128 %Y) {
155 ; CHECK-LABEL: @test18(
156 ; CHECK-NEXT: ret i128 0
160 %t3 = sub i128 %t1, %t2
164 define i39 @test19(i39 %X, i39 %Y) {
165 ; CHECK-LABEL: @test19(
166 ; CHECK-NEXT: ret i39 %X
173 define i1 @test20(i33 %g, i33 %h) {
174 ; CHECK-LABEL: @test20(
175 ; CHECK-NEXT: [[T4:%.*]] = icmp ne i33 %h, 0
176 ; CHECK-NEXT: ret i1 [[T4]]
179 %t4 = icmp ne i33 %t2, %g
183 define i1 @test21(i256 %g, i256 %h) {
184 ; CHECK-LABEL: @test21(
185 ; CHECK-NEXT: [[T4:%.*]] = icmp ne i256 %h, 0
186 ; CHECK-NEXT: ret i1 [[T4]]
188 %t2 = sub i256 %g, %h
189 %t4 = icmp ne i256 %t2, %g