1 ; RUN: opt < %s -instsimplify -S | FileCheck %s
3 ; Test the case where integer BitWidth <= 64 && BitWidth % 2 != 0.
4 define i39 @test1(i39 %V, i39 %M) {
5 ;; If we have: ((V + N) & C1) | (V & C2)
6 ;; .. and C2 = ~C1 and C2 is 0+1+ and (N & C2) == 0
8 %C1 = xor i39 274877906943, -1 ;; C2 = 274877906943
9 %N = and i39 %M, 274877906944
12 %D = and i39 %V, 274877906943
16 ; CHECK-NEXT: and {{.*}}, -274877906944
21 define i7 @test2(i7 %X) {
25 ; CHECK-NEXT: ret i7 %X
28 define i17 @test3(i17 %X) {
32 ; CHECK-NEXT: ret i17 -1
35 ; Test the case where Integer BitWidth > 64 && BitWidth <= 1024.
36 define i399 @test4(i399 %V, i399 %M) {
37 ;; If we have: ((V + N) & C1) | (V & C2)
38 ;; .. and C2 = ~C1 and C2 is 0+1+ and (N & C2) == 0
40 %C1 = xor i399 274877906943, -1 ;; C2 = 274877906943
41 %N = and i399 %M, 18446742974197923840
44 %D = and i399 %V, 274877906943
48 ; CHECK-NEXT: and {{.*}}, 18446742974197923840
53 define i777 @test5(i777 %X) {
57 ; CHECK-NEXT: ret i777 %X
60 define i117 @test6(i117 %X) {
64 ; CHECK-NEXT: ret i117 -1