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 div $25,$11 7 # CHECK-NOTRAP: bnez $11, 8 # encoding: [0x15,0x60,0x00,0x02] 8 # CHECK-NOTRAP: div $zero, $25, $11 # encoding: [0x03,0x2b,0x00,0x1a] 9 # CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] 10 # CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] 11 # CHECK-NOTRAP: bne $11, $1, 16 # encoding: [0x15,0x61,0x00,0x04] 12 # CHECK-NOTRAP: lui $1, 32768 # encoding: [0x3c,0x01,0x80,0x00] 13 # CHECK-NOTRAP: bne $25, $1, 8 # encoding: [0x17,0x21,0x00,0x02] 14 # CHECK-NOTRAP: nop # encoding: [0x00,0x00,0x00,0x00] 15 # CHECK-NOTRAP: break 6 # encoding: [0x00,0x06,0x00,0x0d] 16 # CHECK-NOTRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] 17 18 div $24,$12 19 # CHECK-NOTRAP: bnez $12, 8 # encoding: [0x15,0x80,0x00,0x02] 20 # CHECK-NOTRAP: div $zero, $24, $12 # encoding: [0x03,0x0c,0x00,0x1a] 21 # CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] 22 # CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] 23 # CHECK-NOTRAP: bne $12, $1, 16 # encoding: [0x15,0x81,0x00,0x04] 24 # CHECK-NOTRAP: lui $1, 32768 # encoding: [0x3c,0x01,0x80,0x00] 25 # CHECK-NOTRAP: bne $24, $1, 8 # encoding: [0x17,0x01,0x00,0x02] 26 # CHECK-NOTRAP: nop # encoding: [0x00,0x00,0x00,0x00] 27 # CHECK-NOTRAP: break 6 # encoding: [0x00,0x06,0x00,0x0d] 28 # CHECK-NOTRAP: mflo $24 # encoding: [0x00,0x00,0xc0,0x12] 29 30 div $25,$0 31 # CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] 32 33 div $0,$9 34 # CHECK-NOTRAP: div $zero, $zero, $9 # encoding: [0x00,0x09,0x00,0x1a] 35 36 div $0,$0 37 # CHECK-NOTRAP: div $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1a] 38 39 div $4,$5,$6 40 # CHECK-NOTRAP: bnez $6, 8 # encoding: [0x14,0xc0,0x00,0x02] 41 # CHECK-NOTRAP: div $zero, $5, $6 # encoding: [0x00,0xa6,0x00,0x1a] 42 # CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] 43 # CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] 44 # CHECK-NOTRAP: bne $6, $1, 16 # encoding: [0x14,0xc1,0x00,0x04] 45 # CHECK-NOTRAP: lui $1, 32768 # encoding: [0x3c,0x01,0x80,0x00] 46 # CHECK-NOTRAP: bne $5, $1, 8 # encoding: [0x14,0xa1,0x00,0x02] 47 # CHECK-NOTRAP: nop # encoding: [0x00,0x00,0x00,0x00] 48 # CHECK-NOTRAP: break 6 # encoding: [0x00,0x06,0x00,0x0d] 49 # CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] 50 51 div $4,$5,$0 52 # CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] 53 54 div $4,$0,$0 55 # CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] 56 57 div $0, $4, $5 58 # CHECK-NOTRAP: div $zero, $4, $5 # encoding: [0x00,0x85,0x00,0x1a] 59 60 div $25, $11 61 # CHECK-TRAP: teq $11, $zero, 7 # encoding: [0x01,0x60,0x01,0xf4] 62 # CHECK-TRAP: div $zero, $25, $11 # encoding: [0x03,0x2b,0x00,0x1a] 63 # CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] 64 # CHECK-TRAP: bne $11, $1, 8 # encoding: [0x15,0x61,0x00,0x02] 65 # CHECK-TRAP: lui $1, 32768 # encoding: [0x3c,0x01,0x80,0x00] 66 # CHECK-TRAP: teq $25, $1, 6 # encoding: [0x03,0x21,0x01,0xb4] 67 # CHECK-TRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] 68 69 div $24,$12 70 # CHECK-TRAP: teq $12, $zero, 7 # encoding: [0x01,0x80,0x01,0xf4] 71 # CHECK-TRAP: div $zero, $24, $12 # encoding: [0x03,0x0c,0x00,0x1a] 72 # CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] 73 # CHECK-TRAP: bne $12, $1, 8 # encoding: [0x15,0x81,0x00,0x02] 74 # CHECK-TRAP: lui $1, 32768 # encoding: [0x3c,0x01,0x80,0x00] 75 # CHECK-TRAP: teq $24, $1, 6 # encoding: [0x03,0x01,0x01,0xb4] 76 # CHECK-TRAP: mflo $24 # encoding: [0x00,0x00,0xc0,0x12] 77 78 div $25,$0 79 # CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] 80 81 div $0,$9 82 # CHECK-TRAP: div $zero, $zero, $9 # encoding: [0x00,0x09,0x00,0x1a] 83 84 div $0,$0 85 # CHECK-TRAP: div $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1a] 86 87 div $4,$5,$6 88 # CHECK-TRAP: teq $6, $zero, 7 # encoding: [0x00,0xc0,0x01,0xf4] 89 # CHECK-TRAP: div $zero, $5, $6 # encoding: [0x00,0xa6,0x00,0x1a] 90 # CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] 91 # CHECK-TRAP: bne $6, $1, 8 # encoding: [0x14,0xc1,0x00,0x02] 92 # CHECK-TRAP: lui $1, 32768 # encoding: [0x3c,0x01,0x80,0x00] 93 # CHECK-TRAP: teq $5, $1, 6 # encoding: [0x00,0xa1,0x01,0xb4] 94 # CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] 95 96 div $4,$5,$0 97 # CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] 98 99 div $4,$0,$0 100 # CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] 101 102 div $0, $4, $5 103 # CHECK-TRAP: div $zero, $4, $5 # encoding: [0x00,0x85,0x00,0x1a]