diff options
author | Craig Topper <craig.topper@intel.com> | 2019-12-18 10:41:34 -0800 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2019-12-18 10:44:28 -0800 |
commit | cfe316007fb8492535d697717c24ce72621a8d5e (patch) | |
tree | 0c73cbbc9fabf693a0685b6f8fe6e9f8c3ba07f4 | |
parent | ec3d6f3ecb4ef3cef2d46d6d2b2b7dced35e8297 (diff) | |
download | llvm-cfe316007fb8492535d697717c24ce72621a8d5e.zip llvm-cfe316007fb8492535d697717c24ce72621a8d5e.tar.gz llvm-cfe316007fb8492535d697717c24ce72621a8d5e.tar.bz2 |
[SelectionDAGBuilder] Use getConstant instead of getTargetConstant to build the offset for struct types in getUniformBase.
getTargetConstant prevents any optimizations from operating on the
value and basically says its already been iseled. But since we
want the index to be in a register, this isn't true.
Prior to this we were generating a vbroadcast with an immediate
argument which is illegal and was flagged by the expensive checks
bot.
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 4 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/masked_gather.ll | 11 |
2 files changed, 8 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 735ac67..c69fe55 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -4390,8 +4390,8 @@ static bool getUniformBase(const Value *&Ptr, SDValue &Base, SDValue &Index, } auto *CI = cast<ConstantInt>(C); Scale = DAG.getTargetConstant(1, SDB->getCurSDLoc(), TLI.getPointerTy(DL)); - Index = DAG.getTargetConstant(SL->getElementOffset(CI->getZExtValue()), - SDB->getCurSDLoc(), TLI.getPointerTy(DL)); + Index = DAG.getConstant(SL->getElementOffset(CI->getZExtValue()), + SDB->getCurSDLoc(), TLI.getPointerTy(DL)); } else { Scale = DAG.getTargetConstant( DL.getTypeAllocSize(GEP->getResultElementType()), diff --git a/llvm/test/CodeGen/X86/masked_gather.ll b/llvm/test/CodeGen/X86/masked_gather.ll index dd41009..7ea2cac 100644 --- a/llvm/test/CodeGen/X86/masked_gather.ll +++ b/llvm/test/CodeGen/X86/masked_gather.ll @@ -1725,13 +1725,14 @@ define <8 x i32> @gather_v8i32_v8i32(<8 x i32> %trigger) { ; AVX512-LABEL: gather_v8i32_v8i32: ; AVX512: # %bb.0: ; AVX512-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0 -; AVX512-NEXT: vptestnmd %zmm0, %zmm0, %k1 -; AVX512-NEXT: kshiftlw $8, %k1, %k0 -; AVX512-NEXT: kshiftrw $8, %k0, %k2 +; AVX512-NEXT: vptestnmd %zmm0, %zmm0, %k0 +; AVX512-NEXT: kshiftlw $8, %k0, %k0 +; AVX512-NEXT: kshiftrw $8, %k0, %k1 ; AVX512-NEXT: vpbroadcastd {{.*#+}} zmm0 = [3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3] +; AVX512-NEXT: kmovw %k1, %k2 ; AVX512-NEXT: vpgatherdd c(,%zmm0,4), %zmm1 {%k2} -; AVX512-NEXT: vpbroadcastq $28, %zmm0 -; AVX512-NEXT: vpgatherqd c(,%zmm0), %ymm2 {%k1} +; AVX512-NEXT: vpbroadcastd {{.*#+}} zmm0 = [28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28] +; AVX512-NEXT: vpgatherdd c(,%zmm0), %zmm2 {%k1} ; AVX512-NEXT: vpaddd %ymm2, %ymm2, %ymm0 ; AVX512-NEXT: vpaddd %ymm0, %ymm1, %ymm0 ; AVX512-NEXT: retq |