mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[TTI] Fix cast cost on vector types.
- Only split vector types when both src and dst types are splittable.
This commit is contained in:
parent
e206b99c28
commit
7baf13a5a7
@ -781,9 +781,10 @@ public:
|
||||
// cost of the split itself. Count that as 1, to be consistent with
|
||||
// TLI->getTypeLegalizationCost().
|
||||
if ((TLI->getTypeAction(Src->getContext(), TLI->getValueType(DL, Src)) ==
|
||||
TargetLowering::TypeSplitVector) ||
|
||||
(TLI->getTypeAction(Dst->getContext(), TLI->getValueType(DL, Dst)) ==
|
||||
TargetLowering::TypeSplitVector)) {
|
||||
TargetLowering::TypeSplitVector ||
|
||||
TLI->getTypeAction(Dst->getContext(), TLI->getValueType(DL, Dst)) ==
|
||||
TargetLowering::TypeSplitVector) &&
|
||||
Src->getVectorNumElements() > 1 && Dst->getVectorNumElements() > 1) {
|
||||
Type *SplitDst = VectorType::get(Dst->getVectorElementType(),
|
||||
Dst->getVectorNumElements() / 2);
|
||||
Type *SplitSrc = VectorType::get(Src->getVectorElementType(),
|
||||
|
21
test/Transforms/LICM/AMDGPU/bitcast.ll
Normal file
21
test/Transforms/LICM/AMDGPU/bitcast.ll
Normal file
@ -0,0 +1,21 @@
|
||||
; RUN: opt -licm -mtriple=amdgcn -S -o - %s | FileCheck %s
|
||||
|
||||
; CHECK-LABEL: foo
|
||||
; CHECK: ret
|
||||
define void @foo(i8* %d, <1 x i32>* %s, i32 %idx) {
|
||||
entry:
|
||||
br label %for.body
|
||||
|
||||
for.body:
|
||||
%v0 = load <1 x i32>, <1 x i32>* %s
|
||||
%v1 = bitcast <1 x i32> %v0 to <4 x i8>
|
||||
br label %for.cond
|
||||
|
||||
for.cond:
|
||||
%e0 = extractelement <4 x i8> %v1, i32 %idx
|
||||
store i8 %e0, i8* %d
|
||||
br i1 false, label %for.exit, label %for.body
|
||||
|
||||
for.exit:
|
||||
ret void
|
||||
}
|
2
test/Transforms/LICM/AMDGPU/lit.local.cfg
Normal file
2
test/Transforms/LICM/AMDGPU/lit.local.cfg
Normal file
@ -0,0 +1,2 @@
|
||||
if not 'AMDGPU' in config.root.targets:
|
||||
config.unsupported = True
|
Loading…
x
Reference in New Issue
Block a user