File: tst-peephole.mir

package info (click to toggle)
llvm-toolchain-9 1%3A9.0.1-16
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 882,436 kB
  • sloc: cpp: 4,167,636; ansic: 714,256; asm: 457,610; python: 155,927; objc: 65,094; sh: 42,856; lisp: 26,908; perl: 7,786; pascal: 7,722; makefile: 6,881; ml: 5,581; awk: 3,648; cs: 2,027; xml: 888; javascript: 381; ruby: 156
file content (54 lines) | stat: -rw-r--r-- 1,500 bytes parent folder | download | duplicates (2)
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
# RUN: llc -run-pass=peephole-opt %s -o - -verify-machineinstrs | FileCheck %s

# The and -> ands transform is sensitive to scheduling; make sure we don't
# transform cases which aren't legal.

# CHECK-LABEL: name: foo_transform
# CHECK:      %2:gpr = ANDri %0, 1, 14, $noreg, def $cpsr
# CHECK-NEXT: %3:gpr = MOVCCi16 %1, 5, 0, $cpsr

# CHECK-LABEL: name: foo_notransform
# CHECK:      TSTri %0, 1, 14, $noreg, implicit-def $cpsr
# CHECK-NEXT: %2:gpr = MOVCCi16 %1, 5, 0, $cpsr

--- |
  target triple = "armv7-unknown-unknown"
  define i32 @foo_transform(i32 %in) {
    ret i32 undef
  }
  define i32 @foo_notransform(i32 %in) {
    ret i32 undef
  }

...
---
name:            foo_transform
tracksRegLiveness: true
body:             |
  bb.0 (%ir-block.0):
    liveins: $r0

    %1:gpr = COPY $r0
    %2:gpr = MOVi 4, 14, $noreg, $noreg
    %4:gpr = ANDri %1:gpr, 1, 14, $noreg, $noreg
    TSTri %1:gpr, 1, 14, $noreg, implicit-def $cpsr
    %3:gpr = MOVCCi16 %2, 5, 0, $cpsr
    $r0 = COPY killed %3
    $r1 = COPY killed %4
    BX_RET 14, $noreg, implicit $r0, implicit $r1
...
name:            foo_notransform
tracksRegLiveness: true
body:             |
  bb.0 (%ir-block.0):
    liveins: $r0

    %1:gpr = COPY $r0
    %2:gpr = MOVi 4, 14, $noreg, $noreg
    TSTri %1:gpr, 1, 14, $noreg, implicit-def $cpsr
    %3:gpr = MOVCCi16 %2, 5, 0, $cpsr
    %4:gpr = ANDri %1:gpr, 1, 14, $noreg, $noreg
    $r0 = COPY killed %3
    $r1 = COPY killed %4
    BX_RET 14, $noreg, implicit $r0, implicit $r1