mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-07 12:28:24 +00:00
Teach PatternMatch that splat vectors could be floating point as well as
integer. Fixes PR9228! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125613 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -81,7 +81,8 @@ struct apint_match {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (ConstantVector *CV = dyn_cast<ConstantVector>(V))
|
if (ConstantVector *CV = dyn_cast<ConstantVector>(V))
|
||||||
if (ConstantInt *CI = cast_or_null<ConstantInt>(CV->getSplatValue())) {
|
if (ConstantInt *CI =
|
||||||
|
dyn_cast_or_null<ConstantInt>(CV->getSplatValue())) {
|
||||||
Res = &CI->getValue();
|
Res = &CI->getValue();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -126,7 +127,7 @@ struct cst_pred_ty : public Predicate {
|
|||||||
if (const ConstantInt *CI = dyn_cast<ConstantInt>(V))
|
if (const ConstantInt *CI = dyn_cast<ConstantInt>(V))
|
||||||
return this->isValue(CI->getValue());
|
return this->isValue(CI->getValue());
|
||||||
if (const ConstantVector *CV = dyn_cast<ConstantVector>(V))
|
if (const ConstantVector *CV = dyn_cast<ConstantVector>(V))
|
||||||
if (ConstantInt *CI = cast_or_null<ConstantInt>(CV->getSplatValue()))
|
if (ConstantInt *CI = dyn_cast_or_null<ConstantInt>(CV->getSplatValue()))
|
||||||
return this->isValue(CI->getValue());
|
return this->isValue(CI->getValue());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -146,7 +147,7 @@ struct api_pred_ty : public Predicate {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (const ConstantVector *CV = dyn_cast<ConstantVector>(V))
|
if (const ConstantVector *CV = dyn_cast<ConstantVector>(V))
|
||||||
if (ConstantInt *CI = cast_or_null<ConstantInt>(CV->getSplatValue()))
|
if (ConstantInt *CI = dyn_cast_or_null<ConstantInt>(CV->getSplatValue()))
|
||||||
if (this->isValue(CI->getValue())) {
|
if (this->isValue(CI->getValue())) {
|
||||||
Res = &CI->getValue();
|
Res = &CI->getValue();
|
||||||
return true;
|
return true;
|
||||||
|
@@ -121,3 +121,31 @@ define <2 x double> @fc(<2 x double> %t) {
|
|||||||
%b = sitofp <2 x i64> %a to <2 x double>
|
%b = sitofp <2 x i64> %a to <2 x double>
|
||||||
ret <2 x double> %b
|
ret <2 x double> %b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
; PR9228
|
||||||
|
; This was a crasher, so no CHECK statements.
|
||||||
|
define <4 x float> @f(i32 %a) nounwind alwaysinline {
|
||||||
|
; CHECK: @f
|
||||||
|
entry:
|
||||||
|
%dim = insertelement <4 x i32> undef, i32 %a, i32 0
|
||||||
|
%dim30 = insertelement <4 x i32> %dim, i32 %a, i32 1
|
||||||
|
%dim31 = insertelement <4 x i32> %dim30, i32 %a, i32 2
|
||||||
|
%dim32 = insertelement <4 x i32> %dim31, i32 %a, i32 3
|
||||||
|
|
||||||
|
%offset_ptr = getelementptr <4 x float>* null, i32 1
|
||||||
|
%offset_int = ptrtoint <4 x float>* %offset_ptr to i64
|
||||||
|
%sizeof32 = trunc i64 %offset_int to i32
|
||||||
|
|
||||||
|
%smearinsert33 = insertelement <4 x i32> undef, i32 %sizeof32, i32 0
|
||||||
|
%smearinsert34 = insertelement <4 x i32> %smearinsert33, i32 %sizeof32, i32 1
|
||||||
|
%smearinsert35 = insertelement <4 x i32> %smearinsert34, i32 %sizeof32, i32 2
|
||||||
|
%smearinsert36 = insertelement <4 x i32> %smearinsert35, i32 %sizeof32, i32 3
|
||||||
|
|
||||||
|
%delta_scale = mul <4 x i32> %dim32, %smearinsert36
|
||||||
|
%offset_delta = add <4 x i32> zeroinitializer, %delta_scale
|
||||||
|
|
||||||
|
%offset_varying_delta = add <4 x i32> %offset_delta, undef
|
||||||
|
|
||||||
|
ret <4 x float> undef
|
||||||
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user