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
  155
  156
  157
  158
  159
  160
  161
  162
  163
  164
  165
  166
  167
  168
  169
  170
  171
  172
  173
  174
  175
  176
  177
  178
  179
  180
  181
  182
  183
  184
  185
  186
  187
  188
  189
  190
  191
  192
  193
  194
  195
  196
  197
  198
  199
  200
  201
  202
  203
  204
  205
  206
  207
  208
  209
  210
  211
  212
  213
  214
  215
  216
  217
  218
  219
  220
  221
  222
  223
  224
  225
  226
  227
  228
# RUN: llc -mtriple arm-- -run-pass=legalizer %s -o - | FileCheck %s
# RUN: llc -mtriple thumb-- -mattr=+v6t2 -run-pass=legalizer %s -o - | FileCheck %s
--- |
  define void @test_zext_s16_to_s32() { ret void }
  define void @test_sext_s8_to_s32() { ret void }
  define void @test_sext_inreg_s8_to_s32() { ret void }
  define void @test_anyext_s1_to_s32() { ret void }

  define void @test_zext_s8_to_s16() { ret void }
  define void @test_sext_s1_to_s16() { ret void }

  define void @test_anyext_s1_to_s8() { ret void }

  define void @test_ext_combine() { ret void }
...
---
name:            test_zext_s16_to_s32
# CHECK-LABEL: name: test_zext_s16_to_s32
legalized:       false
# CHECK: legalized: true
regBankSelected: false
selected:        false
tracksRegLiveness: true
registers:
  - { id: 0, class: _ }
  - { id: 1, class: _ }
  - { id: 2, class: _ }
body:             |
  bb.0:
    liveins: $r0

    %0(p0) = COPY $r0
    %1(s16) = G_LOAD %0 :: (load 2)
    %2(s32) = G_ZEXT %1
    ; G_ZEXT with s16 is legal, so we should find it unchanged in the output
    ; CHECK: {{%[0-9]+}}:_(s32) = G_ZEXT {{%[0-9]+}}
    $r0 = COPY %2(s32)
    BX_RET 14, $noreg, implicit $r0
...
---
name:            test_sext_s8_to_s32
# CHECK-LABEL: name: test_sext_s8_to_s32
legalized:       false
# CHECK: legalized: true
regBankSelected: false
selected:        false
tracksRegLiveness: true
registers:
  - { id: 0, class: _ }
  - { id: 1, class: _ }
  - { id: 2, class: _ }
body:             |
  bb.0:
    liveins: $r0

    %0(p0) = COPY $r0
    %1(s8) = G_LOAD %0(p0) :: (load 1)
    %2(s32) = G_SEXT %1
    ; G_SEXT with s8 is legal, so we should find it unchanged in the output
    ; CHECK: {{%[0-9]+}}:_(s32) = G_SEXT {{%[0-9]+}}
    $r0 = COPY %2(s32)
    BX_RET 14, $noreg, implicit $r0
...
---
name:            test_sext_inreg_s8_to_s32
# CHECK-LABEL: name: test_sext_inreg_s8_to_s32
legalized:       false
# CHECK: legalized: true
regBankSelected: false
selected:        false
tracksRegLiveness: true
registers:
  - { id: 0, class: _ }
  - { id: 1, class: _ }
  - { id: 2, class: _ }
