[PATCH] D32814: [GISel]: Add support to translate ConstantVectors
Aditya Nandakumar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 3 10:22:09 PDT 2017
aditya_nandakumar created this revision.
Herald added a reviewer: javed.absar.
Repository:
rL LLVM
https://reviews.llvm.org/D32814
Files:
lib/CodeGen/GlobalISel/IRTranslator.cpp
test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
Index: test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
===================================================================
--- test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
+++ test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
@@ -1541,3 +1541,8 @@
%res = shufflevector <8 x i8> %arg1, <8 x i8> %arg2, <16 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11, i32 4, i32 12, i32 5, i32 13, i32 6, i32 14, i32 7, i32 15>
ret <16 x i8> %res
}
+
+; CHECK-LABEL: test_constant_vector
+define <4 x half> @test_constant_vector() {
+ ret <4 x half> <half undef, half undef, half undef, half 0xH3C00>
+}
Index: lib/CodeGen/GlobalISel/IRTranslator.cpp
===================================================================
--- lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -1108,6 +1108,14 @@
default:
return false;
}
+ } else if (auto CV = dyn_cast<ConstantVector>(&C)) {
+ if (CV->getNumOperands() == 1)
+ return translate(*CV->getOperand(0), Reg);
+ SmallVector<unsigned, 4> Ops;
+ for (unsigned i = 0; i < CV->getNumOperands(); ++i) {
+ Ops.push_back(getOrCreateVReg(*CV->getOperand(i)));
+ }
+ EntryBuilder.buildMerge(Reg, Ops);
} else
return false;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32814.97679.patch
Type: text/x-patch
Size: 1275 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170503/6ae452af/attachment.bin>
More information about the llvm-commits
mailing list