[llvm] r289235 - AMDGPU: Fix isTypeDesirableForOp for i16

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 9 09:57:43 PST 2016


Author: arsenm
Date: Fri Dec  9 11:57:43 2016
New Revision: 289235

URL: http://llvm.org/viewvc/llvm-project?rev=289235&view=rev
Log:
AMDGPU: Fix isTypeDesirableForOp for i16

This should do nothing for targets without i16.

Modified:
    llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp

Modified: llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp?rev=289235&r1=289234&r2=289235&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIISelLowering.cpp Fri Dec  9 11:57:43 2016
@@ -658,10 +658,22 @@ bool SITargetLowering::shouldConvertCons
 }
 
 bool SITargetLowering::isTypeDesirableForOp(unsigned Op, EVT VT) const {
+  if (Subtarget->has16BitInsts() && VT == MVT::i16) {
+    switch (Op) {
+    case ISD::LOAD:
+    case ISD::STORE:
 
-  // i16 is not desirable unless it is a load or a store.
-  if (VT == MVT::i16 && Op != ISD::LOAD && Op != ISD::STORE)
-    return false;
+    // These operations are done with 32-bit instructions anyway.
+    case ISD::AND:
+    case ISD::OR:
+    case ISD::XOR:
+    case ISD::SELECT:
+      // TODO: Extensions?
+      return true;
+    default:
+      return false;
+    }
+  }
 
   // SimplifySetCC uses this function to determine whether or not it should
   // create setcc with i1 operands.  We don't have instructions for i1 setcc.




More information about the llvm-commits mailing list