[PATCH] D33594: [mips][dsp] Modify repl.ph to accept signed immediate values

Stefan Maksimovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 26 06:21:28 PDT 2017


smaksimovic created this revision.
Herald added a subscriber: arichardson.

Changed immediate type for repl.ph from uimm10 to simm10 as per the specs.
Repl.qb still accepts uimm8. Both instructions now mimic the behaviour of GNU as.


https://reviews.llvm.org/D33594

Files:
  lib/Target/Mips/MipsDSPInstrInfo.td
  test/CodeGen/Mips/dsp-r1.ll


Index: test/CodeGen/Mips/dsp-r1.ll
===================================================================
--- test/CodeGen/Mips/dsp-r1.ll
+++ test/CodeGen/Mips/dsp-r1.ll
@@ -1172,9 +1172,19 @@
   ret { i32 } %.fca.0.insert
 }
 
+define { i32 } @test__builtin_mips_repl_ph2(i32 %i0) nounwind readnone {
+entry:
+; CHECK: repl.ph
+
+  %0 = tail call <2 x i16> @llvm.mips.repl.ph(i32 -2)
+  %1 = bitcast <2 x i16> %0 to i32
+  %.fca.0.insert = insertvalue { i32 } undef, i32 %1, 0
+  ret { i32 } %.fca.0.insert
+}
+
 declare <2 x i16> @llvm.mips.repl.ph(i32) nounwind readnone
 
-define { i32 } @test__builtin_mips_repl_ph2(i32 %i0, i32 %a0) nounwind readnone {
+define { i32 } @test__builtin_mips_repl_ph3(i32 %i0, i32 %a0) nounwind readnone {
 entry:
 ; CHECK: replv.ph
 
Index: lib/Target/Mips/MipsDSPInstrInfo.td
===================================================================
--- lib/Target/Mips/MipsDSPInstrInfo.td
+++ lib/Target/Mips/MipsDSPInstrInfo.td
@@ -18,6 +18,7 @@
 def immZExt4 : ImmLeaf<i32, [{return isUInt<4>(Imm);}]>;
 def immZExt8 : ImmLeaf<i32, [{return isUInt<8>(Imm);}]>;
 def immZExt10 : ImmLeaf<i32, [{return isUInt<10>(Imm);}]>;
+def immSExt10 : ImmLeaf<i32, [{return isInt<10>(Imm);}]>;
 def immSExt6 : ImmLeaf<i32, [{return isInt<6>(Imm);}]>;
 
 // Mips-specific dsp nodes
@@ -851,8 +852,8 @@
 class REPL_QB_DESC : REPL_DESC_BASE<"repl.qb", int_mips_repl_qb, uimm8,
                                     immZExt8, NoItinerary, DSPROpnd>;
 
-class REPL_PH_DESC : REPL_DESC_BASE<"repl.ph", int_mips_repl_ph, uimm10,
-                                    immZExt10, NoItinerary, DSPROpnd>;
+class REPL_PH_DESC : REPL_DESC_BASE<"repl.ph", int_mips_repl_ph, simm10,
+                                    immSExt10, NoItinerary, DSPROpnd>;
 
 class REPLV_QB_DESC : ABSQ_S_PH_R2_DESC_BASE<"replv.qb", int_mips_repl_qb,
                                              NoItinerary, DSPROpnd, GPR32Opnd>;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33594.100397.patch
Type: text/x-patch
Size: 1916 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170526/3d438a5c/attachment.bin>


More information about the llvm-commits mailing list