prelegalizercombiner-ptradd-chain.mir
2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple aarch64-apple-ios -run-pass=aarch64-prelegalizer-combiner %s -o - -verify-machineinstrs | FileCheck %s
# Check that we fold two adds of constant offsets with G_PTR_ADD into a single G_PTR_ADD.
---
name: ptradd_chain
tracksRegLiveness: true
body: |
bb.1:
liveins: $x0
; CHECK-LABEL: name: ptradd_chain
; CHECK: liveins: $x0
; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 16
; CHECK: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C]](s64)
; CHECK: $x0 = COPY [[PTR_ADD]](p0)
; CHECK: RET_ReallyLR implicit $x0
%0:_(p0) = COPY $x0
%1:_(s64) = G_CONSTANT i64 4
%2:_(s64) = G_CONSTANT i64 12
%3:_(p0) = G_PTR_ADD %0(p0), %1
%4:_(p0) = G_PTR_ADD %3(p0), %2
$x0 = COPY %4(p0)
RET_ReallyLR implicit $x0
...
---
name: ptradd_chain_2
tracksRegLiveness: true
body: |
bb.1:
liveins: $x0
; CHECK-LABEL: name: ptradd_chain_2
; CHECK: liveins: $x0
; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 28
; CHECK: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C]](s64)
; CHECK: $x0 = COPY [[PTR_ADD]](p0)
; CHECK: RET_ReallyLR implicit $x0
%0:_(p0) = COPY $x0
%1:_(s64) = G_CONSTANT i64 4
%2:_(s64) = G_CONSTANT i64 12
%3:_(p0) = G_PTR_ADD %0(p0), %1
%4:_(p0) = G_PTR_ADD %3(p0), %2
%5:_(p0) = G_PTR_ADD %4(p0), %2
$x0 = COPY %5(p0)
RET_ReallyLR implicit $x0
...
---
name: ptradd_chain_lookthough
tracksRegLiveness: true
body: |
bb.1:
liveins: $x0
; CHECK-LABEL: name: ptradd_chain_lookthough
; CHECK: liveins: $x0
; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 28
; CHECK: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C]](s64)
; CHECK: $x0 = COPY [[PTR_ADD]](p0)
; CHECK: RET_ReallyLR implicit $x0
%0:_(p0) = COPY $x0
%1:_(s64) = G_CONSTANT i64 4
%2:_(s64) = G_CONSTANT i64 12
%6:_(s32) = G_TRUNC %2(s64)
%7:_(s64) = G_SEXT %6(s32)
%3:_(p0) = G_PTR_ADD %0(p0), %1
%4:_(p0) = G_PTR_ADD %3(p0), %2
%5:_(p0) = G_PTR_ADD %4(p0), %7
$x0 = COPY %5(p0)
RET_ReallyLR implicit $x0
...