summaryrefslogtreecommitdiff
path: root/src/arch/arm/isa/insts
diff options
context:
space:
mode:
authorAndrea Mondelli <Andrea.Mondelli@ucf.edu>2019-03-14 18:20:54 -0400
committerAndrea Mondelli <Andrea.Mondelli@ucf.edu>2019-04-01 15:55:58 +0000
commit283e092eda0b739a3c28bfa6293822e57ca67db6 (patch)
treeba58ed333e5a365e76518aad47a2568d5409d070 /src/arch/arm/isa/insts
parent2a98a994df296f818b05da90ba073d879562da04 (diff)
downloadgem5-283e092eda0b739a3c28bfa6293822e57ca67db6.tar.xz
dev-arm: Correct cast of template parameter
Clang with -Wconstant-conversion is _very_ restrictive on casting. The shift operator results in an incorrect promotion. This patch add a compile-time static cast that remove the error when clang is used. Change-Id: I3aa1e77da2565799feadc32317d5faa111b2de86 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17308 Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Diffstat (limited to 'src/arch/arm/isa/insts')
-rw-r--r--src/arch/arm/isa/insts/sve.isa16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/arch/arm/isa/insts/sve.isa b/src/arch/arm/isa/insts/sve.isa
index 647ceafe3..e5e9e2450 100644
--- a/src/arch/arm/isa/insts/sve.isa
+++ b/src/arch/arm/isa/insts/sve.isa
@@ -4278,7 +4278,9 @@ let {{
bool negSrc1 = (srcElem1 < 0);
bool negSrc2 = (srcElem2 < 0);
if ((negDest != negSrc1) && (negSrc1 == negSrc2)) {
- destElem = (Element)1 << (sizeof(Element) * 8 - 1);
+ destElem = static_cast<Element>(
+ (Element)1 << (sizeof(Element) * 8 - 1)
+ );
if (negDest)
destElem -= 1;
}
@@ -4293,7 +4295,9 @@ let {{
bool negSrc = (srcElem1 < 0);
bool posCount = ((count * imm) >= 0);
if ((negDest != negSrc) && (negSrc == posCount)) {
- destElem = (%(dstType)s)1 << (sizeof(%(dstType)s) * 8 - 1);
+ destElem = static_cast<%(dstType)s>(
+ (%(dstType)s)1 << (sizeof(%(dstType)s) * 8 - 1)
+ );
if (negDest)
destElem -= 1;
}
@@ -4350,7 +4354,9 @@ let {{
bool negSrc = (srcElem1 < 0);
bool negCount = ((count * imm) < 0);
if ((negDest != negSrc) && (negSrc == negCount)) {
- destElem = (%(dstType)s)1 << (sizeof(%(dstType)s) * 8 - 1);
+ destElem = static_cast<%(dstType)s>(
+ (%(dstType)s)1 << (sizeof(%(dstType)s) * 8 - 1)
+ );
if (negDest)
destElem -= 1;
}
@@ -4407,7 +4413,9 @@ let {{
bool negSrc1 = (srcElem1 < 0);
bool posSrc2 = (srcElem2 >= 0);
if ((negDest != negSrc1) && (negSrc1 == posSrc2)) {
- destElem = (Element)1 << (sizeof(Element) * 8 - 1);
+ destElem = static_cast<Element>(
+ (Element)1 << (sizeof(Element) * 8 - 1)
+ );
if (negDest)
destElem -= 1;
}