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
  229
  230
  231
  232
  233
  234
  235
  236
  237
  238
  239
  240
  241
  242
  243
  244
  245
  246
  247
  248
  249
  250
  251
  252
  253
  254
  255
  256
  257
  258
  259
  260
  261
  262
  263
  264
  265
  266
  267
  268
  269
  270
  271
  272
  273
  274
  275
  276
  277
  278
  279
  280
  281
  282
  283
  284
  285
  286
  287
  288
  289
  290
  291
  292
  293
  294
  295
  296
  297
  298
  299
  300
  301
  302
; Test loading of 64-bit constants.
;
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s

declare void @foo(i64, i64, i64, i64)

; Check 0.
define i64 @f1() {
; CHECK-LABEL: f1:
; CHECK: lghi %r2, 0
; CHECK-NEXT: br %r14
  ret i64 0
}

; Check the high end of the LGHI range.
define i64 @f2() {
; CHECK-LABEL: f2:
; CHECK: lghi %r2, 32767
; CHECK-NEXT: br %r14
  ret i64 32767
}

; Check the next value up, which must use LLILL instead.
define i64 @f3() {
; CHECK-LABEL: f3:
; CHECK: llill %r2, 32768
; CHECK-NEXT: br %r14
  ret i64 32768
}

; Check the high end of the LLILL range.
define i64 @f4() {
; CHECK-LABEL: f4:
; CHECK: llill %r2, 65535
; CHECK-NEXT: br %r14
  ret i64 65535
}

; Check the first useful LLILH value, which is the next one up.
define i64 @f5() {
; CHECK-LABEL: f5:
; CHECK: llilh %r2, 1
; CHECK-NEXT: br %r14
  ret i64 65536
}

; Check the first useful LGFI value, which is the next one up again.
define i64 @f6() {
; CHECK-LABEL: f6:
; CHECK: lgfi %r2, 65537
; CHECK-NEXT: br %r14
  ret i64 65537
}

; Check the high end of the LGFI range.
define i64 @f7() {
; CHECK-LABEL: f7:
; CHECK: lgfi %r2, 2147483647
; CHECK-NEXT: br %r14
  ret i64 2147483647
}

; Check the next value up, which should use LLILH instead.
define i64 @f8() {
; CHECK-LABEL: f8:
; CHECK: llilh %r2, 32768
; CHECK-NEXT: br %r14
  ret i64 2147483648
}

; Check the next value up again, which should use LLILF.
define i64 @f9() {
; CHECK-LABEL: f9:
; CHECK: llilf %r2, 2147483649
; CHECK-NEXT: br %r14
  ret i64 2147483649
}

; Check the high end of the LLILH range.
define i64 @f10() {
; CHECK-LABEL: f10:
; CHECK: llilh %r2, 65535
; CHECK-NEXT: br %r14
  ret i64 4294901760
}

; Check the next value up, which must use LLILF.
define i64 @f11() {
; CHECK-LABEL: f11:
; CHECK: llilf %r2, 4294901761
; CHECK-NEXT: br %r14
  ret i64 4294901761
}

; Check the high end of the LLILF range.
define i64 @f12() {
; CHECK-LABEL: f12:
; CHECK: llilf %r2, 4294967295
; CHECK-NEXT: br %r14
  ret i64 4294967295
}

; Check the lowest useful LLIHL value, which is the next one up.
define i64 @f13() {
; CHECK-LABEL: f13:
; CHECK: llihl %r2, 1
; CHECK-NEXT: br %r14
  ret i64 4294967296
}

; Check the next value up, which must use a combination of two instructions.
define i64 @f14() {
; CHECK-LABEL: f14:
; CHECK: llihl %r2, 1
; CHECK-NEXT: oill %r2, 1
; CHECK-NEXT: br %r14
  ret i64 4294967297
}

; Check the high end of the OILL range.
define i64 @f15() {
; CHECK-LABEL: f15:
; CHECK: llihl %r2, 1
; CHECK-NEXT: oill %r2, 65535
; CHECK-NEXT: br %r14
  ret i64 4295032831
}

; Check the next value up, which should use OILH instead.
define i64 @f16() {
; CHECK-LABEL: f16:
; CHECK: llihl %r2, 1
; CHECK-NEXT: oilh %r2, 1
; CHECK-NEXT: br %r14
  ret i64 4295032832
}

; Check the next value up again, which should use OILF.
define i64 @f17() {
; CHECK-LABEL: f17:
; CHECK: llihl %r2, 1
; CHECK-NEXT: oilf %r2, 65537
; CHECK-NEXT: br %r14
  ret i64 4295032833
}

; Check the high end of the OILH range.
define i64 @f18() {
; CHECK-LABEL: f18:
; CHECK: llihl %r2, 1
; CHECK-NEXT: oilh %r2, 65535
; CHECK-NEXT: br %r14
  ret i64 8589869056
}

