Do not assume little endian architecture in DAGCombiner::visitTRUNCATE and DAGCombiner::visitEXTRACT_VECTOR_ELT.
PR33682
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
You should upload patches with more context i.e. git diff -U9999.
I'm seeing the reported issue with MIPS, here's a testcase, you may need to file the rough edges off.
It can go in test/CodeGen/Mips/pr33682.ll
; RUN: llc -march=mips -mcpu=mips32 < %s | FileCheck --check-prefixes=ALL,BE ; RUN: llc -march=mipsel -mcpu=mips32 < %s | FileCheck --check-prefixes=ALL,LE ; Verify visitTRUNCATE respects endianness when transforming truncates to extract vector element. ; ALL-LABEL: a: ; BE: lw $2, 4($4) ; LE: lw $2, 0($4) define i32 @a(<2 x i32> * %a) { entry: %0 = load <2 x i32>, <2 x i32> * %a %1 = bitcast <2 x i32> %0 to i64 %2 = trunc i64 %1 to i32 ret i32 %2 }
lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
8377 | I'm not sure this is generally correct - for example what about the (i16 trunc (i64 (bitcast v4i16:x))) case? Shouldn't the extracted big-endian index then be 3? |
Comment Actions
2 quick things, summary could do with an update (as now there is a test case), but that can be done on commit.
The other is that the case you've highlighted @RKSimon should probably be added to the test case.
Thanks.
I'm not sure this is generally correct - for example what about the (i16 trunc (i64 (bitcast v4i16:x))) case? Shouldn't the extracted big-endian index then be 3?