1# RUN: llvm-mc %s -triple=mips-unknown-linux -show-encoding -mcpu=mips32r2 | \
2# RUN:   FileCheck %s --check-prefix=CHECK-NOTRAP
3# RUN: llvm-mc %s -triple=mips-unknown-linux -show-encoding -mcpu=mips32r2 \
4# RUN:  -mattr=+use-tcc-in-div | FileCheck %s --check-prefix=CHECK-TRAP
5
6  divu $25,$11
7# CHECK-NOTRAP: bnez $11, 8               # encoding: [0x15,0x60,0x00,0x02]
8# CHECK-NOTRAP: divu $zero, $25, $11      # encoding: [0x03,0x2b,0x00,0x1b]
9# CHECK-NOTRAP: break 7                   # encoding: [0x00,0x07,0x00,0x0d]
10# CHECK-NOTRAP: mflo $25                  # encoding: [0x00,0x00,0xc8,0x12]
11
12  divu $24,$12
13# CHECK-NOTRAP: bnez $12, 8               # encoding: [0x15,0x80,0x00,0x02]
14# CHECK-NOTRAP: divu $zero, $24, $12      # encoding: [0x03,0x0c,0x00,0x1b]
15# CHECK-NOTRAP: break 7                   # encoding: [0x00,0x07,0x00,0x0d]
16# CHECK-NOTRAP: mflo $24                  # encoding: [0x00,0x00,0xc0,0x12]
17
18  divu $25,$0
19# CHECK-NOTRAP: bnez $zero, 8             # encoding: [0x14,0x00,0x00,0x02]
20# CHECK-NOTRAP: divu $zero, $25, $zero    # encoding: [0x03,0x20,0x00,0x1b]
21# CHECK-NOTRAP: break 7                   # encoding: [0x00,0x07,0x00,0x0d]
22# CHECK-NOTRAP: mflo $25                  # encoding: [0x00,0x00,0xc8,0x12]
23
24  divu $0,$9
25# CHECK-NOTRAP: divu $zero, $zero, $9     # encoding: [0x00,0x09,0x00,0x1b]
26
27  divu $0,$0
28# CHECK-NOTRAP: divu $zero, $zero, $zero  # encoding: [0x00,0x00,0x00,0x1b]
29
30  divu $25, $11
31# CHECK-TRAP: teq	$11, $zero, 7           # encoding: [0x01,0x60,0x01,0xf4]
32# CHECK-TRAP: divu $zero, $25, $11        # encoding: [0x03,0x2b,0x00,0x1b]
33# CHECK-TRAP: mflo $25                    # encoding: [0x00,0x00,0xc8,0x12]
34
35  divu $24,$12
36# CHECK-TRAP: teq $12, $zero, 7           # encoding: [0x01,0x80,0x01,0xf4]
37# CHECK-TRAP: divu $zero, $24, $12        # encoding: [0x03,0x0c,0x00,0x1b]
38# CHECK-TRAP: mflo $24                    # encoding: [0x00,0x00,0xc0,0x12]
39
40  divu $25,$0
41# CHECK-TRAP: teq $zero, $zero, 7         # encoding: [0x00,0x00,0x01,0xf4]
42# CHECK-TRAP: divu $zero, $25, $zero      # encoding: [0x03,0x20,0x00,0x1b]
43# CHECK-TRAP: mflo $25                    # encoding: [0x00,0x00,0xc8,0x12]
44
45  divu $0,$9
46# CHECK-TRAP: divu $zero, $zero, $9       # encoding: [0x00,0x09,0x00,0x1b]
47
48  divu $0,$0
49# CHECK-TRAP: divu $zero, $zero, $zero    # encoding: [0x00,0x00,0x00,0x1b]
50