[PATCH] Add sign/zero extend to mips fast-isel
Chad Rosier
mcrosier at codeaurora.org
Thu Aug 28 17:47:24 PDT 2014
================
Comment at: lib/Target/Mips/MipsFastISel.cpp:251
@@ -243,1 +250,3 @@
+bool MipsFastISel::EmitIntSExt(MVT SrcVT, unsigned SrcReg, MVT DestVT,
+ unsigned DestReg) {
----------------
Consider refactoring EmitIntSExt into a single function with a bool parameter, isSigned, that indicates if we're sign-extending or zero-extending. I think as you continue to developer fast-isel you'll see a lot of redundancies between these functions.
================
Comment at: lib/Target/Mips/MipsFastISel.cpp:357
@@ +356,3 @@
+
+ unsigned SrcReg =
+ getRegForValue(Src); // his must be a 32 bit floating point register class
----------------
clang-format?
Comments should be complete sentences with proper punctuation.
================
Comment at: lib/Target/Mips/MipsFastISel.cpp:392
@@ +391,3 @@
+ if (isZExt) {
+ if (!EmitIntZExt(SrcVT, SrcReg, DestVT, ResultReg))
+ return false;
----------------
Pass isZExt as a parameter, per the suggestion above. Logic will be simplified here as well.
================
Comment at: lib/Target/Mips/MipsFastISel.cpp:411
@@ +410,3 @@
+
+ if (SrcVT != MVT::i32 && SrcVT != MVT::i16 && SrcVT != MVT::i8)
+ return false;
----------------
These are the correct type of checks, IMO. It is much easier to understand when reviewing/refactoring.
http://reviews.llvm.org/D4827
More information about the llvm-commits
mailing list