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
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc  -O0 -mtriple=mipsel-linux-gnu -global-isel  -verify-machineinstrs %s -o -| FileCheck %s -check-prefixes=MIPS32

; sdiv
define signext i8 @sdiv_i8(i8 signext %a, i8 signext %b) {
; MIPS32-LABEL: sdiv_i8:
; MIPS32:       # %bb.0: # %entry
; MIPS32-NEXT:    sll $1, $5, 24
; MIPS32-NEXT:    sra $1, $1, 24
; MIPS32-NEXT:    sll $2, $4, 24
; MIPS32-NEXT:    sra $2, $2, 24
; MIPS32-NEXT:    div $zero, $1, $2
; MIPS32-NEXT:    teq $2, $zero, 7
; MIPS32-NEXT:    mflo $1
; MIPS32-NEXT:    sll $1, $1, 24
; MIPS32-NEXT:    sra $2, $1, 24
; MIPS32-NEXT:    jr $ra
; MIPS32-NEXT:    nop
entry:
  %div = sdiv i8 %b, %a
  ret i8 %div
}

define signext i16 @sdiv_i16(i16 signext %a, i16 signext %b) {
; MIPS32-LABEL: sdiv_i16:
; MIPS32:       # %bb.0: # %entry
; MIPS32-NEXT:    sll $1, $5, 16
; MIPS32-NEXT:    sra $1, $1, 16
; MIPS32-NEXT:    sll $2, $4, 16
; MIPS32-NEXT:    sra $2, $2, 16
; MIPS32-NEXT:    div $zero, $1, $2
; MIPS32-NEXT:    teq $2, $zero, 7
; MIPS32-NEXT:    mflo $1
; MIPS32-NEXT:    sll $1, $1, 16
; MIPS32-NEXT:    sra $2, $1, 16
; MIPS32-NEXT:    jr $ra
; MIPS32-NEXT:    nop
entry:
  %div = sdiv i16 %b, %a
  ret i16 %div
}

define signext i32 @sdiv_i32(i32 signext %a, i32 signext %b) {
; MIPS32-LABEL: sdiv_i32:
; MIPS32:       # %bb.0: # %entry
; MIPS32-NEXT:    div $zero, $5, $4
; MIPS32-NEXT:    teq $4, $zero, 7
; MIPS32-NEXT:    mflo $2
; MIPS32-NEXT:    jr $ra
; MIPS32-NEXT:    nop
entry:
  %div = sdiv i32 %b, %a
  ret i32 %div
}

define signext i64 @sdiv_i64(i64 signext %a, i64 signext %b) {
; MIPS32-LABEL: sdiv_i64:
; MIPS32:       # %bb.0: # %entry
; MIPS32-NEXT:    addiu $sp, $sp, -32
; MIPS32-NEXT:    .cfi_def_cfa_offset 32
; MIPS32-NEXT:    sw $ra, 28($sp) # 4-byte Folded Spill
; MIPS32-NEXT:    .cfi_offset 31, -4
; MIPS32-NEXT:    sw $4, 24($sp) # 4-byte Folded Spill
; MIPS32-NEXT:    move $4, $6
; MIPS32-NEXT:    sw $5, 20($sp) # 4-byte Folded Spill
; MIPS32-NEXT:    move $5, $7
; MIPS32-NEXT:    lw $6, 24($sp) # 4-byte Folded Reload
; MIPS32-NEXT:    lw $7, 20($sp) # 4-byte Folded Reload
; MIPS32-NEXT:    jal __divdi3
; MIPS32-NEXT:    nop
; MIPS32-NEXT:    lw $ra, 28($sp) # 4-byte Folded Reload
; MIPS32-NEXT:    addiu $sp, $sp, 32
; MIPS32-NEXT:    jr $ra
; MIPS32-NEXT:    nop
entry:
  %div = sdiv i64 %b, %a
  ret i64 %div
}

; srem
define signext i8 @srem_i8(i8 signext %a, i8 signext %b) {
; MIPS32-LABEL: srem_i8:
; MIPS32:       # %bb.0: # %entry
; MIPS32-NEXT:    sll $1, $5, 24
; MIPS32-NEXT:    sra $1, $1, 24
; MIPS32-NEXT:    sll $2, $4, 24
; MIPS32-NEXT:    sra $2, $2, 24
; MIPS32-NEXT:    div $zero, $1, $2
; MIPS32-NEXT:    teq $2, $zero, 7
; MIPS32-NEXT:    mflo $1
; MIPS32-NEXT:    sll $1, $1, 24
; MIPS32-NEXT:    sra $2, $1, 24
; MIPS32-NEXT:    jr $ra
; MIPS32-NEXT:    nop
entry:
  %div = sdiv i8 %b, %a
  ret i8 %div
}