body:             |
  bb.0:
    liveins: $r0

    %0(p0) = COPY $r0
    %1(s32) = G_LOAD %0(p0) :: (load 4)
    %2(s32) = G_SEXT_INREG %1, 8
    ; G_SEXT_INREG should be lowered to a shift pair
    ; CHECK: [[T1:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
    ; CHECK: [[T2:%[0-9]+]]:_(s32) = G_SHL {{%[0-9]+}}, [[T1]]
    ; CHECK: {{%[0-9]+}}:_(s32) = G_ASHR [[T2]], [[T1]]
    $r0 = COPY %2(s32)
    BX_RET 14, $noreg, implicit $r0
...
---
name:            test_anyext_s1_to_s32
# CHECK-LABEL: name: test_anyext_s1_to_s32
legalized:       false
# CHECK: legalized: true
regBankSelected: false
selected:        false
tracksRegLiveness: true
registers:
  - { id: 0, class: _ }
  - { id: 1, class: _ }
  - { id: 2, class: _ }
body:             |
  bb.0:
    liveins: $r0

    %0(p0) = COPY $r0
    %1(s1) = G_LOAD %0(p0) :: (load 1)
    %2(s32) = G_ANYEXT %1
    ; G_ANYEXT with s1 is legal, so we should find it unchanged in the output
    ; CHECK: {{%[0-9]+}}:_(s32) = G_ANYEXT {{%[0-9]+}}
    $r0 = COPY %2(s32)
    BX_RET 14, $noreg, implicit $r0
...
---
name:            test_zext_s8_to_s16
# CHECK-LABEL: name: test_zext_s8_to_s16
legalized:       false
# CHECK: legalized: true
regBankSelected: false
selected:        false
tracksRegLiveness: true
registers:
  - { id: 0, class: _ }
  - { id: 1, class: _ }
  - { id: 2, class: _ }
body:             |
  bb.0:
    liveins: $r0

    %0(p0) = COPY $r0
    %1(s8) = G_LOAD %0(p0) :: (load 1)
    %2(s16) = G_ZEXT %1
    ; G_ZEXT from s8 to s16 is legal, so we should find it unchanged in the output
    ; CHECK: {{%[0-9]+}}:_(s16) = G_ZEXT {{%[0-9]+}}(s8)
    G_STORE %2(s16), %0(p0) :: (store 2)
    BX_RET 14, $noreg
...
---
name:            test_sext_s1_to_s16
# CHECK-LABEL: name: test_sext_s1_to_s16
legalized:       false
# CHECK: legalized: true
regBankSelected: false
selected:        false
tracksRegLiveness: true
registers:
  - { id: 0, class: _ }
  - { id: 1, class: _ }
  - { id: 2, class: _ }
body:             |
  bb.0:
    liveins: $r0

    %0(p0) = COPY $r0
    %1(s1) = G_LOAD %0(p0) :: (load 1)
    %2(s16) = G_SEXT %1(s1)
    ; G_SEXT from s1 to s16 is legal, so we should find it unchanged in the output
    ; CHECK: {{%[0-9]+}}:_(s16) = G_SEXT {{%[0-9]+}}(s1)
    G_STORE %2(s16), %0(p0) :: (store 2)
    BX_RET 14, $noreg
...
---
name:            test_anyext_s1_to_s8
# CHECK-LABEL: name: test_anyext_s1_to_s8
legalized:       false
# CHECK: legalized: true
regBankSelected: false
selected:        false
tracksRegLiveness: true
registers:
  - { id: 0, class: _ }
  - { id: 1, class: _ }
  - { id: 2, class: _ }
body:             |
  bb.0:
    liveins: $r0

    %0(p0) = COPY $r0
    %1(s1) = G_LOAD %0(p0) :: (load 1)
    %2(s8) = G_ANYEXT %1
    ; G_ANYEXT from s1 to s8 is legal, so we should find it unchanged in the output
    ; CHECK: {{%[0-9]+}}:_(s8) = G_ANYEXT {{%[0-9]+}}(s1)
    G_STORE %2(s8), %0(p0) :: (store 1)
    BX_RET 14, $noreg
...
---
name:            test_ext_combine
# CHECK-LABEL: name: test_ext_combine
legalized:       false
# CHECK: legalized: true
regBankSelected: false
selected:        false
tracksRegLiveness: true
registers:
  - { id: 0, class: _ }
  - { id: 1, class: _ }
  - { id: 2, class: _ }
  - { id: 3, class: _ }
  - { id: 4, class: _ }
  - { id: 5, class: _ }
body:             |
  bb.0:
    liveins: $r0

    %0(p0) = COPY $r0
    %1(s8) = G_LOAD %0(p0) :: (load 1)
    ; CHECK: [[V8:%[0-9]+]]:_(s8) = G_LOAD

    %2(s16) = G_ZEXT %1
    %3(s16) = G_SEXT %1

    %4(s16) = G_OR %2, %3
    ; G_OR is going to widen to 32 bits and the extensions/truncs should combine
    ; with the already existing ones
    ; CHECK: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[V8]](s8)
    ; CHECK: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[V8]](s8)
    ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[ZEXT]], [[SEXT]]
    ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY [[OR]]
    ; CHECK: [[BITS:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
    ; CHECK: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[BITS]](s32)
    ; CHECK: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[BITS]](s32)
    ; CHECK: $r0 = COPY [[ASHR]]

    %5(s32) = G_SEXT %4(s16)
    $r0 = COPY %5

    BX_RET 14, $noreg, implicit $r0
...