summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTony Gutierrez <anthony.gutierrez@amd.com>2016-11-21 15:35:56 -0500
committerTony Gutierrez <anthony.gutierrez@amd.com>2016-11-21 15:35:56 -0500
commit0799600686a918c06ffad72221ba3e3c961d3164 (patch)
tree9ad019c70f2d5bfb418ed7279d1e1c8e027c3a6c /src
parent29d38e75762e195161786be60c695fba1b77c7de (diff)
downloadgem5-0799600686a918c06ffad72221ba3e3c961d3164.tar.xz
x86: fix issue with casting in Cvtf2i
UBSAN flags this operation because it detects that arg is being cast directly to an unsigned type, argBits. this patch fixes this by first casting the value to a signed int type, then reintrepreting the raw bits of the signed int into argBits.
Diffstat (limited to 'src')
-rw-r--r--src/arch/x86/isa/microops/mediaop.isa6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/arch/x86/isa/microops/mediaop.isa b/src/arch/x86/isa/microops/mediaop.isa
index cdb3b4899..63e22a23f 100644
--- a/src/arch/x86/isa/microops/mediaop.isa
+++ b/src/arch/x86/isa/microops/mediaop.isa
@@ -1220,9 +1220,11 @@ let {{
}
if (destSize == 4) {
- argBits = (uint32_t)arg;
+ int32_t i_arg = (int32_t)arg;
+ argBits = *((uint32_t*)&i_arg);
} else {
- argBits = (uint64_t)arg;
+ int64_t i_arg = (int64_t)arg;
+ argBits = *((uint64_t*)&i_arg);
}
int destHiIndex = destStart + (i + 1) * destSizeBits - 1;
int destLoIndex = destStart + (i + 0) * destSizeBits;