define signext i16 @srem_i16(i16 signext %a, i16 signext %b) {
; MIPS32-LABEL: srem_i16:
; MIPS32:       # %bb.0: # %entry
; MIPS32-NEXT:    sll $1, $5, 16
; MIPS32-NEXT:    sra $1, $1, 16
; MIPS32-NEXT:    sll $2, $4, 16
; MIPS32-NEXT:    sra $2, $2, 16
; MIPS32-NEXT:    div $zero, $1, $2
; MIPS32-NEXT:    teq $2, $zero, 7
; MIPS32-NEXT:    mfhi $1
; MIPS32-NEXT:    sll $1, $1, 16
; MIPS32-NEXT:    sra $2, $1, 16
; MIPS32-NEXT:    jr $ra
; MIPS32-NEXT:    nop
entry:
  %rem = srem i16 %b, %a
  ret i16 %rem
}

define signext i32 @srem_i32(i32 signext %a, i32 signext %b) {
; MIPS32-LABEL: srem_i32:
; MIPS32:       # %bb.0: # %entry
; MIPS32-NEXT:    div $zero, $5, $4
; MIPS32-NEXT:    teq $4, $zero, 7
; MIPS32-NEXT:    mfhi $2
; MIPS32-NEXT:    jr $ra
; MIPS32-NEXT:    nop
entry:
  %rem = srem i32 %b, %a
  ret i32 %rem
}

define signext i64 @srem_i64(i64 signext %a, i64 signext %b) {
; MIPS32-LABEL: srem_i64:
; MIPS32:       # %bb.0: # %entry
; MIPS32-NEXT:    addiu $sp, $sp, -32
; MIPS32-NEXT:    .cfi_def_cfa_offset 32
; MIPS32-NEXT:    sw $ra, 28($sp) # 4-byte Folded Spill
; MIPS32-NEXT:    .cfi_offset 31, -4
; MIPS32-NEXT:    sw $4, 24($sp) # 4-byte Folded Spill
; MIPS32-NEXT:    move $4, $6
; MIPS32-NEXT:    sw $5, 20($sp) # 4-byte Folded Spill
; MIPS32-NEXT:    move $5, $7
; MIPS32-NEXT:    lw $6, 24($sp) # 4-byte Folded Reload
; MIPS32-NEXT:    lw $7, 20($sp) # 4-byte Folded Reload
; MIPS32-NEXT:    jal __moddi3
; MIPS32-NEXT:    nop
; MIPS32-NEXT:    lw $ra, 28($sp) # 4-byte Folded Reload
; MIPS32-NEXT:    addiu $sp, $sp, 32
; MIPS32-NEXT:    jr $ra
; MIPS32-NEXT:    nop
entry:
  %rem = srem i64 %b, %a
  ret i64 %rem
}

; udiv
define signext i8 @udiv_i8(i8 signext %a, i8 signext %b) {
; MIPS32-LABEL: udiv_i8:
; MIPS32:       # %bb.0: # %entry
; MIPS32-NEXT:    ori $1, $zero, 255
; MIPS32-NEXT:    and $2, $5, $1
; MIPS32-NEXT:    and $1, $4, $1
; MIPS32-NEXT:    divu $zero, $2, $1
; MIPS32-NEXT:    teq $1, $zero, 7
; MIPS32-NEXT:    mflo $1
; MIPS32-NEXT:    sll $1, $1, 24
; MIPS32-NEXT:    sra $2, $1, 24
; MIPS32-NEXT:    jr $ra
; MIPS32-NEXT:    nop
entry:
  %div = udiv i8 %b, %a
  ret i8 %div
}

define signext i16 @udiv_i16(i16 signext %a, i16 signext %b) {
; MIPS32-LABEL: udiv_i16:
; MIPS32:       # %bb.0: # %entry
; MIPS32-NEXT:    ori $1, $zero, 65535
; MIPS32-NEXT:    and $2, $5, $1
; MIPS32-NEXT:    and $1, $4, $1
; MIPS32-NEXT:    divu $zero, $2, $1
; MIPS32-NEXT:    teq $1, $zero, 7
; MIPS32-NEXT:    mflo $1
; MIPS32-NEXT:    sll $1, $1, 16
; MIPS32-NEXT:    sra $2, $1, 16
; MIPS32-NEXT:    jr $ra
; MIPS32-NEXT:    nop
entry:
  %div = udiv i16 %b, %a
  ret i16 %div
}

define signext i32 @udiv_i32(i32 signext %a, i32 signext %b) {
; MIPS32-LABEL: udiv_i32:
; MIPS32:       # %bb.0: # %entry
; MIPS32-NEXT:    divu $zero, $5, $4
; MIPS32-NEXT:    teq $4, $zero, 7
; MIPS32-NEXT:    mflo $2
; MIPS32-NEXT:    jr $ra
; MIPS32-NEXT:    nop
entry:
  %div = udiv i32 %b, %a
  ret i32 %div
}

