[IR] Update to use new shufflevector semantics

Update to use new shufflevector semantics for undefined values in the mask

Differential Revision: https://reviews.llvm.org/D149548
This commit is contained in:
ManuelJBrito 2023-06-13 14:59:38 +01:00
parent 14914fb157
commit 22f5dc7501
7 changed files with 19 additions and 19 deletions

View File

@ -37,7 +37,7 @@ void test_core(void) {
// CHECK-ASM: vlvgg
vd = vec_promote(d, idx);
// CHECK: insertelement <2 x double> undef, double %{{.*}}, i32 %{{.*}}
// CHECK: insertelement <2 x double> poison, double %{{.*}}, i32 %{{.*}}
// CHECK-ASM: vlvgg
vd = vec_insert_and_zero(cptrd);

View File

@ -166,31 +166,31 @@ void test_core(void) {
// CHECK-ASM: vlvgg
vsc = vec_promote(sc, idx);
// CHECK: insertelement <16 x i8> undef, i8 %{{.*}}, i32 %{{.*}}
// CHECK: insertelement <16 x i8> poison, i8 %{{.*}}, i32 %{{.*}}
// CHECK-ASM: vlvgb
vuc = vec_promote(uc, idx);
// CHECK: insertelement <16 x i8> undef, i8 %{{.*}}, i32 %{{.*}}
// CHECK: insertelement <16 x i8> poison, i8 %{{.*}}, i32 %{{.*}}
// CHECK-ASM: vlvgb
vss = vec_promote(ss, idx);
// CHECK: insertelement <8 x i16> undef, i16 %{{.*}}, i32 %{{.*}}
// CHECK: insertelement <8 x i16> poison, i16 %{{.*}}, i32 %{{.*}}
// CHECK-ASM: vlvgh
vus = vec_promote(us, idx);
// CHECK: insertelement <8 x i16> undef, i16 %{{.*}}, i32 %{{.*}}
// CHECK: insertelement <8 x i16> poison, i16 %{{.*}}, i32 %{{.*}}
// CHECK-ASM: vlvgh
vsi = vec_promote(si, idx);
// CHECK: insertelement <4 x i32> undef, i32 %{{.*}}, i32 %{{.*}}
// CHECK: insertelement <4 x i32> poison, i32 %{{.*}}, i32 %{{.*}}
// CHECK-ASM: vlvgf
vui = vec_promote(ui, idx);
// CHECK: insertelement <4 x i32> undef, i32 %{{.*}}, i32 %{{.*}}
// CHECK: insertelement <4 x i32> poison, i32 %{{.*}}, i32 %{{.*}}
// CHECK-ASM: vlvgf
vsl = vec_promote(sl, idx);
// CHECK: insertelement <2 x i64> undef, i64 %{{.*}}, i32 %{{.*}}
// CHECK: insertelement <2 x i64> poison, i64 %{{.*}}, i32 %{{.*}}
// CHECK-ASM: vlvgg
vul = vec_promote(ul, idx);
// CHECK: insertelement <2 x i64> undef, i64 %{{.*}}, i32 %{{.*}}
// CHECK: insertelement <2 x i64> poison, i64 %{{.*}}, i32 %{{.*}}
// CHECK-ASM: vlvgg
vd = vec_promote(d, idx);
// CHECK: insertelement <2 x double> undef, double %{{.*}}, i32 %{{.*}}
// CHECK: insertelement <2 x double> poison, double %{{.*}}, i32 %{{.*}}
// CHECK-ASM: vlvgg
vsc = vec_insert_and_zero(cptrsc);

View File

@ -70,10 +70,10 @@ void test_core(void) {
// CHECK-ASM: vlvgg
vf = vec_promote(f, idx);
// CHECK: insertelement <4 x float> undef, float %{{.*}}, i32 %{{.*}}
// CHECK: insertelement <4 x float> poison, float %{{.*}}, i32 %{{.*}}
// CHECK-ASM: vlvgf
vd = vec_promote(d, idx);
// CHECK: insertelement <2 x double> undef, double %{{.*}}, i32 %{{.*}}
// CHECK: insertelement <2 x double> poison, double %{{.*}}, i32 %{{.*}}
// CHECK-ASM: vlvgg
vf = vec_insert_and_zero(cptrf);

View File

@ -102,10 +102,10 @@ void test_core(void) {
// CHECK-ASM: vlvgg
vf = vec_promote(f, idx);
// CHECK: insertelement <4 x float> undef, float %{{.*}}, i32 %{{.*}}
// CHECK: insertelement <4 x float> poison, float %{{.*}}, i32 %{{.*}}
// CHECK-ASM: vlvgf
vd = vec_promote(d, idx);
// CHECK: insertelement <2 x double> undef, double %{{.*}}, i32 %{{.*}}
// CHECK: insertelement <2 x double> poison, double %{{.*}}, i32 %{{.*}}
// CHECK-ASM: vlvgg
vf = vec_insert_and_zero(cptrf);

View File

@ -710,9 +710,9 @@ Constant *llvm::ConstantFoldShuffleVectorInstruction(Constant *V1, Constant *V2,
ElementCount::get(MaskNumElts, isa<ScalableVectorType>(V1VTy));
Type *EltTy = V1VTy->getElementType();
// Undefined shuffle mask -> undefined value.
// Poison shuffle mask -> poison value.
if (all_of(Mask, [](int Elt) { return Elt == PoisonMaskElem; })) {
return UndefValue::get(VectorType::get(EltTy, MaskEltCount));
return PoisonValue::get(VectorType::get(EltTy, MaskEltCount));
}
// If the mask is all zeros this is a splat, no need to go through all

View File

@ -2290,7 +2290,7 @@ Constant *ShuffleVectorInst::convertShuffleMaskForBitcode(ArrayRef<int> Mask,
SmallVector<Constant *, 16> MaskConst;
for (int Elem : Mask) {
if (Elem == PoisonMaskElem)
MaskConst.push_back(UndefValue::get(Int32Ty));
MaskConst.push_back(PoisonValue::get(Int32Ty));
else
MaskConst.push_back(ConstantInt::get(Int32Ty, Elem));
}

View File

@ -18,7 +18,7 @@ define <4 x float> @__inff4() nounwind readnone {
define <4 x i1> @shuffle_undef_fixed() {
; CHECK-LABEL: @shuffle_undef_fixed(
; CHECK-NEXT: ret <4 x i1> undef
; CHECK-NEXT: ret <4 x i1> poison
;
%S = shufflevector <4 x i1> zeroinitializer, <4 x i1> zeroinitializer, <4 x i32> undef
ret <4 x i1> %S
@ -26,7 +26,7 @@ define <4 x i1> @shuffle_undef_fixed() {
define <vscale x 4 x i1> @suffle_undef_scalable() {
; CHECK-LABEL: @suffle_undef_scalable(
; CHECK-NEXT: ret <vscale x 4 x i1> undef
; CHECK-NEXT: ret <vscale x 4 x i1> poison
;
%S = shufflevector <vscale x 4 x i1> zeroinitializer, <vscale x 4 x i1> zeroinitializer, <vscale x 4 x i32> undef
ret <vscale x 4 x i1> %S