File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
llvm/test/Transforms/InstSimplify Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2
+ ; RUN: opt < %s -instsimplify -S | FileCheck %s
3
+
4
+ ; %result = x & (1 ^ sel) = (x & 1) ^ (x & sel)
5
+ ; = x ^ (select cond, false, false)
6
+ ; = x ^ false = x
7
+ ;
8
+ define i1 @f (i1 %cond , i1 noundef %x , i1 %y , i1 %z ) {
9
+ ; CHECK-LABEL: @f(
10
+ ; CHECK-NEXT: ret i1 [[X:%.*]]
11
+ ;
12
+ %notx = xor i1 %x , 1
13
+ %lhs = and i1 %notx , %y
14
+ %rhs = and i1 %notx , %z
15
+ %sel = select i1 %cond , i1 %lhs , i1 %rhs
16
+ %op1 = xor i1 1 , %sel
17
+ %result = and i1 %x , %op1
18
+ ret i1 %result
19
+ }
20
+
21
+ define i1 @f_dontfold (i1 %cond , i1 %x , i1 %y , i1 %z ) {
22
+ ; CHECK-LABEL: @f_dontfold(
23
+ ; CHECK-NEXT: ret i1 [[X:%.*]]
24
+ ;
25
+ %notx = xor i1 %x , 1
26
+ %lhs = and i1 %notx , %y
27
+ %rhs = and i1 %notx , %z
28
+ %sel = select i1 %cond , i1 %lhs , i1 %rhs
29
+ %op1 = xor i1 1 , %sel
30
+ %result = and i1 %x , %op1
31
+ ret i1 %result
32
+ }
You can’t perform that action at this time.
0 commit comments