1# RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding -mcpu=mips32 | \ 2# RUN: FileCheck %s --check-prefix=CHECK-NOTRAP 3# RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding -mcpu=mips32 \ 4# RUN: -mattr=+use-tcc-in-div | FileCheck %s --check-prefix=CHECK-TRAP 5 6 rem $4,$5 7# CHECK-NOTRAP: bnez $5, $tmp0 # encoding: [A,A,0xa0,0x14] 8# CHECK-NOTRAP: # fixup A - offset: 0, value: ($tmp0)-4, kind: fixup_Mips_PC16 9# CHECK-NOTRAP: div $zero, $4, $5 # encoding: [0x1a,0x00,0x85,0x00] 10# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] 11# CHECK-NOTRAP: $tmp0 12# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24] 13# CHECK-NOTRAP: bne $5, $1, $tmp1 # encoding: [A,A,0xa1,0x14] 14# CHECK-NOTRAP: # fixup A - offset: 0, value: ($tmp1)-4, kind: fixup_Mips_PC16 15# CHECK-NOTRAP: lui $1, 32768 # encoding: [0x00,0x80,0x01,0x3c] 16# CHECK-NOTRAP: bne $4, $1, $tmp1 # encoding: [A,A,0x81,0x14] 17# CHECK-NOTRAP: # fixup A - offset: 0, value: ($tmp1)-4, kind: fixup_Mips_PC16 18# CHECK-NOTRAP: nop # encoding: [0x00,0x00,0x00,0x00] 19# CHECK-NOTRAP: break 6 # encoding: [0x0d,0x00,0x06,0x00] 20# CHECK-NOTRAP: $tmp1 21# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] 22 23# CHECK-TRAP: teq $5, $zero, 7 # encoding: [0xf4,0x01,0xa0,0x00] 24# CHECK-TRAP: div $zero, $4, $5 # encoding: [0x1a,0x00,0x85,0x00] 25# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24] 26# CHECK-TRAP: bne $5, $1, $tmp0 # encoding: [A,A,0xa1,0x14] 27# CHECK-TRAP: lui $1, 32768 # encoding: [0x00,0x80,0x01,0x3c] 28# CHECK-TRAP: teq $4, $1, 6 # encoding: [0xb4,0x01,0x81,0x00] 29# CHECK-TRAP: $tmp0 30# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] 31 32 rem $4,$0 33# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] 34# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] 35 36 rem $4,0 37# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] 38# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] 39 40 rem $0,0 41# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] 42# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] 43 44 rem $4,1 45# CHECK-NOTRAP: move $4, $zero # encoding: [0x25,0x20,0x00,0x00] 46# CHECK-TRAP: move $4, $zero # encoding: [0x25,0x20,0x00,0x00] 47 48 rem $4,-1 49# CHECK-NOTRAP: move $4, $zero # encoding: [0x25,0x20,0x00,0x00] 50# CHECK-TRAP: move $4, $zero # encoding: [0x25,0x20,0x00,0x00] 51 52 rem $4,2 53# CHECK-NOTRAP: addiu $1, $zero, 2 # encoding: [0x02,0x00,0x01,0x24] 54# CHECK-NOTRAP: div $zero, $4, $1 # encoding: [0x1a,0x00,0x81,0x00] 55# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] 56# CHECK-TRAP: addiu $1, $zero, 2 # encoding: [0x02,0x00,0x01,0x24] 57# CHECK-TRAP: div $zero, $4, $1 # encoding: [0x1a,0x00,0x81,0x00] 58# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] 59 60 rem $4,0x8000 61# CHECK-NOTRAP: ori $1, $zero, 32768 # encoding: [0x00,0x80,0x01,0x34] 62# CHECK-NOTRAP: div $zero, $4, $1 # encoding: [0x1a,0x00,0x81,0x00] 63# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] 64# CHECK-TRAP: ori $1, $zero, 32768 # encoding: [0x00,0x80,0x01,0x34] 65# CHECK-TRAP: div $zero, $4, $1 # encoding: [0x1a,0x00,0x81,0x00] 66# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] 67 68 rem $4,-0x8000 69# CHECK-NOTRAP: addiu $1, $zero, -32768 # encoding: [0x00,0x80,0x01,0x24] 70# CHECK-NOTRAP: div $zero, $4, $1 # encoding: [0x1a,0x00,0x81,0x00] 71# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] 72# CHECK-TRAP: addiu $1, $zero, -32768 # encoding: [0x00,0x80,0x01,0x24] 73# CHECK-TRAP: div $zero, $4, $1 # encoding: [0x1a,0x00,0x81,0x00] 74# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] 75 76 rem $4,0x10000 77# CHECK-NOTRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] 78# CHECK-NOTRAP: div $zero, $4, $1 # encoding: [0x1a,0x00,0x81,0x00] 79# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] 80# CHECK-TRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] 81# CHECK-TRAP: div $zero, $4, $1 # encoding: [0x1a,0x00,0x81,0x00] 82# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] 83 84 rem $4,0x1a5a5 85# CHECK-NOTRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] 86# CHECK-NOTRAP: ori $1, $1, 42405 # encoding: [0xa5,0xa5,0x21,0x34] 87# CHECK-NOTRAP: div $zero, $4, $1 # encoding: [0x1a,0x00,0x81,0x00] 88# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] 89# CHECK-TRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] 90# CHECK-TRAP: ori $1, $1, 42405 # encoding: [0xa5,0xa5,0x21,0x34] 91# CHECK-TRAP: div $zero, $4, $1 # encoding: [0x1a,0x00,0x81,0x00] 92# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] 93 94 rem $4,$5,$6 95# CHECK-NOTRAP: bnez $6, $tmp2 # encoding: [A,A,0xc0,0x14] 96# CHECK-NOTRAP: div $zero, $5, $6 # encoding: [0x1a,0x00,0xa6,0x00] 97# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] 98# CHECk-NOTRAP: $tmp2 99# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24] 100# CHECK-NOTRAP: bne $6, $1, $tmp3 # encoding: [A,A,0xc1,0x14] 101# CHECK-NOTRAP: lui $1, 32768 # encoding: [0x00,0x80,0x01,0x3c] 102# CHECK-NOTRAP: bne $5, $1, $tmp3 # encoding: [A,A,0xa1,0x14] 103# CHECK-NOTRAP: nop # encoding: [0x00,0x00,0x00,0x00] 104# CHECK-NOTRAP: break 6 # encoding: [0x0d,0x00,0x06,0x00] 105# CHECK-NOTRAP: $tmp3 106# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] 107# CHECK-TRAP: teq $6, $zero, 7 # encoding: [0xf4,0x01,0xc0,0x00] 108# CHECK-TRAP: div $zero, $5, $6 # encoding: [0x1a,0x00,0xa6,0x00] 109# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0xff,0xff,0x01,0x24] 110# CHECK-TRAP: bne $6, $1, $tmp1 # encoding: [A,A,0xc1,0x14] 111# CHECK-TRAP: lui $1, 32768 # encoding: [0x00,0x80,0x01,0x3c] 112# CHECK-TRAP: teq $5, $1, 6 # encoding: [0xb4,0x01,0xa1,0x00] 113# CHECK-TRAP: $tmp1 114# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] 115 116 rem $4,$5,$0 117# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] 118# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] 119 120 rem $4,$0,$0 121# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] 122# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] 123 124 rem $0,$5,$4 125# CHECK-NOTRAP: div $zero, $5, $4 # encoding: [0x1a,0x00,0xa4,0x00] 126# CHECK-TRAP: div $zero, $5, $4 # encoding: [0x1a,0x00,0xa4,0x00] 127 128 rem $4,$5,0 129# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] 130# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] 131 132 rem $4,$0,0 133# CHECK-NOTRAP: break 7 # encoding: [0x0d,0x00,0x07,0x00] 134# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0xf4,0x01,0x00,0x00] 135 136 rem $4,$5,1 137# CHECK-NOTRAP: move $4, $zero # encoding: [0x25,0x20,0x00,0x00] 138# CHECK-TRAP: move $4, $zero # encoding: [0x25,0x20,0x00,0x00] 139 140 rem $4,$5,-1 141# CHECK-NOTRAP: move $4, $zero # encoding: [0x25,0x20,0x00,0x00] 142# CHECK-TRAP: move $4, $zero # encoding: [0x25,0x20,0x00,0x00] 143 144 rem $4,$5,2 145# CHECK-NOTRAP: addiu $1, $zero, 2 # encoding: [0x02,0x00,0x01,0x24] 146# CHECK-NOTRAP: div $zero, $5, $1 # encoding: [0x1a,0x00,0xa1,0x00] 147# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] 148# CHECK-TRAP: addiu $1, $zero, 2 # encoding: [0x02,0x00,0x01,0x24] 149# CHECK-TRAP: div $zero, $5, $1 # encoding: [0x1a,0x00,0xa1,0x00] 150# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] 151 152 rem $4,$5,0x8000 153# CHECK-NOTRAP: ori $1, $zero, 32768 # encoding: [0x00,0x80,0x01,0x34] 154# CHECK-NOTRAP: div $zero, $5, $1 # encoding: [0x1a,0x00,0xa1,0x00] 155# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] 156# CHECK-TRAP: ori $1, $zero, 32768 # encoding: [0x00,0x80,0x01,0x34] 157# CHECK-TRAP: div $zero, $5, $1 # encoding: [0x1a,0x00,0xa1,0x00] 158# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] 159 160 161 rem $4,$5,-0x8000 162# CHECK-NOTRAP: addiu $1, $zero, -32768 # encoding: [0x00,0x80,0x01,0x24] 163# CHECK-NOTRAP: div $zero, $5, $1 # encoding: [0x1a,0x00,0xa1,0x00] 164# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] 165# CHECK-TRAP: addiu $1, $zero, -32768 # encoding: [0x00,0x80,0x01,0x24] 166# CHECK-TRAP: div $zero, $5, $1 # encoding: [0x1a,0x00,0xa1,0x00] 167# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] 168 169 170 rem $4,$5,0x10000 171# CHECK-NOTRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] 172# CHECK-NOTRAP: div $zero, $5, $1 # encoding: [0x1a,0x00,0xa1,0x00] 173# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] 174# CHECK-TRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] 175# CHECK-TRAP: div $zero, $5, $1 # encoding: [0x1a,0x00,0xa1,0x00] 176# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] 177 178 179 rem $4,$5,0x1a5a5 180# CHECK-NOTRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] 181# CHECK-NOTRAP: ori $1, $1, 42405 # encoding: [0xa5,0xa5,0x21,0x34] 182# CHECK-NOTRAP: div $zero, $5, $1 # encoding: [0x1a,0x00,0xa1,0x00] 183# CHECK-NOTRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] 184# CHECK-TRAP: lui $1, 1 # encoding: [0x01,0x00,0x01,0x3c] 185# CHECK-TRAP: ori $1, $1, 42405 # encoding: [0xa5,0xa5,0x21,0x34] 186# CHECK-TRAP: div $zero, $5, $1 # encoding: [0x1a,0x00,0xa1,0x00] 187# CHECK-TRAP: mfhi $4 # encoding: [0x10,0x20,0x00,0x00] 188