[llvm-branch-commits] [llvm-branch] r259713 - Merging r259177:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Feb 3 14:00:13 PST 2016


Author: hans
Date: Wed Feb  3 16:00:13 2016
New Revision: 259713

URL: http://llvm.org/viewvc/llvm-project?rev=259713&view=rev
Log:
Merging r259177:
------------------------------------------------------------------------
r259177 | echristo | 2016-01-28 23:20:01 -0800 (Thu, 28 Jan 2016) | 5 lines

Since LI/LIS sign extend the constant passed into the instruction we should
check that the sign extended constant fits into 16-bits if we want a
zero extended value, otherwise go ahead and put it together piecemeal.

Fixes PR26356.
------------------------------------------------------------------------

Modified:
    llvm/branches/release_38/   (props changed)
    llvm/branches/release_38/lib/Target/PowerPC/PPCFastISel.cpp
    llvm/branches/release_38/test/CodeGen/PowerPC/fast-isel-ret.ll

Propchange: llvm/branches/release_38/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb  3 16:00:13 2016
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,257645,257648,257730,257775,257791,257875,257886,257902,257905,257925,257929-257930,257940,257942,257977,257979,257997,258168,258184,258207,258221,258273,258325,258406,258416,258428,258436,258471,258690,258729,258891,258971,259228,259236,259342,259346,259375,259645,259649
+/llvm/trunk:155241,257645,257648,257730,257775,257791,257875,257886,257902,257905,257925,257929-257930,257940,257942,257977,257979,257997,258168,258184,258207,258221,258273,258325,258406,258416,258428,258436,258471,258690,258729,258891,258971,259177,259228,259236,259342,259346,259375,259645,259649

Modified: llvm/branches/release_38/lib/Target/PowerPC/PPCFastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_38/lib/Target/PowerPC/PPCFastISel.cpp?rev=259713&r1=259712&r2=259713&view=diff
==============================================================================
--- llvm/branches/release_38/lib/Target/PowerPC/PPCFastISel.cpp (original)
+++ llvm/branches/release_38/lib/Target/PowerPC/PPCFastISel.cpp Wed Feb  3 16:00:13 2016
@@ -2099,7 +2099,9 @@ unsigned PPCFastISel::PPCMaterializeInt(
     BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, TII.get(Opc), ImmReg)
         .addImm(CI->getSExtValue());
     return ImmReg;
-  } else if (!UseSExt && isUInt<16>(CI->getZExtValue())) {
+  } else if (!UseSExt && isUInt<16>(CI->getSExtValue())) {
+    // Since LI will sign extend the constant we need to make sure that for
+    // our zeroext constants that the sign extended constant fits into 16-bits.
     unsigned Opc = (VT == MVT::i64) ? PPC::LI8 : PPC::LI;
     unsigned ImmReg = createResultReg(RC);
     BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, TII.get(Opc), ImmReg)
@@ -2109,7 +2111,6 @@ unsigned PPCFastISel::PPCMaterializeInt(
 
   // Construct the constant piecewise.
   int64_t Imm = UseSExt ? CI->getSExtValue() : CI->getZExtValue();
-
   if (VT == MVT::i64)
     return PPCMaterialize64BitInt(Imm, RC);
   else if (VT == MVT::i32)

Modified: llvm/branches/release_38/test/CodeGen/PowerPC/fast-isel-ret.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_38/test/CodeGen/PowerPC/fast-isel-ret.ll?rev=259713&r1=259712&r2=259713&view=diff
==============================================================================
--- llvm/branches/release_38/test/CodeGen/PowerPC/fast-isel-ret.ll (original)
+++ llvm/branches/release_38/test/CodeGen/PowerPC/fast-isel-ret.ll Wed Feb  3 16:00:13 2016
@@ -186,3 +186,12 @@ entry:
 ; ELF64: blr
   ret i32 -1
 }
+
+define zeroext i16 @ret20() nounwind {
+entry:
+; ELF64-LABEL: ret20
+; ELF64: lis{{.*}}0
+; ELF64: ori{{.*}}32768
+; ELF64: blr
+  ret i16 32768
+}




More information about the llvm-branch-commits mailing list