mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 12:12:47 +01:00
[GISel]: Add support to translate ConstantVectors
Reviewed by Quentin https://reviews.llvm.org/D32814 llvm-svn: 302196
This commit is contained in:
parent
05b2c64fe3
commit
3d89fe7e58
@ -1108,6 +1108,14 @@ bool IRTranslator::translate(const Constant &C, unsigned Reg) {
|
||||
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;
|
||||
|
||||
|
@ -1541,3 +1541,12 @@ define <16 x i8> @test_shufflevector_v8s8_v16s8(<8 x i8> %arg1, <8 x i8> %arg2)
|
||||
%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
|
||||
; CHECK: [[UNDEF:%[0-9]+]](s16) = IMPLICIT_DEF
|
||||
; CHECK: [[F:%[0-9]+]](s16) = G_FCONSTANT half 0xH3C00
|
||||
; CHECK: [[M:%[0-9]+]](<4 x s16>) = G_MERGE_VALUES [[UNDEF]](s16), [[UNDEF]](s16), [[UNDEF]](s16), [[F]](s16)
|
||||
; CHECK: %d0 = COPY [[M]](<4 x s16>)
|
||||
define <4 x half> @test_constant_vector() {
|
||||
ret <4 x half> <half undef, half undef, half undef, half 0xH3C00>
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user