1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -debugify-and-strip-all-safe -mtriple arm64-apple-ios -O0 -run-pass=aarch64-prelegalizer-combiner --aarch64prelegalizercombiner-only-enable-rule="overlapping_and" -global-isel -verify-machineinstrs %s -o - | FileCheck %s
8 ; CHECK-LABEL: name: bitmask_overlap1
9 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
10 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 128
11 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
12 ; CHECK: $w0 = COPY [[AND]](s32)
13 ; CHECK: RET_ReallyLR implicit $w0
15 %1:_(s32) = G_CONSTANT i32 -128
16 %3:_(s32) = G_CONSTANT i32 255
17 %2:_(s32) = G_AND %0, %1
18 %4:_(s32) = G_AND %2, %3
20 RET_ReallyLR implicit $w0
24 name: bitmask_overlap2
27 ; CHECK-LABEL: name: bitmask_overlap2
28 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
29 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 128
30 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
31 ; CHECK: $w0 = COPY [[AND]](s32)
32 ; CHECK: RET_ReallyLR implicit $w0
34 %1:_(s32) = G_CONSTANT i32 255
35 %3:_(s32) = G_CONSTANT i32 -128
36 %2:_(s32) = G_AND %1, %0
37 %4:_(s32) = G_AND %2, %3
39 RET_ReallyLR implicit $w0
43 name: bitmask_overlap3
46 ; CHECK-LABEL: name: bitmask_overlap3
47 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
48 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 128
49 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
50 ; CHECK: $w0 = COPY [[AND]](s32)
51 ; CHECK: RET_ReallyLR implicit $w0
53 %1:_(s32) = G_CONSTANT i32 255
54 %3:_(s32) = G_CONSTANT i32 -128
55 %2:_(s32) = G_AND %1, %0
56 %4:_(s32) = G_AND %3, %2
58 RET_ReallyLR implicit $w0
62 name: bitmask_overlap4
65 ; CHECK-LABEL: name: bitmask_overlap4
66 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
67 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 128
68 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
69 ; CHECK: $w0 = COPY [[AND]](s32)
70 ; CHECK: RET_ReallyLR implicit $w0
72 %1:_(s32) = G_CONSTANT i32 255
73 %3:_(s32) = G_CONSTANT i32 -128
74 %2:_(s32) = G_AND %0, %1
75 %4:_(s32) = G_AND %3, %2
77 RET_ReallyLR implicit $w0
81 name: bitmask_no_overlap
84 ; CHECK-LABEL: name: bitmask_no_overlap
85 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
86 ; CHECK: $w0 = COPY [[C]](s32)
87 ; CHECK: RET_ReallyLR implicit $w0
89 %1:_(s32) = G_CONSTANT i32 1
90 %3:_(s32) = G_CONSTANT i32 2
91 %2:_(s32) = G_AND %0, %1
92 %4:_(s32) = G_AND %2, %3
94 RET_ReallyLR implicit $w0
98 name: bitmask_overlap_extrause
101 ; CHECK-LABEL: name: bitmask_overlap_extrause
102 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
103 ; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $x1
104 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
105 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
106 ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 128
107 ; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C1]]
108 ; CHECK: G_STORE [[AND]](s32), [[COPY1]](p0) :: (store (s32))
109 ; CHECK: $w0 = COPY [[AND1]](s32)
110 ; CHECK: RET_ReallyLR implicit $w0
113 %2:_(s32) = G_CONSTANT i32 255
114 %4:_(s32) = G_CONSTANT i32 -128
115 %3:_(s32) = G_AND %0, %2
116 %5:_(s32) = G_AND %3, %4
117 G_STORE %3(s32), %1(p0) :: (store (s32))
119 RET_ReallyLR implicit $w0