[PATCH] D16889: [mips] Addition of the immediate cases for the instructions [d]div, [d]divu

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 11 06:09:57 PST 2016


dsanders accepted this revision.
dsanders added a comment.
This revision is now accepted and ready to land.

LGTM with a couple small changes


================
Comment at: lib/Target/Mips/MipsInstrInfo.td:2066
@@ +2065,3 @@
+def SDivIMacro : MipsAsmPseudoInst<(outs GPR32Opnd:$rd),
+                                   (ins GPR32Opnd:$rs, simm16:$imm),
+                                   "div\t$rd, $rs, $imm">,
----------------
I believe this simm16 should be simm32. It currently works because I haven't added range checking to simm16 yet.

Similarly for the other 32-bit divides below.

================
Comment at: lib/Target/Mips/MipsInstrInfo.td:2093
@@ +2092,3 @@
+def DSDivIMacro : MipsAsmPseudoInst<(outs GPR32Opnd:$rd),
+                                    (ins GPR32Opnd:$rs, simm16:$imm),
+                                    "ddiv\t$rd, $rs, $imm">,
----------------
I believe this simm16 should be simm64. It currently works because I haven't added range checking to simm16 yet.

Similarly for the other 64-bit divides below.

================
Comment at: test/MC/Mips/macro-ddiv.s:83-87
@@ +82,7 @@
+
+  ddiv $4,0x1a5a5
+# CHECK-NOTRAP: lui $1, 1                 # encoding: [0x3c,0x01,0x00,0x01]
+# CHECK-NOTRAP: ori $1, $1, 42405         # encoding: [0x34,0x21,0xa5,0xa5]
+# CHECK-NOTRAP: ddiv $zero, $4, $1        # encoding: [0x00,0x81,0x00,0x1e]
+# CHECK-NOTRAP: mflo $4                   # encoding: [0x00,0x00,0x20,0x12]
+
----------------
Could you add a 64-bit constant too?

================
Comment at: test/MC/Mips/macro-ddiv.s:185
@@ -108,2 +184,3 @@
 
-  ddiv  $4,$5,$6
+  ddiv $4,0
+# CHECK-TRAP: teq $zero, $zero, 7         # encoding: [0x00,0x00,0x01,0xf4]
----------------
>From this point onwards, the tests look like duplicates of the first half but checking the trap case. In a separate patch, could you fold these together so each one looks something like:
  ddiv $4, 0
  # CHECK-NOTRAP: break 7                   # encoding: [0x00,0x07,0x00,0x0d]
  # CHECK-TRAP: teq $zero, $zero, 7         # encoding: [0x00,0x00,0x01,0xf4]

Likewise for the other division macro test files in this review.


http://reviews.llvm.org/D16889





More information about the llvm-commits mailing list