X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=lib%2FTarget%2FR600%2FAMDGPUISelLowering.cpp;h=bf8daf96604b018b5622f3800323d49f75360817;hp=89dab098710558c2c8adaeaa90a201d8ee532801;hb=bd2b96a12dba4e333f49d1a04d2072aa3ec92478;hpb=9b676fd6f283d2a9da6d48286b7174a1a2dc7b28 diff --git a/lib/Target/R600/AMDGPUISelLowering.cpp b/lib/Target/R600/AMDGPUISelLowering.cpp index 89dab098710..bf8daf96604 100644 --- a/lib/Target/R600/AMDGPUISelLowering.cpp +++ b/lib/Target/R600/AMDGPUISelLowering.cpp @@ -1896,7 +1896,8 @@ template static SDValue constantFoldBFE(SelectionDAG &DAG, IntTy Src0, uint32_t Offset, uint32_t Width) { if (Width + Offset < 32) { - IntTy Result = (Src0 << (32 - Offset - Width)) >> (32 - Width); + uint32_t Shl = static_cast(Src0) << (32 - Offset - Width); + IntTy Result = static_cast(Shl) >> (32 - Width); return DAG.getConstant(Result, MVT::i32); } @@ -2053,12 +2054,8 @@ SDValue AMDGPUTargetLowering::PerformDAGCombine(SDNode *N, // Avoid undefined left shift of a negative in the constant fold. // TODO: I'm not sure what the behavior of the hardware is, this should // probably follow that instead. - int32_t Val = CVal->getSExtValue(); - if (Val < 0) - return SDValue(); - return constantFoldBFE(DAG, - Val, + CVal->getSExtValue(), OffsetVal, WidthVal); }