xref: /llvm-project/llvm/test/CodeGen/AArch64/GlobalISel/combine-and-or-disjoint-mask.mir (revision 655714a300ff303a1f283718c34d9e27e096b319)
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2
3# RUN: llc -mtriple aarch64 -run-pass=aarch64-prelegalizer-combiner --aarch64prelegalizercombiner-only-enable-rule="and_or_disjoint_mask" -global-isel -verify-machineinstrs %s -o - | FileCheck %s
4# REQUIRES: asserts
5
6...
7---
8name:            disjoint_masks
9tracksRegLiveness: true
10machineFunctionInfo: {}
11body:             |
12  bb.0:
13    liveins: $w0
14    ; CHECK-LABEL: name: disjoint_masks
15    ; CHECK: liveins: $w0
16    ; CHECK-NEXT: {{  $}}
17    ; CHECK-NEXT: %x:_(s32) = COPY $w0
18    ; CHECK-NEXT: %two:_(s32) = G_CONSTANT i32 2
19    ; CHECK-NEXT: %and:_(s32) = G_AND %x, %two
20    ; CHECK-NEXT: $w0 = COPY %and(s32)
21    ; CHECK-NEXT: RET_ReallyLR implicit $w0
22    %x:_(s32) = COPY $w0
23    %one:_(s32) = G_CONSTANT i32 1
24    %two:_(s32) = G_CONSTANT i32 2
25    %or:_(s32) = G_OR %x, %one
26    %and:_(s32) = G_AND %or, %two
27    $w0 = COPY %and(s32)
28    RET_ReallyLR implicit $w0
29...
30---
31name:            disjoint_masks_rev
32tracksRegLiveness: true
33machineFunctionInfo: {}
34body:             |
35  bb.0:
36    liveins: $w0
37    ; CHECK-LABEL: name: disjoint_masks_rev
38    ; CHECK: liveins: $w0
39    ; CHECK-NEXT: {{  $}}
40    ; CHECK-NEXT: %x:_(s32) = COPY $w0
41    ; CHECK-NEXT: %two:_(s32) = G_CONSTANT i32 2
42    ; CHECK-NEXT: %and:_(s32) = G_AND %x, %two
43    ; CHECK-NEXT: $w0 = COPY %and(s32)
44    ; CHECK-NEXT: RET_ReallyLR implicit $w0
45    %x:_(s32) = COPY $w0
46    %one:_(s32) = G_CONSTANT i32 1
47    %two:_(s32) = G_CONSTANT i32 2
48    %or:_(s32) = G_OR %x, %one
49    %and:_(s32) = G_AND %two, %or
50    $w0 = COPY %and(s32)
51    RET_ReallyLR implicit $w0
52...
53---
54name:            intersecting_masks
55tracksRegLiveness: true
56machineFunctionInfo: {}
57body:             |
58  bb.0:
59    liveins: $w0
60    ; CHECK-LABEL: name: intersecting_masks
61    ; CHECK: liveins: $w0
62    ; CHECK-NEXT: {{  $}}
63    ; CHECK-NEXT: %x:_(s32) = COPY $w0
64    ; CHECK-NEXT: %one:_(s32) = G_CONSTANT i32 3
65    ; CHECK-NEXT: %two:_(s32) = G_CONSTANT i32 2
66    ; CHECK-NEXT: %or:_(s32) = G_OR %x, %one
67    ; CHECK-NEXT: %and:_(s32) = G_AND %or, %two
68    ; CHECK-NEXT: $w0 = COPY %and(s32)
69    ; CHECK-NEXT: RET_ReallyLR implicit $w0
70    %x:_(s32) = COPY $w0
71    %one:_(s32) = G_CONSTANT i32 3
72    %two:_(s32) = G_CONSTANT i32 2
73    %or:_(s32) = G_OR %x, %one
74    %and:_(s32) = G_AND %or, %two
75    $w0 = COPY %and(s32)
76    RET_ReallyLR implicit $w0
77...
78---
79name:            intersecting_masks_rev
80tracksRegLiveness: true
81machineFunctionInfo: {}
82body:             |
83  bb.0:
84    liveins: $w0
85    ; CHECK-LABEL: name: intersecting_masks_rev
86    ; CHECK: liveins: $w0
87    ; CHECK-NEXT: {{  $}}
88    ; CHECK-NEXT: %x:_(s32) = COPY $w0
89    ; CHECK-NEXT: %one:_(s32) = G_CONSTANT i32 3
90    ; CHECK-NEXT: %two:_(s32) = G_CONSTANT i32 2
91    ; CHECK-NEXT: %or:_(s32) = G_OR %x, %one
92    ; CHECK-NEXT: %and:_(s32) = G_AND %two, %or
93    ; CHECK-NEXT: $w0 = COPY %and(s32)
94    ; CHECK-NEXT: RET_ReallyLR implicit $w0
95    %x:_(s32) = COPY $w0
96    %one:_(s32) = G_CONSTANT i32 3
97    %two:_(s32) = G_CONSTANT i32 2
98    %or:_(s32) = G_OR %x, %one
99    %and:_(s32) = G_AND %two, %or
100    $w0 = COPY %and(s32)
101    RET_ReallyLR implicit $w0
102...
103---
104name:            disjoint_masks_v
105tracksRegLiveness: true
106machineFunctionInfo: {}
107body:             |
108  bb.0:
109    liveins: $x0
110    ; CHECK-LABEL: name: disjoint_masks_v
111    ; CHECK: liveins: $x0
112    ; CHECK-NEXT: {{  $}}
113    ; CHECK-NEXT: %x:_(<2 x s32>) = COPY $x0
114    ; CHECK-NEXT: %one:_(s32) = G_CONSTANT i32 1
115    ; CHECK-NEXT: %one_v:_(<2 x s32>) = G_DUP %one(s32)
116    ; CHECK-NEXT: %two:_(s32) = G_CONSTANT i32 2
117    ; CHECK-NEXT: %two_v:_(<2 x s32>) = G_DUP %two(s32)
118    ; CHECK-NEXT: %or:_(<2 x s32>) = G_OR %x, %one_v
119    ; CHECK-NEXT: %and:_(<2 x s32>) = G_AND %or, %two_v
120    ; CHECK-NEXT: $x0 = COPY %and(<2 x s32>)
121    ; CHECK-NEXT: RET_ReallyLR implicit $x0
122    %x:_(<2 x s32>) = COPY $x0
123    %one:_(s32) = G_CONSTANT i32 1
124    %one_v:_(<2 x s32>) = G_DUP %one
125    %two:_(s32) = G_CONSTANT i32 2
126    %two_v:_(<2 x s32>) = G_DUP %two
127    %or:_(<2 x s32>) = G_OR %x, %one_v
128    %and:_(<2 x s32>) = G_AND %or, %two_v
129    $x0 = COPY %and(<2 x s32>)
130    RET_ReallyLR implicit $x0
131...
132