[llvm-bugs] [Bug 33682] New: endianness bug in visitTRUNCATE
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Jul 3 11:27:52 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=33682
Bug ID: 33682
Summary: endianness bug in visitTRUNCATE
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Common Code Generator Code
Assignee: unassignedbugs at nondot.org
Reporter: pichet2000 at gmail.com
CC: llvm-bugs at lists.llvm.org
// Fold truncate of a bitcast of a vector to an extract of the low vector
// element.
//
// e.g. trunc (i64 (bitcast v2i32:x)) -> extract_vector_elt v2i32:x, 0
This is not true on big-endian architecture.
return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, SL, VT,
VecSrc, DAG.getConstant(0, SL, IdxVT));
Should be replaced by:
unsigned Idx = DAG.getDataLayout().isBigEndian() ? 1 : 0;
return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, SL, VT,
VecSrc, DAG.getConstant(Idx, SL, IdxVT));
I found this while investigating codegen failure on an out of test big-endian
target.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170703/8e4b3c42/attachment.html>
More information about the llvm-bugs
mailing list