File: peephole-csel.mir

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,696 kB
  • sloc: cpp: 7,438,781; ansic: 1,393,871; asm: 1,012,926; python: 241,771; f90: 86,635; objc: 75,411; lisp: 42,144; pascal: 17,286; sh: 8,596; ml: 5,082; perl: 4,730; makefile: 3,591; awk: 3,523; javascript: 2,251; xml: 892; fortran: 672
file content (112 lines) | stat: -rw-r--r-- 3,609 bytes parent folder | download | duplicates (5)
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
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc %s -o - -mtriple=aarch64-unknown-linux -run-pass=aarch64-mi-peephole-opt -verify-machineinstrs | FileCheck %s

---
name:            peephole_cselxr_same
registers:
  - { id: 1, class: gpr64, preferred-register: '' }
  - { id: 2, class: gpr64, preferred-register: '' }
liveins:
  - { reg: '$x0', virtual-reg: '%1' }
  - { reg: '$x1', virtual-reg: '%2' }
body:             |
  bb.0.entry:
    liveins: $x0, $x1

    ; CHECK-LABEL: name: peephole_cselxr_same
    ; CHECK: liveins: $x0, $x1
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY $x1
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64 = COPY $x0
    ; CHECK-NEXT: $xzr = ANDSXri [[COPY]], 0, implicit-def $nzcv
    ; CHECK-NEXT: [[ORRXrs:%[0-9]+]]:gpr64 = ORRXrs $xzr, [[COPY1]], 0
    ; CHECK-NEXT: RET_ReallyLR
    %3:gpr64 = COPY $x1
    %4:gpr64 = COPY $x0
    $xzr = ANDSXri %3, 0, implicit-def $nzcv
    %5:gpr64 = CSELXr %4, %4, 0, implicit $nzcv
    RET_ReallyLR

...
---
name:            peephole_cselwr_same
registers:
  - { id: 1, class: gpr32, preferred-register: '' }
  - { id: 2, class: gpr32, preferred-register: '' }
liveins:
  - { reg: '$w0', virtual-reg: '%1' }
  - { reg: '$w1', virtual-reg: '%2' }
body:             |
  bb.0.entry:
    liveins: $w0, $w1

    ; CHECK-LABEL: name: peephole_cselwr_same
    ; CHECK: liveins: $w0, $w1
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $w1
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $w0
    ; CHECK-NEXT: $wzr = ANDSWri [[COPY]], 0, implicit-def $nzcv
    ; CHECK-NEXT: [[ORRWrs:%[0-9]+]]:gpr32 = ORRWrs $wzr, [[COPY1]], 0
    ; CHECK-NEXT: RET_ReallyLR
    %3:gpr32 = COPY $w1
    %4:gpr32 = COPY $w0
    $wzr = ANDSWri %3, 0, implicit-def $nzcv
    %5:gpr32 = CSELWr %4, %4, 0, implicit $nzcv
    RET_ReallyLR

...
---
name:            peephole_cselxr_different
registers:
  - { id: 1, class: gpr64, preferred-register: '' }
  - { id: 2, class: gpr64, preferred-register: '' }
liveins:
  - { reg: '$x0', virtual-reg: '%1' }
  - { reg: '$x1', virtual-reg: '%2' }
body:             |
  bb.0.entry:
    liveins: $x0, $x1

    ; CHECK-LABEL: name: peephole_cselxr_different
    ; CHECK: liveins: $x0, $x1
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY $x1
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64 = COPY $x0
    ; CHECK-NEXT: $xzr = ANDSXri [[COPY]], 0, implicit-def $nzcv
    ; CHECK-NEXT: [[CSELXr:%[0-9]+]]:gpr64 = CSELXr [[COPY]], [[COPY1]], 0, implicit $nzcv
    ; CHECK-NEXT: RET_ReallyLR
    %3:gpr64 = COPY $x1
    %4:gpr64 = COPY $x0
    $xzr = ANDSXri %3, 0, implicit-def $nzcv
    %5:gpr64 = CSELXr %3, %4, 0, implicit $nzcv
    RET_ReallyLR

...
---
name:            peephole_cselwr_different
registers:
  - { id: 1, class: gpr32, preferred-register: '' }
  - { id: 2, class: gpr32, preferred-register: '' }
liveins:
  - { reg: '$w0', virtual-reg: '%1' }
  - { reg: '$w1', virtual-reg: '%2' }
body:             |
  bb.0.entry:
    liveins: $w0, $w1

    ; CHECK-LABEL: name: peephole_cselwr_different
    ; CHECK: liveins: $w0, $w1
    ; CHECK-NEXT: {{  $}}
    ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $w1
    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $w0
    ; CHECK-NEXT: $wzr = ANDSWri [[COPY]], 0, implicit-def $nzcv
    ; CHECK-NEXT: [[CSELWr:%[0-9]+]]:gpr32 = CSELWr [[COPY]], [[COPY1]], 0, implicit $nzcv
    ; CHECK-NEXT: RET_ReallyLR
    %3:gpr32 = COPY $w1
    %4:gpr32 = COPY $w0
    $wzr = ANDSWri %3, 0, implicit-def $nzcv
    %5:gpr32 = CSELWr %3, %4, 0, implicit $nzcv
    RET_ReallyLR

...