misched-fusion-arith-logic.mir
4.1 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# RUN: llc -o /dev/null 2>&1 %s -mtriple aarch64-unknown -mattr=fuse-arith-logic -run-pass=machine-scheduler -misched-print-dags | FileCheck %s
# RUN: llc -o /dev/null 2>&1 %s -mtriple aarch64-unknown -mcpu=exynos-m4 -run-pass=machine-scheduler -misched-print-dags | FileCheck %s
# REQUIRES: asserts
---
name: arith
body: |
bb.0.entry:
%0:gpr32 = SUBWrr undef $w0, undef $w1
%1:gpr32 = ADDWrr undef $w1, undef $w2
%2:gpr32 = SUBWrs %0, undef $w2, 0
%3:gpr32 = ADDWrs %1, undef $w3, 0
; CHECK: SU(0): %0:gpr32 = SUBWrr undef $w0, undef $w1
; CHECK: Successors:
; CHECK: SU(2): Ord Latency=0 Cluster
; CHECK: SU(1): %1:gpr32 = ADDWrr undef $w1, undef $w2
; CHECK: Successors:
; CHECK: SU(3): Ord Latency=0 Cluster
; CHECK: SU(2): dead %2:gpr32 = SUBWrs %0:gpr32, undef $w2, 0
; CHECK: Predecessors:
; CHECK: SU(0): Ord Latency=0 Cluster
; CHECK: SU(3): dead %3:gpr32 = ADDWrs %1:gpr32, undef $w3, 0
; CHECK: Predecessors:
; CHECK: SU(1): Ord Latency=0 Cluster
...
---
name: compare
body: |
bb.0.entry:
%0:gpr64 = ADDXrr undef $x0, undef $x1
%1:gpr64 = SUBXrs undef $x1, undef $x2, 0
%2:gpr64 = ADDSXrr %0, undef $x3, implicit-def $nzcv
%3:gpr64 = SUBSXrs %1, undef $x4, 0, implicit-def $nzcv
; CHECK: SU(0): %0:gpr64 = ADDXrr undef $x0, undef $x1
; CHECK: Successors:
; CHECK: SU(2): Ord Latency=0 Cluster
; CHECK: SU(1): %1:gpr64 = SUBXrs undef $x1, undef $x2, 0
; CHECK: Successors:
; CHECK: SU(3): Ord Latency=0 Cluster
; CHECK: SU(2): dead %2:gpr64 = ADDSXrr %0:gpr64, undef $x3, implicit-def $nzcv
; CHECK: Predecessors:
; CHECK: SU(0): Ord Latency=0 Cluster
; CHECK: SU(3): dead %3:gpr64 = SUBSXrs %1:gpr64, undef $x4, 0, implicit-def $nzcv
; CHECK: Predecessors:
; CHECK: SU(1): Ord Latency=0 Cluster
...
---
name: logic
body: |
bb.0.entry:
%0:gpr32 = ADDWrr undef $w0, undef $w1
%1:gpr64 = SUBXrs undef $x1, undef $x2, 0
%3:gpr32 = ANDWrs %0, undef $w3, 0
%4:gpr64 = ORRXrr %1, undef $x4
; CHECK: SU(0): %0:gpr32 = ADDWrr undef $w0, undef $w1
; CHECK: Successors:
; CHECK: SU(2): Ord Latency=0 Cluster
; CHECK: SU(1): %1:gpr64 = SUBXrs undef $x1, undef $x2, 0
; CHECK: Successors:
; CHECK: SU(3): Ord Latency=0 Cluster
; CHECK: SU(2): dead %2:gpr32 = ANDWrs %0:gpr32, undef $w3, 0
; CHECK: Predecessors:
; CHECK: SU(0): Ord Latency=0 Cluster
; CHECK: SU(3): dead %3:gpr64 = ORRXrr %1:gpr64, undef $x4
; CHECK: Predecessors:
; CHECK: SU(1): Ord Latency=0 Cluster
...
---
name: nope
body: |
bb.0.entry:
; Shifted register.
%0:gpr32 = SUBWrr undef $w0, undef $w1
%1:gpr32 = SUBWrs %0, undef $w2, 1
; CHECK: SU(0): %0:gpr32 = SUBWrr undef $w0, undef $w1
; CHECK: Successors:
; CHECK-NOT: SU(1): Ord Latency=0 Cluster
; CHECK: SU(1): dead %1:gpr32 = SUBWrs %0:gpr32, undef $w2, 1
; Multiple successors.
%2:gpr64 = ADDXrr undef $x0, undef $x1
%3:gpr32 = EXTRACT_SUBREG %2, %subreg.sub_32
%4:gpr32 = ANDWrs %3, undef $w2, 0
%5:gpr64 = ADDSXrr %2, undef $x3, implicit-def $nzcv
; CHECK: SU(2): %2:gpr64 = ADDXrr undef $x0, undef $x1
; CHECK: Successors:
; CHECK-NOT: SU(3): Ord Latency=0 Cluster
; CHECK: SU(5): Ord Latency=0 Cluster
; CHECK: SU(3): %3:gpr32 = EXTRACT_SUBREG %2:gpr64, %subreg.sub_32
; CHECK: SU(5): dead %5:gpr64 = ADDSXrr %2:gpr64, undef $x3, implicit-def $nzcv
; Different register sizes.
%6:gpr32 = SUBWrr undef $w0, undef $w1
%7:gpr64 = ADDXrr undef $x1, undef $x2
%8:gpr64 = SUBXrr %7, undef $x3
%9:gpr32 = ADDWrr %6, undef $w4
; CHECK: SU(6): %6:gpr32 = SUBWrr undef $w0, undef $w1
; CHECK: Successors:
; CHECK-NOT: SU(8): Ord Latency=0 Cluster
; CHECK: SU(7): %7:gpr64 = ADDXrr undef $x1, undef $x2
; CHECK: Successors:
; CHECK-NOT: SU(9): Ord Latency=0 Cluster
; CHECK: SU(8): dead %8:gpr64 = SUBXrr %7:gpr64, undef $x3
; CHECK: Predecessors:
; CHECK: SU(7): Ord Latency=0 Cluster
; CHECK: SU(9): dead %9:gpr32 = ADDWrr %6:gpr32, undef $w4
; CHECK: Predecessors:
; CHECK: SU(6): Ord Latency=0 Cluster
...