[PATCH] D85225: [Target][AArch64] Allow for char as int8_t in AArch64AsmParser.cpp
Rainer Orth via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 19 02:10:39 PDT 2020
ro updated this revision to Diff 286510.
ro added a comment.
Use sizeof(T) == 2 check, too.
Update variable name.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85225/new/
https://reviews.llvm.org/D85225
Files:
llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h
Index: llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h
===================================================================
--- llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h
+++ llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h
@@ -763,10 +763,10 @@
bool IsImm8 = int8_t(Imm) == Imm;
bool IsImm16 = int16_t(Imm & ~0xff) == Imm;
- if (std::is_same<int8_t, std::make_signed_t<T>>::value)
+ if (sizeof(T) == 1)
return IsImm8 || uint8_t(Imm) == Imm;
- if (std::is_same<int16_t, std::make_signed_t<T>>::value)
+ if (sizeof(T) == 2)
return IsImm8 || IsImm16 || uint16_t(Imm & ~0xff) == Imm;
return IsImm8 || IsImm16;
@@ -775,8 +775,8 @@
/// Returns true if Imm is valid for ADD/SUB.
template <typename T>
static inline bool isSVEAddSubImm(int64_t Imm) {
- bool IsInt8t = std::is_same<int8_t, std::make_signed_t<T>>::value;
- return uint8_t(Imm) == Imm || (!IsInt8t && uint16_t(Imm & ~0xff) == Imm);
+ bool IsByte = sizeof(T) == 1;
+ return uint8_t(Imm) == Imm || (!IsByte && uint16_t(Imm & ~0xff) == Imm);
}
/// Return true if Imm is valid for DUPM and has no single CPY/DUP equivalent.
Index: llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
===================================================================
--- llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
+++ llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
@@ -855,7 +855,7 @@
if (!isShiftedImm() && (!isImm() || !isa<MCConstantExpr>(getImm())))
return DiagnosticPredicateTy::NoMatch;
- bool IsByte = std::is_same<int8_t, std::make_signed_t<T>>::value;
+ bool IsByte = sizeof(T) == 1;
if (auto ShiftedImm = getShiftedVal<8>())
if (!(IsByte && ShiftedImm->second) &&
AArch64_AM::isSVECpyImm<T>(uint64_t(ShiftedImm->first)
@@ -872,7 +872,7 @@
if (!isShiftedImm() && (!isImm() || !isa<MCConstantExpr>(getImm())))
return DiagnosticPredicateTy::NoMatch;
- bool IsByte = std::is_same<int8_t, std::make_signed_t<T>>::value;
+ bool IsByte = sizeof(T) == 1;
if (auto ShiftedImm = getShiftedVal<8>())
if (!(IsByte && ShiftedImm->second) &&
AArch64_AM::isSVEAddSubImm<T>(ShiftedImm->first
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85225.286510.patch
Type: text/x-patch
Size: 2217 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200819/242b81ed/attachment.bin>
More information about the llvm-commits
mailing list