From 7bec57300c799632d282d67916745b6d20a12e6f Mon Sep 17 00:00:00 2001 From: Stanislav Mekhanoshin Date: Wed, 13 Jun 2018 18:52:54 +0000 Subject: [AMDGPU] Corrected computeKnownBits for V_PERM_B32 Differential Revision: https://reviews.llvm.org/D48133 llvm-svn: 334640 --- llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'llvm/lib/Target') diff --git a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp index 148de14dd5e..19106a5ae8d 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp @@ -4317,18 +4317,19 @@ void AMDGPUTargetLowering::computeKnownBitsForTargetNode( unsigned Sel = CMask->getZExtValue(); for (unsigned I = 0; I < 32; I += 8) { - unsigned ByteMask = 0xff << I; unsigned SelBits = Sel & 0xff; if (SelBits < 4) { - Known.One |= RHSKnown.One & ByteMask; - Known.Zero |= RHSKnown.Zero & ByteMask; + SelBits *= 8; + Known.One |= ((RHSKnown.One.getZExtValue() >> SelBits) & 0xff) << I; + Known.Zero |= ((RHSKnown.Zero.getZExtValue() >> SelBits) & 0xff) << I; } else if (SelBits < 7) { - Known.One |= LHSKnown.One & ByteMask; - Known.Zero |= LHSKnown.Zero & ByteMask; + SelBits = (SelBits & 3) * 8; + Known.One |= ((LHSKnown.One.getZExtValue() >> SelBits) & 0xff) << I; + Known.Zero |= ((LHSKnown.Zero.getZExtValue() >> SelBits) & 0xff) << I; } else if (SelBits == 0x0c) { - Known.Zero |= ByteMask; + Known.Zero |= 0xff << I; } else if (SelBits > 0x0c) { - Known.One |= ByteMask; + Known.One |= 0xff << I; } Sel >>= 8; } -- cgit v1.2.3