reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    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
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
# RUN: llc -march=hexagon -run-pass hexagon-bit-simplify -o - %s | FileCheck %s

--- |
  @g0 = global i32 0, align 4

  define i32 @f0() { ret i32 0 }
  define i32 @f1() { ret i32 0 }
  define i32 @f2() { ret i32 0 }
  define i32 @f3() { ret i32 0 }
  define i32 @f4() { ret i32 0 }
  define i32 @f5() { ret i32 0 }
  define i32 @f6() { ret i32 0 }
  define i32 @f7() { ret i32 0 }
...

# Case 0: is-zero with known zero register
# CHECK-LABEL: name: f0
# CHECK: %[[R00:[0-9]+]]:intregs = A2_tfrsi 1
# CHECK: $r0 = COPY %[[R00]]
# CHECK: PS_jmpret $r31, implicit-def dead $pc, implicit $r0

name: f0
tracksRegLiveness: true
body: |
  bb.0:
    %0:intregs = A2_tfrsi 0
    %2:intregs = A4_rcmpeqi killed %0, 0
    $r0 = COPY %2
    PS_jmpret $r31, implicit-def dead $pc, implicit $r0
...

# Case 1: is-zero with known non-zero register
# CHECK-LABEL: name: f1
# CHECK: %[[R10:[0-9]+]]:intregs = A2_tfrsi 0
# CHECK: $r0 = COPY %[[R10]]
# CHECK: PS_jmpret $r31, implicit-def dead $pc, implicit $r0

name: f1
tracksRegLiveness: true
body: |
  bb.0:
    %0:intregs = A2_tfrsi 128
    %2:intregs = A4_rcmpeqi killed %0, 0
    $r0 = COPY %2
    PS_jmpret $r31, implicit-def dead $pc, implicit $r0
...

# Case 2: is-not-zero with known zero register
# CHECK-LABEL: name: f2
# CHECK: %[[R20:[0-9]+]]:intregs = A2_tfrsi 0
# CHECK: $r0 = COPY %[[R20]]
# CHECK: PS_jmpret $r31, implicit-def dead $pc, implicit $r0

name: f2
tracksRegLiveness: true
body: |
  bb.0:
    %0:intregs = A2_tfrsi 0
    %2:intregs = A4_rcmpneqi killed %0, 0
    $r0 = COPY %2
    PS_jmpret $r31, implicit-def dead $pc, implicit $r0
...

# Case 3: is-not-zero with known non-zero register
# CHECK-LABEL: name: f3
# CHECK: %[[R30:[0-9]+]]:intregs = A2_tfrsi 1
# CHECK: $r0 = COPY %[[R30]]
# CHECK: PS_jmpret $r31, implicit-def dead $pc, implicit $r0

name: f3
tracksRegLiveness: true
body: |
  bb.0:
    %0:intregs = A2_tfrsi 1024
    %2:intregs = A4_rcmpneqi killed %0, 0
    $r0 = COPY %2
    PS_jmpret $r31, implicit-def dead $pc, implicit $r0
...


# Case 4: is-zero with mux(p, 1, 0)
# CHECK-LABEL: name: f4
# CHECK: %[[R40:[0-9]+]]:predregs = COPY $p0
# CHECK: %[[R41:[0-9]+]]:intregs = C2_muxii %[[R40]], 0, 1
# CHECK: $r0 = COPY %[[R41]]
# CHECK: PS_jmpret $r31, implicit-def dead $pc, implicit $r0

name: f4
tracksRegLiveness: true
body: |
  bb.0:
    liveins: $p0
    %0:predregs = COPY $p0
    %1:intregs = C2_muxii %0, 1, 0
    %2:intregs = A4_rcmpeqi killed %1, 0
    $r0 = COPY %2
    PS_jmpret $r31, implicit-def dead $pc, implicit $r0
...

# Case 5: is-zero with mux(p, 0, 1)
# CHECK-LABEL: name: f5
# CHECK: %[[R50:[0-9]+]]:predregs = COPY $p0
# CHECK: %[[R51:[0-9]+]]:intregs = C2_muxii %[[R50]], 1, 0
# CHECK: $r0 = COPY %[[R51]]
# CHECK: PS_jmpret $r31, implicit-def dead $pc, implicit $r0

name: f5
tracksRegLiveness: true
body: |
  bb.0:
    liveins: $p0
    %0:predregs = COPY $p0
    %1:intregs = C2_muxii %0, 0, 1
    %2:intregs = A4_rcmpeqi killed %1, 0
    $r0 = COPY %2
    PS_jmpret $r31, implicit-def dead $pc, implicit $r0
...

# Case 6: is-not-zero with mux(p, 1, 2)
# CHECK-LABEL: name: f6
# CHECK: %[[R60:[0-9]+]]:intregs = A2_tfrsi 1
# CHECK: $r0 = COPY %[[R60]]
# CHECK: PS_jmpret $r31, implicit-def dead $pc, implicit $r0

name: f6
tracksRegLiveness: true
body: |
  bb.0:
    liveins: $p0
    %0:predregs = COPY $p0
    %1:intregs = C2_muxii %0, 1, 2
    %2:intregs = A4_rcmpneqi killed %1, 0
    $r0 = COPY %2
    PS_jmpret $r31, implicit-def dead $pc, implicit $r0
...

# Case 7: is-not-zero with mux(p, @g0, 2)
# CHECK-LABEL: name: f7
# CHECK: %[[R70:[0-9]+]]:intregs = A2_tfrsi 1
# CHECK: $r0 = COPY %[[R70]]
# CHECK: PS_jmpret $r31, implicit-def dead $pc, implicit $r0

name: f7
tracksRegLiveness: true
body: |
  bb.0:
    liveins: $p0
    %0:predregs = COPY $p0
    %1:intregs = C2_muxii %0, @g0, 2
    %2:intregs = A4_rcmpneqi killed %1, 0
    $r0 = COPY %2
    PS_jmpret $r31, implicit-def dead $pc, implicit $r0
...