1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instsimplify -S | FileCheck %s
4 ; %result = x & (1 ^ sel) = (x & 1) ^ (x & sel)
5 ; = x ^ (select cond, false, false)
8 define i1 @f(i1 %cond, i1 noundef %x, i1 %y, i1 %z) {
10 ; CHECK-NEXT: ret i1 [[X:%.*]]
13 %lhs = and i1 %notx, %y
14 %rhs = and i1 %notx, %z
15 %sel = select i1 %cond, i1 %lhs, i1 %rhs
17 %result = and i1 %x, %op1
21 define i1 @f_dontfold(i1 %cond, i1 %x, i1 %y, i1 %z) {
22 ; CHECK-LABEL: @f_dontfold(
23 ; CHECK-NEXT: ret i1 [[X:%.*]]
26 %lhs = and i1 %notx, %y
27 %rhs = and i1 %notx, %z
28 %sel = select i1 %cond, i1 %lhs, i1 %rhs
30 %result = and i1 %x, %op1