Skip to content

Commit f557672

Browse files
committed
[Reassociate] Add tests with disjoint OR.
1 parent f9f69da commit f557672

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2+
; RUN: opt -passes=reassociate -S %s | FileCheck %s
3+
4+
5+
define i16 @or_disjoint_both(i16 %a, i16 %b) {
6+
; CHECK-LABEL: @or_disjoint_both(
7+
; CHECK-NEXT: [[OR_1:%.*]] = or i16 [[A:%.*]], 1
8+
; CHECK-NEXT: [[OR_2:%.*]] = or i16 [[OR_1]], [[B:%.*]]
9+
; CHECK-NEXT: ret i16 [[OR_2]]
10+
;
11+
%or.1 = or disjoint i16 %b, %a
12+
%or.2 = or disjoint i16 %or.1, 1
13+
ret i16 %or.2
14+
}
15+
16+
define i16 @or_disjoint_first(i16 %a, i16 %b) {
17+
; CHECK-LABEL: @or_disjoint_first(
18+
; CHECK-NEXT: [[OR_1:%.*]] = or i16 [[A:%.*]], 1
19+
; CHECK-NEXT: [[OR_2:%.*]] = or i16 [[OR_1]], [[B:%.*]]
20+
; CHECK-NEXT: ret i16 [[OR_2]]
21+
;
22+
%or.1 = or i16 %b, %a
23+
%or.2 = or disjoint i16 %or.1, 1
24+
ret i16 %or.2
25+
}
26+
27+
define i16 @or_disjoint_last(i16 %a, i16 %b) {
28+
; CHECK-LABEL: @or_disjoint_last(
29+
; CHECK-NEXT: [[OR_1:%.*]] = or i16 [[A:%.*]], 1
30+
; CHECK-NEXT: [[OR_2:%.*]] = or i16 [[OR_1]], [[B:%.*]]
31+
; CHECK-NEXT: ret i16 [[OR_2]]
32+
;
33+
%or.1 = or disjoint i16 %b, %a
34+
%or.2 = or i16 %or.1, 1
35+
ret i16 %or.2
36+
}
37+

0 commit comments

Comments
 (0)