; Check the high end of the OILF range.
define i64 @f19() {
; CHECK-LABEL: f19:
; CHECK: llihl %r2, 1
; CHECK-NEXT: oilf %r2, 4294967295
; CHECK-NEXT: br %r14
  ret i64 8589934591
}

; Check the high end of the LLIHL range.
define i64 @f20() {
; CHECK-LABEL: f20:
; CHECK: llihl %r2, 65535
; CHECK-NEXT: br %r14
  ret i64 281470681743360
}

; Check the lowest useful LLIHH value, which is 1<<32 greater than the above.
define i64 @f21() {
; CHECK-LABEL: f21:
; CHECK: llihh %r2, 1
; CHECK-NEXT: br %r14
  ret i64 281474976710656
}

; Check the lowest useful LLIHF value, which is 1<<32 greater again.
define i64 @f22() {
; CHECK-LABEL: f22:
; CHECK: llihf %r2, 65537
; CHECK-NEXT: br %r14
  ret i64 281479271677952
}

; Check the highest end of the LLIHH range.
define i64 @f23() {
; CHECK-LABEL: f23:
; CHECK: llihh %r2, 65535
; CHECK-NEXT: br %r14
  ret i64 -281474976710656
}

; Check the next value up, which must use OILL too.
define i64 @f24() {
; CHECK-LABEL: f24:
; CHECK: llihh %r2, 65535
; CHECK-NEXT: oill %r2, 1
; CHECK-NEXT: br %r14
  ret i64 -281474976710655
}

; Check the high end of the LLIHF range.
define i64 @f25() {
; CHECK-LABEL: f25:
; CHECK: llihf %r2, 4294967295
; CHECK-NEXT: br %r14
  ret i64 -4294967296
}

; Check -1.
define i64 @f26() {
; CHECK-LABEL: f26:
; CHECK: lghi %r2, -1
; CHECK-NEXT: br %r14
  ret i64 -1
}

; Check the low end of the LGHI range.
define i64 @f27() {
; CHECK-LABEL: f27:
; CHECK: lghi %r2, -32768
; CHECK-NEXT: br %r14
  ret i64 -32768
}

; Check the next value down, which must use LGFI instead.
define i64 @f28() {
; CHECK-LABEL: f28:
; CHECK: lgfi %r2, -32769
; CHECK-NEXT: br %r14
  ret i64 -32769
}

; Check the low end of the LGFI range.
define i64 @f29() {
; CHECK-LABEL: f29:
; CHECK: lgfi %r2, -2147483648
; CHECK-NEXT: br %r14
  ret i64 -2147483648
}

; Check the next value down, which needs a two-instruction sequence.
define i64 @f30() {
; CHECK-LABEL: f30:
; CHECK: llihf %r2, 4294967295
; CHECK-NEXT: oilf %r2, 2147483647
; CHECK-NEXT: br %r14
  ret i64 -2147483649
}

; Check that constant loads are rematerialized.
define i64 @f31() {
; CHECK-LABEL: f31:
; CHECK-DAG: lghi %r2, 42
; CHECK-DAG: lgfi %r3, 65537
; CHECK-DAG: llilf %r4, 2147483649
; CHECK-DAG: llihf %r5, 65537
; CHECK: brasl %r14, foo@PLT
; CHECK-DAG: llill %r2, 32768
; CHECK-DAG: llilh %r3, 1
; CHECK-DAG: llihl %r4, 1
; CHECK-DAG: llihh %r5, 1
; CHECK: brasl %r14, foo@PLT
; CHECK-DAG: lghi %r2, 42
; CHECK-DAG: lgfi %r3, 65537
; CHECK-DAG: llilf %r4, 2147483649
; CHECK-DAG: llihf %r5, 65537
; CHECK: brasl %r14, foo@PLT
; CHECK-DAG: llill %r2, 32768
; CHECK-DAG: llilh %r3, 1
; CHECK-DAG: llihl %r4, 1
; CHECK-DAG: llihh %r5, 1
; CHECK: brasl %r14, foo@PLT
; CHECK: lghi %r2, 42
; CHECK: br %r14
  call void @foo(i64 42, i64 65537, i64 2147483649, i64 281479271677952)
  call void @foo(i64 32768, i64 65536, i64 4294967296, i64 281474976710656)
  call void @foo(i64 42, i64 65537, i64 2147483649, i64 281479271677952)
  call void @foo(i64 32768, i64 65536, i64 4294967296, i64 281474976710656)
  ret i64 42
}

; Verify that we do not crash on OR with two constant inputs
; (this was PR34859).
define i64 @f32(i64 *%ptr) {
; CHECK-LABEL: f32:
; CHECK: llihf %r1, 918324340
; CHECK: oilf %r1, 1806197964
; CHECK: la %r0, 1(%r1)
  store i64 -1, i64* %ptr, align 8
  %1 = load i64, i64* %ptr, align 8
  %2 = icmp ne i64 %1, 0
  %3 = zext i1 %2 to i64
  %4 = or i64 %3, 3944173009226982604
  store i64 %4, i64* %ptr, align 8
  ret i64 3944173009226982604
}