1 ; RUN: opt < %s -instcombine -S | FileCheck %s
3 ; These tests are for Integer BitWidth <= 64 && BitWidth % 2 != 0.
4 define i23 @test1(i23 %A) {
10 ; CHECK-NEXT: ret i23 -1
13 define i39 @test2(i39 %V, i39 %M) {
14 ;; If we have: ((V + N) & C1) | (V & C2)
15 ;; .. and C2 = ~C1 and C2 is 0+1+ and (N & C2) == 0
17 %C1 = xor i39 274877906943, -1 ;; C2 = 274877906943
18 %N = and i39 %M, 274877906944
21 %D = and i39 %V, 274877906943
25 ; CHECK-NEXT: %N = and i39 %M, -274877906944
26 ; CHECK-NEXT: %A = add i39 %N, %V
27 ; CHECK-NEXT: ret i39 %A
30 ; These tests are for Integer BitWidth > 64 && BitWidth <= 1024.
31 define i1023 @test4(i1023 %A) {
33 %NotA = xor i1023 -1, %A
34 %B = or i1023 %A, %NotA
37 ; CHECK-NEXT: ret i1023 -1
40 define i399 @test5(i399 %V, i399 %M) {
41 ;; If we have: ((V + N) & C1) | (V & C2)
42 ;; .. and C2 = ~C1 and C2 is 0+1+ and (N & C2) == 0
44 %C1 = xor i399 274877906943, -1 ;; C2 = 274877906943
45 %N = and i399 %M, 18446742974197923840
48 %D = and i399 %V, 274877906943
52 ; CHECK-NEXT: %N = and i399 %M, 18446742974197923840
53 ; CHECK-NEXT: %A = add i399 %N, %V
54 ; CHECK-NEXT: ret i399 %A