1; NOTE: Assertions have been autogenerated by update_test_checks.py
2; This test case checks that the merge of and/xor can work on arbitrary
3; precision integers.
4
5; RUN: opt < %s -instcombine -S | FileCheck %s
6
7; (x &z ) ^ (y & z) -> (x ^ y) & z
8define i57 @test1(i57 %x, i57 %y, i57 %z) {
9; CHECK-LABEL: @test1(
10; CHECK-NEXT:    [[TMP61:%.*]] = xor i57 %x, %y
11; CHECK-NEXT:    [[TMP7:%.*]] = and i57 [[TMP61]], %z
12; CHECK-NEXT:    ret i57 [[TMP7]]
13;
14  %tmp3 = and i57 %z, %x
15  %tmp6 = and i57 %z, %y
16  %tmp7 = xor i57 %tmp3, %tmp6
17  ret i57 %tmp7
18}
19
20; (x & y) ^ (x | y) -> x ^ y
21define i23 @test2(i23 %x, i23 %y, i23 %z) {
22; CHECK-LABEL: @test2(
23; CHECK-NEXT:    [[TMP7:%.*]] = xor i23 %y, %x
24; CHECK-NEXT:    ret i23 [[TMP7]]
25;
26  %tmp3 = and i23 %y, %x
27  %tmp6 = or i23 %y, %x
28  %tmp7 = xor i23 %tmp3, %tmp6
29  ret i23 %tmp7
30}
31
32