[llvm-commits] [llvm] r148383 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp test/CodeGen/X86/2012-01-18-vbitcast.ll
Nadav Rotem
nadav.rotem at intel.com
Wed Jan 18 00:33:18 PST 2012
Author: nadav
Date: Wed Jan 18 02:33:18 2012
New Revision: 148383
URL: http://llvm.org/viewvc/llvm-project?rev=148383&view=rev
Log:
Fix a bug in the type-legalization of vector integers. When we bitcast one vector type to another, we must not bitcast the result if one type is widened while the other is promoted.
Added:
llvm/trunk/test/CodeGen/X86/2012-01-18-vbitcast.ll
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp?rev=148383&r1=148382&r2=148383&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Wed Jan 18 02:33:18 2012
@@ -249,8 +249,10 @@
return DAG.getNode(ISD::BITCAST, dl, NOutVT, InOp);
}
case TargetLowering::TypeWidenVector:
- if (NOutVT.bitsEq(NInVT))
- // The input is widened to the same size. Convert to the widened value.
+ // The input is widened to the same size. Convert to the widened value.
+ // Make sure that the outgoing value is not a vector, because this would
+ // make us bitcast between two vectors which are legalized in different ways.
+ if (NOutVT.bitsEq(NInVT) && !NOutVT.isVector())
return DAG.getNode(ISD::BITCAST, dl, NOutVT, GetWidenedVector(InOp));
}
Added: llvm/trunk/test/CodeGen/X86/2012-01-18-vbitcast.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2012-01-18-vbitcast.ll?rev=148383&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2012-01-18-vbitcast.ll (added)
+++ llvm/trunk/test/CodeGen/X86/2012-01-18-vbitcast.ll Wed Jan 18 02:33:18 2012
@@ -0,0 +1,14 @@
+; RUN: llc < %s -march=x86-64 -mcpu=corei7 -mtriple=x86_64-pc-win32 | FileCheck %s
+
+;CHECK: vcast
+define <2 x i32> @vcast(<2 x float> %a, <2 x float> %b) {
+;CHECK: pshufd
+;CHECK: pshufd
+ %af = bitcast <2 x float> %a to <2 x i32>
+ %bf = bitcast <2 x float> %b to <2 x i32>
+ %x = sub <2 x i32> %af, %bf
+;CHECK: psubq
+ ret <2 x i32> %x
+;CHECK: ret
+}
+
More information about the llvm-commits
mailing list