postlegalizercombiner-hoist-same-hands.mir
1.87 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
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple aarch64 -run-pass=aarch64-postlegalizer-combiner -verify-machineinstrs %s -o - | FileCheck %s
...
---
name: or_combine_sext
tracksRegLiveness: true
legalized: true
body: |
bb.0:
liveins: $w0, $w1
; or (sext X), (sext Y) --> sext (or X, Y)
;
; CHECK-LABEL: name: or_combine_sext
; CHECK: liveins: $w0, $w1
; CHECK: %x:_(s32) = COPY $w0
; CHECK: %y:_(s32) = COPY $w1
; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR %x, %y
; CHECK: %logic_op:_(s64) = G_SEXT [[OR]](s32)
; CHECK: $x0 = COPY %logic_op(s64)
; CHECK: RET_ReallyLR implicit $x0
%x:_(s32) = COPY $w0
%y:_(s32) = COPY $w1
%hand1:_(s64) = G_SEXT %x(s32)
%hand2:_(s64) = G_SEXT %y(s32)
%logic_op:_(s64) = G_OR %hand1, %hand2
$x0 = COPY %logic_op(s64)
RET_ReallyLR implicit $x0
...
---
name: illegal_ty
tracksRegLiveness: true
legalized: true
body: |
bb.0:
liveins: $w0, $w1
; Post-legalization, we should not perform the optimization here, since
; it would create an illegal G_OR.
;
; CHECK-LABEL: name: illegal_ty
; CHECK: liveins: $w0, $w1
; CHECK: %x_wide:_(s32) = COPY $w0
; CHECK: %y_wide:_(s32) = COPY $w1
; CHECK: %x:_(s1) = G_TRUNC %x_wide(s32)
; CHECK: %y:_(s1) = G_TRUNC %y_wide(s32)
; CHECK: %hand1:_(s64) = G_SEXT %x(s1)
; CHECK: %hand2:_(s64) = G_SEXT %y(s1)
; CHECK: %logic_op:_(s64) = G_OR %hand1, %hand2
; CHECK: $x0 = COPY %logic_op(s64)
; CHECK: RET_ReallyLR implicit $x0
%x_wide:_(s32) = COPY $w0
%y_wide:_(s32) = COPY $w1
%x:_(s1) = G_TRUNC %x_wide
%y:_(s1) = G_TRUNC %y_wide
%hand1:_(s64) = G_SEXT %x(s1)
%hand2:_(s64) = G_SEXT %y(s1)
%logic_op:_(s64) = G_OR %hand1, %hand2
$x0 = COPY %logic_op(s64)
RET_ReallyLR implicit $x0