[PATCH] D136726: [SelectionDAGBuilder] use bitcast instead of AnyExtOrTrunc if copy parts from an int vector to a float vector to fix issue #58615
Henry Yu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 26 14:54:26 PDT 2022
HazyFish updated this revision to Diff 470944.
HazyFish added a comment.
format
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136726/new/
https://reviews.llvm.org/D136726
Files:
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/test/CodeGen/AArch64/aarch64-v1f32-arg.ll
Index: llvm/test/CodeGen/AArch64/aarch64-v1f32-arg.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AArch64/aarch64-v1f32-arg.ll
@@ -0,0 +1,11 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=aarch64 | FileCheck %s
+
+define <1 x float> @f(<16 x i64> %0, <1 x float> %1) {
+; CHECK-LABEL: f:
+; CHECK: // %bb.0: // %BB
+; CHECK-NEXT: ldr d0, [sp]
+; CHECK-NEXT: ret
+BB:
+ ret <1 x float> %1
+}
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -398,10 +398,9 @@
if (ValueVT.getSizeInBits() == PartEVT.getSizeInBits())
return DAG.getNode(ISD::BITCAST, DL, ValueVT, Val);
- // If the element type of the source/dest vectors are the same, but the
- // parts vector has more elements than the value vector, then we have a
- // vector widening case (e.g. <2 x float> -> <4 x float>). Extract the
- // elements we want.
+ // If the parts vector has more elements than the value vector, then we
+ // have a vector widening case (e.g. <2 x float> -> <4 x float>).
+ // Extract the elements we want.
if (PartEVT.getVectorElementCount() != ValueVT.getVectorElementCount()) {
assert((PartEVT.getVectorElementCount().getKnownMinValue() >
ValueVT.getVectorElementCount().getKnownMinValue()) &&
@@ -415,6 +414,8 @@
DAG.getVectorIdxConstant(0, DL));
if (PartEVT == ValueVT)
return Val;
+ if (PartEVT.isInteger() && ValueVT.isFloatingPoint())
+ return DAG.getNode(ISD::BITCAST, DL, ValueVT, Val);
}
// Promoted vector extract
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136726.470944.patch
Type: text/x-patch
Size: 1867 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221026/9ccb5c14/attachment.bin>
More information about the llvm-commits
mailing list