diff options
author | Zoran Jovanovic <zoran.jovanovic@imgtec.com> | 2016-05-16 08:57:59 +0000 |
---|---|---|
committer | Zoran Jovanovic <zoran.jovanovic@imgtec.com> | 2016-05-16 08:57:59 +0000 |
commit | 2365c029a92f6ddf12961d4ef17d47216649f98a (patch) | |
tree | 34ee7156f1fd08b27b6030628c3dd9557e96e1b5 /test/MC | |
parent | 5975742a111cac0484bd61e603a00d3f1538e5e7 (diff) |
[mips] Addition of a third operand to the instructions [d]div, [d]divu
Author: obucina
Reviewers: dsanders
Adds support for third operand for [D]DIV[U] instructions. Additional test for case when destination reg is zero register
Differential Revision: http://reviews.llvm.org/D16888
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269636 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/MC')
-rw-r--r-- | test/MC/Mips/macro-ddiv-bad.s | 22 | ||||
-rw-r--r-- | test/MC/Mips/macro-ddiv.s | 41 | ||||
-rw-r--r-- | test/MC/Mips/macro-ddivu-bad.s | 16 | ||||
-rw-r--r-- | test/MC/Mips/macro-ddivu.s | 39 | ||||
-rw-r--r-- | test/MC/Mips/macro-div-bad.s | 2 | ||||
-rw-r--r-- | test/MC/Mips/macro-div.s | 39 | ||||
-rw-r--r-- | test/MC/Mips/macro-divu-bad.s | 2 | ||||
-rw-r--r-- | test/MC/Mips/macro-divu.s | 65 |
8 files changed, 192 insertions, 34 deletions
diff --git a/test/MC/Mips/macro-ddiv-bad.s b/test/MC/Mips/macro-ddiv-bad.s index 350a0fbaeda..1abcab66142 100644 --- a/test/MC/Mips/macro-ddiv-bad.s +++ b/test/MC/Mips/macro-ddiv-bad.s @@ -1,18 +1,18 @@ # RUN: not llvm-mc %s -arch=mips -mcpu=mips32r6 2>&1 | \ -# RUN: FileCheck %s --check-prefix=R6 +# RUN: FileCheck %s --check-prefix=MIPS32-OR-R6 +# RUN: not llvm-mc %s -arch=mips -mcpu=mips32r2 2>&1 | \ +# RUN: FileCheck %s --check-prefix=MIPS32-OR-R6 # RUN: not llvm-mc %s -arch=mips64 -mcpu=mips64r6 2>&1 | \ -# RUN: FileCheck %s --check-prefix=R6 -# RUN: llvm-mc %s -arch=mips -mcpu=mips32r2 2>&1 | \ -# RUN: FileCheck %s --check-prefix=NOT-R6 +# RUN: FileCheck %s --check-prefix=MIPS32-OR-R6 # RUN: llvm-mc %s -arch=mips64 -mcpu=mips64r2 2>&1 | \ -# RUN: FileCheck %s --check-prefix=NOT-R6 +# RUN: FileCheck %s --check-prefix=MIPS64-NOT-R6 .text - ddiv $25, $11 - # R6: :[[@LINE-1]]:3: error: instruction not supported on mips32r6 or mips64r6 + ddivu $25, $11 + # MIPS32-OR-R6: :[[@LINE-1]]:{{[0-9]+}}: error: instruction requires a CPU feature not currently enabled - ddiv $25, $0 - # NOT-R6: :[[@LINE-1]]:3: warning: division by zero + ddivu $25, $0 + # MIPS64-NOT-R6: :[[@LINE-1]]:3: warning: division by zero - ddiv $0,$0 - # NOT-R6: :[[@LINE-1]]:3: warning: dividing zero by zero + ddivu $0,$0 + # MIPS64-NOT-R6: :[[@LINE-1]]:3: warning: dividing zero by zero diff --git a/test/MC/Mips/macro-ddiv.s b/test/MC/Mips/macro-ddiv.s index 99bc5450d01..d36e6998d60 100644 --- a/test/MC/Mips/macro-ddiv.s +++ b/test/MC/Mips/macro-ddiv.s @@ -48,6 +48,28 @@ ddiv $0,$0 # CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] + ddiv $4,$5,$6 +# CHECK-NOTRAP: bne $6, $zero, 8 # encoding: [0x14,0xc0,0x00,0x02] +# CHECK-NOTRAP: ddiv $zero, $5, $6 # encoding: [0x00,0xa6,0x00,0x1e] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] +# CHECK-NOTRAP: bne $6, $1, 20 # encoding: [0x14,0xc1,0x00,0x05] +# CHECK-NOTRAP: addiu $1, $zero, 1 # encoding: [0x24,0x01,0x00,0x01] +# CHECK-NOTRAP: dsll32 $1, $1, 31 # encoding: [0x00,0x01,0x0f,0xfc] +# CHECK-NOTRAP: bne $5, $1, 8 # encoding: [0x14,0xa1,0x00,0x02] +# CHECK-NOTRAP: sll $zero, $zero, 0 # encoding: [0x00,0x00,0x00,0x00] +# CHECK-NOTRAP: break 6 # encoding: [0x00,0x06,0x00,0x0d] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddiv $4,$5,$0 +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] + + ddiv $4,$0,$0 +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] + + ddiv $0, $4, $5 +# CHECK-NOTRAP: ddiv $zero, $4, $5 # encoding: [0x00,0x85,0x00,0x1e] + ddiv $25,$11 # CHECK-TRAP: teq $11, $zero, 7 # encoding: [0x01,0x60,0x01,0xf4] # CHECK-TRAP: ddiv $zero, $25, $11 # encoding: [0x03,0x2b,0x00,0x1e] @@ -83,3 +105,22 @@ ddiv $0,$0 # CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] + + ddiv $4,$5,$6 +# CHECK-TRAP: teq $6, $zero, 7 # encoding: [0x00,0xc0,0x01,0xf4] +# CHECK-TRAP: ddiv $zero, $5, $6 # encoding: [0x00,0xa6,0x00,0x1e] +# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] +# CHECK-TRAP: bne $6, $1, 12 # encoding: [0x14,0xc1,0x00,0x03] +# CHECK-TRAP: addiu $1, $zero, 1 # encoding: [0x24,0x01,0x00,0x01] +# CHECK-TRAP: dsll32 $1, $1, 31 # encoding: [0x00,0x01,0x0f,0xfc] +# CHECK-TRAP: teq $5, $1, 6 # encoding: [0x00,0xa1,0x01,0xb4] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddiv $4,$5,$0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] + + ddiv $4,$0,$0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] + + ddiv $0, $4, $5 +# CHECK-TRAP: ddiv $zero, $4, $5 # encoding: [0x00,0x85,0x00,0x1e] diff --git a/test/MC/Mips/macro-ddivu-bad.s b/test/MC/Mips/macro-ddivu-bad.s index 7a6c7e0bd52..1abcab66142 100644 --- a/test/MC/Mips/macro-ddivu-bad.s +++ b/test/MC/Mips/macro-ddivu-bad.s @@ -1,18 +1,18 @@ # RUN: not llvm-mc %s -arch=mips -mcpu=mips32r6 2>&1 | \ -# RUN: FileCheck %s --check-prefix=R6 +# RUN: FileCheck %s --check-prefix=MIPS32-OR-R6 +# RUN: not llvm-mc %s -arch=mips -mcpu=mips32r2 2>&1 | \ +# RUN: FileCheck %s --check-prefix=MIPS32-OR-R6 # RUN: not llvm-mc %s -arch=mips64 -mcpu=mips64r6 2>&1 | \ -# RUN: FileCheck %s --check-prefix=R6 -# RUN: llvm-mc %s -arch=mips -mcpu=mips32r2 2>&1 | \ -# RUN: FileCheck %s --check-prefix=NOT-R6 +# RUN: FileCheck %s --check-prefix=MIPS32-OR-R6 # RUN: llvm-mc %s -arch=mips64 -mcpu=mips64r2 2>&1 | \ -# RUN: FileCheck %s --check-prefix=NOT-R6 +# RUN: FileCheck %s --check-prefix=MIPS64-NOT-R6 .text ddivu $25, $11 - # R6: :[[@LINE-1]]:3: error: instruction not supported on mips32r6 or mips64r6 + # MIPS32-OR-R6: :[[@LINE-1]]:{{[0-9]+}}: error: instruction requires a CPU feature not currently enabled ddivu $25, $0 - # NOT-R6: :[[@LINE-1]]:3: warning: division by zero + # MIPS64-NOT-R6: :[[@LINE-1]]:3: warning: division by zero ddivu $0,$0 - # NOT-R6: :[[@LINE-1]]:3: warning: dividing zero by zero + # MIPS64-NOT-R6: :[[@LINE-1]]:3: warning: dividing zero by zero diff --git a/test/MC/Mips/macro-ddivu.s b/test/MC/Mips/macro-ddivu.s index 72d92380278..ff7e8c46d0b 100644 --- a/test/MC/Mips/macro-ddivu.s +++ b/test/MC/Mips/macro-ddivu.s @@ -33,6 +33,27 @@ # CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] # CHECK-NOTRAP: mflo $zero # encoding: [0x00,0x00,0x00,0x12] + ddivu $4,$5,$6 +# CHECK-NOTRAP: bne $6, $zero, 8 # encoding: [0x14,0xc0,0x00,0x02] +# CHECK-NOTRAP: ddivu $zero, $5, $6 # encoding: [0x00,0xa6,0x00,0x1f] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddivu $4,$5,$0 +# CHECK-NOTRAP: bne $zero, $zero, 8 # encoding: [0x14,0x00,0x00,0x02] +# CHECK-NOTRAP: ddivu $zero, $5, $zero # encoding: [0x00,0xa0,0x00,0x1f] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddivu $4,$0,$0 +# CHECK-NOTRAP: bne $zero, $zero, 8 # encoding: [0x14,0x00,0x00,0x02] +# CHECK-NOTRAP: ddivu $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1f] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddivu $0, $4, $5 +# CHECK-NOTRAP: ddivu $zero, $4, $5 # encoding: [0x00,0x85,0x00,0x1f] + ddivu $25, $11 # CHECK-TRAP: teq $11, $zero, 7 # encoding: [0x01,0x60,0x01,0xf4] # CHECK-TRAP: ddivu $zero, $25, $11 # encoding: [0x03,0x2b,0x00,0x1f] @@ -57,3 +78,21 @@ # CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] # CHECK-TRAP: ddivu $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1f] # CHECK-TRAP: mflo $zero # encoding: [0x00,0x00,0x00,0x12] + + ddivu $4,$5,$6 +# CHECK-TRAP: teq $6, $zero, 7 # encoding: [0x00,0xc0,0x01,0xf4] +# CHECK-TRAP: ddivu $zero, $5, $6 # encoding: [0x00,0xa6,0x00,0x1f] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddivu $4,$5,$0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] +# CHECK-TRAP: ddivu $zero, $5, $zero # encoding: [0x00,0xa0,0x00,0x1f] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddivu $4,$0,$0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] +# CHECK-TRAP: ddivu $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1f] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + ddivu $0, $4, $5 +# CHECK-TRAP: ddivu $zero, $4, $5 # encoding: [0x00,0x85,0x00,0x1f] diff --git a/test/MC/Mips/macro-div-bad.s b/test/MC/Mips/macro-div-bad.s index 086e8b44188..20ad39087a1 100644 --- a/test/MC/Mips/macro-div-bad.s +++ b/test/MC/Mips/macro-div-bad.s @@ -9,7 +9,7 @@ .text div $25, $11 - # R6: :[[@LINE-1]]:3: error: instruction not supported on mips32r6 or mips64r6 + # R6: :[[@LINE-1]]:3: error: instruction requires a CPU feature not currently enabled div $25, $0 # NOT-R6: :[[@LINE-1]]:3: warning: division by zero diff --git a/test/MC/Mips/macro-div.s b/test/MC/Mips/macro-div.s index 9efd6e19db1..3ac763e17d7 100644 --- a/test/MC/Mips/macro-div.s +++ b/test/MC/Mips/macro-div.s @@ -36,6 +36,27 @@ div $0,$0 # CHECK-NOTRAP: div $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1a] + div $4,$5,$6 +# CHECK-NOTRAP: bnez $6, 8 # encoding: [0x14,0xc0,0x00,0x02] +# CHECK-NOTRAP: div $zero, $5, $6 # encoding: [0x00,0xa6,0x00,0x1a] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] +# CHECK-NOTRAP: bne $6, $1, 16 # encoding: [0x14,0xc1,0x00,0x04] +# CHECK-NOTRAP: lui $1, 32768 # encoding: [0x3c,0x01,0x80,0x00] +# CHECK-NOTRAP: bne $5, $1, 8 # encoding: [0x14,0xa1,0x00,0x02] +# CHECK-NOTRAP: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-NOTRAP: break 6 # encoding: [0x00,0x06,0x00,0x0d] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + div $4,$5,$0 +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] + + div $4,$0,$0 +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] + + div $0, $4, $5 +# CHECK-NOTRAP: div $zero, $4, $5 # encoding: [0x00,0x85,0x00,0x1a] + div $25, $11 # CHECK-TRAP: teq $11, $zero, 7 # encoding: [0x01,0x60,0x01,0xf4] # CHECK-TRAP: div $zero, $25, $11 # encoding: [0x03,0x2b,0x00,0x1a] @@ -62,3 +83,21 @@ div $0,$0 # CHECK-TRAP: div $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1a] + + div $4,$5,$6 +# CHECK-TRAP: teq $6, $zero, 7 # encoding: [0x00,0xc0,0x01,0xf4] +# CHECK-TRAP: div $zero, $5, $6 # encoding: [0x00,0xa6,0x00,0x1a] +# CHECK-TRAP: addiu $1, $zero, -1 # encoding: [0x24,0x01,0xff,0xff] +# CHECK-TRAP: bne $6, $1, 8 # encoding: [0x14,0xc1,0x00,0x02] +# CHECK-TRAP: lui $1, 32768 # encoding: [0x3c,0x01,0x80,0x00] +# CHECK-TRAP: teq $5, $1, 6 # encoding: [0x00,0xa1,0x01,0xb4] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + div $4,$5,$0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] + + div $4,$0,$0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] + + div $0, $4, $5 +# CHECK-TRAP: div $zero, $4, $5 # encoding: [0x00,0x85,0x00,0x1a]
\ No newline at end of file diff --git a/test/MC/Mips/macro-divu-bad.s b/test/MC/Mips/macro-divu-bad.s index 45cef1f8182..6eeaa614ff8 100644 --- a/test/MC/Mips/macro-divu-bad.s +++ b/test/MC/Mips/macro-divu-bad.s @@ -9,7 +9,7 @@ .text divu $25, $11 - # R6: :[[@LINE-1]]:3: error: instruction not supported on mips32r6 or mips64r6 + # R6: :[[@LINE-1]]:3: error: instruction requires a CPU feature not currently enabled divu $25, $0 # NOT-R6: :[[@LINE-1]]:3: warning: division by zero diff --git a/test/MC/Mips/macro-divu.s b/test/MC/Mips/macro-divu.s index 95630d34bd1..d8137d5ba73 100644 --- a/test/MC/Mips/macro-divu.s +++ b/test/MC/Mips/macro-divu.s @@ -27,23 +27,62 @@ divu $0,$0 # CHECK-NOTRAP: divu $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1b] - divu $25, $11 -# CHECK-TRAP: teq $11, $zero, 7 # encoding: [0x01,0x60,0x01,0xf4] -# CHECK-TRAP: divu $zero, $25, $11 # encoding: [0x03,0x2b,0x00,0x1b] -# CHECK-TRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] + divu $4,$5,$6 +# CHECK-NOTRAP: bnez $6, 8 # encoding: [0x14,0xc0,0x00,0x02] +# CHECK-NOTRAP: divu $zero, $5, $6 # encoding: [0x00,0xa6,0x00,0x1b] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] - divu $24,$12 -# CHECK-TRAP: teq $12, $zero, 7 # encoding: [0x01,0x80,0x01,0xf4] -# CHECK-TRAP: divu $zero, $24, $12 # encoding: [0x03,0x0c,0x00,0x1b] -# CHECK-TRAP: mflo $24 # encoding: [0x00,0x00,0xc0,0x12] + divu $4,$5,$0 +# CHECK-NOTRAP: bnez $zero, 8 # encoding: [0x14,0x00,0x00,0x02] +# CHECK-NOTRAP: divu $zero, $5, $zero # encoding: [0x00,0xa0,0x00,0x1b] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + divu $4,$0,$0 +# CHECK-NOTRAP: bnez $zero, 8 # encoding: [0x14,0x00,0x00,0x02] +# CHECK-NOTRAP: divu $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1b] +# CHECK-NOTRAP: break 7 # encoding: [0x00,0x07,0x00,0x0d] +# CHECK-NOTRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + divu $0, $4, $5 +# CHECK-NOTRAP: divu $zero, $4, $5 # encoding: [0x00,0x85,0x00,0x1b] + + divu $25, $11 +# CHECK-TRAP: teq $11, $zero, 7 # encoding: [0x01,0x60,0x01,0xf4] +# CHECK-TRAP: divu $zero, $25, $11 # encoding: [0x03,0x2b,0x00,0x1b] +# CHECK-TRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] + + divu $24,$12 +# CHECK-TRAP: teq $12, $zero, 7 # encoding: [0x01,0x80,0x01,0xf4] +# CHECK-TRAP: divu $zero, $24, $12 # encoding: [0x03,0x0c,0x00,0x1b] +# CHECK-TRAP: mflo $24 # encoding: [0x00,0x00,0xc0,0x12] divu $25,$0 -# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] -# CHECK-TRAP: divu $zero, $25, $zero # encoding: [0x03,0x20,0x00,0x1b] -# CHECK-TRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] +# CHECK-TRAP: divu $zero, $25, $zero # encoding: [0x03,0x20,0x00,0x1b] +# CHECK-TRAP: mflo $25 # encoding: [0x00,0x00,0xc8,0x12] divu $0,$9 -# CHECK-TRAP: divu $zero, $zero, $9 # encoding: [0x00,0x09,0x00,0x1b] +# CHECK-TRAP: divu $zero, $zero, $9 # encoding: [0x00,0x09,0x00,0x1b] divu $0,$0 -# CHECK-TRAP: divu $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1b] +# CHECK-TRAP: divu $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1b] + + divu $4,$5,$6 +# CHECK-TRAP: teq $6, $zero, 7 # encoding: [0x00,0xc0,0x01,0xf4] +# CHECK-TRAP: divu $zero, $5, $6 # encoding: [0x00,0xa6,0x00,0x1b] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + divu $4,$5,$0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] +# CHECK-TRAP: divu $zero, $5, $zero # encoding: [0x00,0xa0,0x00,0x1b] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + divu $4,$0,$0 +# CHECK-TRAP: teq $zero, $zero, 7 # encoding: [0x00,0x00,0x01,0xf4] +# CHECK-TRAP: divu $zero, $zero, $zero # encoding: [0x00,0x00,0x00,0x1b] +# CHECK-TRAP: mflo $4 # encoding: [0x00,0x00,0x20,0x12] + + divu $0, $4, $5 +# CHECK-TRAP: divu $zero, $4, $5 # encoding: [0x00,0x85,0x00,0x1b]
\ No newline at end of file |