aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/CodeGen/AArch64/peephole-opt-analyzeCompare-subreg-use.mir
blob: c9d6bc7cc8f87a2bf980c5b7ff00751af7d16f20 (plain)
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
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5
# RUN: llc -mtriple=aarch64-- -run-pass=peephole-opt -o - %s | FileCheck %s

# Make sure that analyzeCompare doesn't produce illegal folds due to
# ignoring the subregister index on the use operands.

---
name:            analyze_compare_subreg_use_lhs
tracksRegLiveness: true
body:             |
  bb.0:
    liveins: $x0, $x1

    ; CHECK-LABEL: name: analyze_compare_subreg_use_lhs
    ; CHECK: liveins: $x0, $x1
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY $x1
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64 = COPY $x0
    ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr32 = COPY $wzr
    ; CHECK-NEXT: [[SUBSWrr:%[0-9]+]]:gpr32 = SUBSWrr [[COPY]].sub_32, [[COPY2]], implicit-def dead $nzcv
    ; CHECK-NEXT: [[DEF:%[0-9]+]]:gpr64all = IMPLICIT_DEF
    ; CHECK-NEXT: [[INSERT_SUBREG:%[0-9]+]]:gpr64 = INSERT_SUBREG [[DEF]], killed [[SUBSWrr]], %subreg.sub_32
    ; CHECK-NEXT: [[RORVXr:%[0-9]+]]:gpr64 = RORVXr [[COPY1]], killed [[INSERT_SUBREG]]
    ; CHECK-NEXT: $x0 = COPY [[RORVXr]]
    ; CHECK-NEXT: RET_ReallyLR implicit $x0
    %0:gpr64 = COPY $x1
    %1:gpr64 = COPY $x0
    %2:gpr32 = COPY $wzr
    %3:gpr32 = SUBSWrr %0.sub_32, %2, implicit-def dead $nzcv
    %4:gpr64all = IMPLICIT_DEF
    %5:gpr64 = INSERT_SUBREG %4, killed %3, %subreg.sub_32
    %6:gpr64 = RORVXr %1, killed %5
    $x0 = COPY %6
    RET_ReallyLR implicit $x0

...

---
name:            analyze_compare_subreg_use_rhs
tracksRegLiveness: true
body:             |
  bb.0:
    liveins: $x0, $x1

    ; CHECK-LABEL: name: analyze_compare_subreg_use_rhs
    ; CHECK: liveins: $x0, $x1
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY $x1
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64 = COPY $x0
    ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr32 = COPY $wzr
    ; CHECK-NEXT: [[SUBSWrr:%[0-9]+]]:gpr32 = SUBSWrr [[COPY2]], [[COPY]].sub_32, implicit-def dead $nzcv
    ; CHECK-NEXT: [[DEF:%[0-9]+]]:gpr64all = IMPLICIT_DEF
    ; CHECK-NEXT: [[INSERT_SUBREG:%[0-9]+]]:gpr64 = INSERT_SUBREG [[DEF]], killed [[SUBSWrr]], %subreg.sub_32
    ; CHECK-NEXT: [[RORVXr:%[0-9]+]]:gpr64 = RORVXr [[COPY1]], killed [[INSERT_SUBREG]]
    ; CHECK-NEXT: $x0 = COPY [[RORVXr]]
    ; CHECK-NEXT: RET_ReallyLR implicit $x0
    %0:gpr64 = COPY $x1
    %1:gpr64 = COPY $x0
    %2:gpr32 = COPY $wzr
    %3:gpr32 = SUBSWrr %2, %0.sub_32, implicit-def dead $nzcv
    %4:gpr64all = IMPLICIT_DEF
    %5:gpr64 = INSERT_SUBREG %4, killed %3, %subreg.sub_32
    %6:gpr64 = RORVXr %1, killed %5
    $x0 = COPY %6
    RET_ReallyLR implicit $x0

...