diff options
| author | Craig Topper <craig.topper@intel.com> | 2018-06-14 22:02:35 +0000 |
|---|---|---|
| committer | Craig Topper <craig.topper@intel.com> | 2018-06-14 22:02:35 +0000 |
| commit | 31730ae761724be1787cf6400e60097d09dafa81 (patch) | |
| tree | 226ee21f56bab02dc96be6f2a87ea436a8dc8de8 /clang/lib/CodeGen | |
| parent | 2153c42358ac1b30d3b9ca97c38b747b9a819585 (diff) | |
| download | bcm5719-llvm-31730ae761724be1787cf6400e60097d09dafa81.tar.gz bcm5719-llvm-31730ae761724be1787cf6400e60097d09dafa81.zip | |
[X86] Rename __builtin_ia32_pslldqi128 to __builtin_ia32_pslldqi128_byteshift and similar for other sizes. Remove the multiply by 8 from the header files.
The previous names took the shift amount in bits to match gcc and required a multiply by 8 in the header. This creates a misleading error message when we check the range of the immediate to the builtin since the allowed range also got multiplied by 8.
This commit changes the builtins to use a byte shift amount to match the underlying instruction and the Intel intrinsic.
Fixes the remaining issue from PR37795.
llvm-svn: 334773
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGBuiltin.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index 08175b3dfc4..2393957e1b6 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -9690,11 +9690,10 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID, "vperm"); } - case X86::BI__builtin_ia32_pslldqi128: - case X86::BI__builtin_ia32_pslldqi256: - case X86::BI__builtin_ia32_pslldqi512: { - // Shift value is in bits so divide by 8. - unsigned ShiftVal = cast<llvm::ConstantInt>(Ops[1])->getZExtValue() >> 3; + case X86::BI__builtin_ia32_pslldqi128_byteshift: + case X86::BI__builtin_ia32_pslldqi256_byteshift: + case X86::BI__builtin_ia32_pslldqi512_byteshift: { + unsigned ShiftVal = cast<llvm::ConstantInt>(Ops[1])->getZExtValue(); llvm::Type *ResultType = Ops[0]->getType(); // Builtin type is vXi64 so multiply by 8 to get bytes. unsigned NumElts = ResultType->getVectorNumElements() * 8; @@ -9721,11 +9720,10 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID, "pslldq"); return Builder.CreateBitCast(SV, Ops[0]->getType(), "cast"); } - case X86::BI__builtin_ia32_psrldqi128: - case X86::BI__builtin_ia32_psrldqi256: - case X86::BI__builtin_ia32_psrldqi512: { - // Shift value is in bits so divide by 8. - unsigned ShiftVal = cast<llvm::ConstantInt>(Ops[1])->getZExtValue() >> 3; + case X86::BI__builtin_ia32_psrldqi128_byteshift: + case X86::BI__builtin_ia32_psrldqi256_byteshift: + case X86::BI__builtin_ia32_psrldqi512_byteshift: { + unsigned ShiftVal = cast<llvm::ConstantInt>(Ops[1])->getZExtValue(); llvm::Type *ResultType = Ops[0]->getType(); // Builtin type is vXi64 so multiply by 8 to get bytes. unsigned NumElts = ResultType->getVectorNumElements() * 8; |