define signext i64 @udiv_i64(i64 signext %a, i64 signext %b) {
; MIPS32-LABEL: udiv_i64:
; MIPS32:       # %bb.0: # %entry
; MIPS32-NEXT:    addiu $sp, $sp, -32
; MIPS32-NEXT:    .cfi_def_cfa_offset 32
; MIPS32-NEXT:    sw $ra, 28($sp) # 4-byte Folded Spill
; MIPS32-NEXT:    .cfi_offset 31, -4
; MIPS32-NEXT:    sw $4, 24($sp) # 4-byte Folded Spill
; MIPS32-NEXT:    move $4, $6
; MIPS32-NEXT:    sw $5, 20($sp) # 4-byte Folded Spill
; MIPS32-NEXT:    move $5, $7
; MIPS32-NEXT:    lw $6, 24($sp) # 4-byte Folded Reload
; MIPS32-NEXT:    lw $7, 20($sp) # 4-byte Folded Reload
; MIPS32-NEXT:    jal __udivdi3
; MIPS32-NEXT:    nop
; MIPS32-NEXT:    lw $ra, 28($sp) # 4-byte Folded Reload
; MIPS32-NEXT:    addiu $sp, $sp, 32
; MIPS32-NEXT:    jr $ra
; MIPS32-NEXT:    nop
entry:
  %div = udiv i64 %b, %a
  ret i64 %div
}

; urem
define signext i8 @urem_i8(i8 signext %a, i8 signext %b) {
; MIPS32-LABEL: urem_i8:
; MIPS32:       # %bb.0: # %entry
; MIPS32-NEXT:    ori $1, $zero, 255
; MIPS32-NEXT:    and $2, $5, $1
; MIPS32-NEXT:    and $1, $4, $1
; MIPS32-NEXT:    divu $zero, $2, $1
; MIPS32-NEXT:    teq $1, $zero, 7
; MIPS32-NEXT:    mfhi $1
; MIPS32-NEXT:    sll $1, $1, 24
; MIPS32-NEXT:    sra $2, $1, 24
; MIPS32-NEXT:    jr $ra
; MIPS32-NEXT:    nop
entry:
  %rem = urem i8 %b, %a
  ret i8 %rem
}

define signext i16 @urem_i16(i16 signext %a, i16 signext %b) {
; MIPS32-LABEL: urem_i16:
; MIPS32:       # %bb.0: # %entry
; MIPS32-NEXT:    ori $1, $zero, 65535
; MIPS32-NEXT:    and $2, $5, $1
; MIPS32-NEXT:    and $1, $4, $1
; MIPS32-NEXT:    divu $zero, $2, $1
; MIPS32-NEXT:    teq $1, $zero, 7
; MIPS32-NEXT:    mfhi $1
; MIPS32-NEXT:    sll $1, $1, 16
; MIPS32-NEXT:    sra $2, $1, 16
; MIPS32-NEXT:    jr $ra
; MIPS32-NEXT:    nop
entry:
  %rem = urem i16 %b, %a
  ret i16 %rem
}

define signext i32 @urem_i32(i32 signext %a, i32 signext %b) {
; MIPS32-LABEL: urem_i32:
; MIPS32:       # %bb.0: # %entry
; MIPS32-NEXT:    divu $zero, $5, $4
; MIPS32-NEXT:    teq $4, $zero, 7
; MIPS32-NEXT:    mfhi $2
; MIPS32-NEXT:    jr $ra
; MIPS32-NEXT:    nop
entry:
  %rem = urem i32 %b, %a
  ret i32 %rem
}

define signext i64 @urem_i64(i64 signext %a, i64 signext %b) {
; MIPS32-LABEL: urem_i64:
; MIPS32:       # %bb.0: # %entry
; MIPS32-NEXT:    addiu $sp, $sp, -32
; MIPS32-NEXT:    .cfi_def_cfa_offset 32
; MIPS32-NEXT:    sw $ra, 28($sp) # 4-byte Folded Spill
; MIPS32-NEXT:    .cfi_offset 31, -4
; MIPS32-NEXT:    sw $4, 24($sp) # 4-byte Folded Spill
; MIPS32-NEXT:    move $4, $6
; MIPS32-NEXT:    sw $5, 20($sp) # 4-byte Folded Spill
; MIPS32-NEXT:    move $5, $7
; MIPS32-NEXT:    lw $6, 24($sp) # 4-byte Folded Reload
; MIPS32-NEXT:    lw $7, 20($sp) # 4-byte Folded Reload
; MIPS32-NEXT:    jal __umoddi3
; MIPS32-NEXT:    nop
; MIPS32-NEXT:    lw $ra, 28($sp) # 4-byte Folded Reload
; MIPS32-NEXT:    addiu $sp, $sp, 32
; MIPS32-NEXT:    jr $ra
; MIPS32-NEXT:    nop
entry:
  %rem = urem i64 %b, %a
  ret i64 %rem
}