diff --git a/llvm/test/Analysis/CostModel/AArch64/masked_ldst.ll b/llvm/test/Analysis/CostModel/AArch64/masked_ldst.ll --- a/llvm/test/Analysis/CostModel/AArch64/masked_ldst.ll +++ b/llvm/test/Analysis/CostModel/AArch64/masked_ldst.ll @@ -106,6 +106,113 @@ ret void } + +define void @scalable_ext_loads() { +; CHECK-LABEL: 'scalable_ext_loads' +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load.nxv16i8 = call @llvm.masked.load.nxv16i8.p0(ptr undef, i32 8, undef, undef) +; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %zext.nxv16i8to16 = zext %load.nxv16i8 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load.nxv16i8.2 = call @llvm.masked.load.nxv16i8.p0(ptr undef, i32 8, undef, undef) +; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %zext.nxv16i8to32 = zext %load.nxv16i8.2 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load.nxv16i8.3 = call @llvm.masked.load.nxv16i8.p0(ptr undef, i32 8, undef, undef) +; CHECK-NEXT: Cost Model: Found an estimated cost of 14 for instruction: %zext.nxv16i8to64 = zext %load.nxv16i8.3 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load.nxv8i8 = call @llvm.masked.load.nxv8i8.p0(ptr undef, i32 8, undef, undef) +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %zext.nxv8i8to16 = zext %load.nxv8i8 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load.nxv4i8 = call @llvm.masked.load.nxv4i8.p0(ptr undef, i32 8, undef, undef) +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %zext.nxv4i8to32 = zext %load.nxv4i8 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load.nxv2i8 = call @llvm.masked.load.nxv2i8.p0(ptr undef, i32 8, undef, undef) +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %zext.nxv2i8to64 = zext %load.nxv2i8 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load.nxv8i16 = call @llvm.masked.load.nxv8i16.p0(ptr undef, i32 8, undef, undef) +; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %zext.nxv8i16to32 = zext %load.nxv8i16 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load.nxv8i16.2 = call @llvm.masked.load.nxv8i16.p0(ptr undef, i32 8, undef, undef) +; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %zext.nxv8i16to64 = zext %load.nxv8i16.2 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load.nxv4i16 = call @llvm.masked.load.nxv4i16.p0(ptr undef, i32 8, undef, undef) +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %zext.nxv4i16to32 = zext %load.nxv4i16 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load.nxv2i16 = call @llvm.masked.load.nxv2i16.p0(ptr undef, i32 8, undef, undef) +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %zext.nxv2i16to64 = zext %load.nxv2i16 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load.nxv4i32 = call @llvm.masked.load.nxv4i32.p0(ptr undef, i32 8, undef, undef) +; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %zext.nxv4i32to64 = zext %load.nxv4i32 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load.nxv2i32 = call @llvm.masked.load.nxv2i32.p0(ptr undef, i32 8, undef, undef) +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %zext.nxv2i32to64 = zext %load.nxv2i32 to + +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load2.nxv16i8 = call @llvm.masked.load.nxv16i8.p0(ptr undef, i32 8, undef, undef) +; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %sext.nxv16i8to16 = sext %load2.nxv16i8 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load2.nxv16i8.2 = call @llvm.masked.load.nxv16i8.p0(ptr undef, i32 8, undef, undef) +; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %sext.nxv16i8to32 = sext %load2.nxv16i8.2 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load2.nxv16i8.3 = call @llvm.masked.load.nxv16i8.p0(ptr undef, i32 8, undef, undef) +; CHECK-NEXT: Cost Model: Found an estimated cost of 14 for instruction: %sext.nxv16i8to64 = sext %load2.nxv16i8.3 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load2.nxv8i8 = call @llvm.masked.load.nxv8i8.p0(ptr undef, i32 8, undef, undef) +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %sext.nxv8i8to16 = sext %load2.nxv8i8 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load2.nxv4i8 = call @llvm.masked.load.nxv4i8.p0(ptr undef, i32 8, undef, undef) +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %sext.nxv4i8to32 = sext %load2.nxv4i8 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load2.nxv2i8 = call @llvm.masked.load.nxv2i8.p0(ptr undef, i32 8, undef, undef) +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %sext.nxv2i8to64 = sext %load2.nxv2i8 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load2.nxv8i16 = call @llvm.masked.load.nxv8i16.p0(ptr undef, i32 8, undef, undef) +; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %sext.nxv8i16to32 = sext %load2.nxv8i16 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load2.nxv8i16.2 = call @llvm.masked.load.nxv8i16.p0(ptr undef, i32 8, undef, undef) +; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %sext.nxv8i16to64 = sext %load2.nxv8i16.2 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load2.nxv4i16 = call @llvm.masked.load.nxv4i16.p0(ptr undef, i32 8, undef, undef) +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %sext.nxv4i16to32 = sext %load2.nxv4i16 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load2.nxv2i16 = call @llvm.masked.load.nxv2i16.p0(ptr undef, i32 8, undef, undef) +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %sext.nxv2i16to64 = sext %load2.nxv2i16 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load2.nxv4i32 = call @llvm.masked.load.nxv4i32.p0(ptr undef, i32 8, undef, undef) +; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %sext.nxv4i32to64 = sext %load2.nxv4i32 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load2.nxv2i32 = call @llvm.masked.load.nxv2i32.p0(ptr undef, i32 8, undef, undef) +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %sext.nxv2i32to64 = sext %load2.nxv2i32 to + + %load.nxv16i8 = call @llvm.masked.load.nxv16i8.p0(ptr undef, i32 8, undef, undef) + %zext.nxv16i8to16 = zext %load.nxv16i8 to + %load.nxv16i8.2 = call @llvm.masked.load.nxv16i8.p0(ptr undef, i32 8, undef, undef) + %zext.nxv16i8to32 = zext %load.nxv16i8.2 to + %load.nxv16i8.3 = call @llvm.masked.load.nxv16i8.p0(ptr undef, i32 8, undef, undef) + %zext.nxv16i8to64 = zext %load.nxv16i8.3 to + %load.nxv8i8 = call @llvm.masked.load.nxv8i8.p0(ptr undef, i32 8, undef, undef) + %zext.nxv8i8to16 = zext %load.nxv8i8 to + %load.nxv4i8 = call @llvm.masked.load.nxv4i8.p0(ptr undef, i32 8, undef, undef) + %zext.nxv4i8to32 = zext %load.nxv4i8 to + %load.nxv2i8 = call @llvm.masked.load.nxv2i8.p0(ptr undef, i32 8, undef, undef) + %zext.nxv2i8to64 = zext %load.nxv2i8 to + %load.nxv8i16 = call @llvm.masked.load.nxv8i16.p0(ptr undef, i32 8, undef, undef) + %zext.nxv8i16to32 = zext %load.nxv8i16 to + %load.nxv8i16.2 = call @llvm.masked.load.nxv8i16.p0(ptr undef, i32 8, undef, undef) + %zext.nxv8i16to64 = zext %load.nxv8i16.2 to + %load.nxv4i16 = call @llvm.masked.load.nxv4i16.p0(ptr undef, i32 8, undef, undef) + %zext.nxv4i16to32 = zext %load.nxv4i16 to + %load.nxv2i16 = call @llvm.masked.load.nxv2i16.p0(ptr undef, i32 8, undef, undef) + %zext.nxv2i16to64 = zext %load.nxv2i16 to + %load.nxv4i32 = call @llvm.masked.load.nxv4i32.p0(ptr undef, i32 8, undef, undef) + %zext.nxv4i32to64 = zext %load.nxv4i32 to + %load.nxv2i32 = call @llvm.masked.load.nxv2i32.p0(ptr undef, i32 8, undef, undef) + %zext.nxv2i32to64 = zext %load.nxv2i32 to + + %load2.nxv16i8 = call @llvm.masked.load.nxv16i8.p0(ptr undef, i32 8, undef, undef) + %sext.nxv16i8to16 = sext %load2.nxv16i8 to + %load2.nxv16i8.2 = call @llvm.masked.load.nxv16i8.p0(ptr undef, i32 8, undef, undef) + %sext.nxv16i8to32 = sext %load2.nxv16i8.2 to + %load2.nxv16i8.3 = call @llvm.masked.load.nxv16i8.p0(ptr undef, i32 8, undef, undef) + %sext.nxv16i8to64 = sext %load2.nxv16i8.3 to + %load2.nxv8i8 = call @llvm.masked.load.nxv8i8.p0(ptr undef, i32 8, undef, undef) + %sext.nxv8i8to16 = sext %load2.nxv8i8 to + %load2.nxv4i8 = call @llvm.masked.load.nxv4i8.p0(ptr undef, i32 8, undef, undef) + %sext.nxv4i8to32 = sext %load2.nxv4i8 to + %load2.nxv2i8 = call @llvm.masked.load.nxv2i8.p0(ptr undef, i32 8, undef, undef) + %sext.nxv2i8to64 = sext %load2.nxv2i8 to + %load2.nxv8i16 = call @llvm.masked.load.nxv8i16.p0(ptr undef, i32 8, undef, undef) + %sext.nxv8i16to32 = sext %load2.nxv8i16 to + %load2.nxv8i16.2 = call @llvm.masked.load.nxv8i16.p0(ptr undef, i32 8, undef, undef) + %sext.nxv8i16to64 = sext %load2.nxv8i16.2 to + %load2.nxv4i16 = call @llvm.masked.load.nxv4i16.p0(ptr undef, i32 8, undef, undef) + %sext.nxv4i16to32 = sext %load2.nxv4i16 to + %load2.nxv2i16 = call @llvm.masked.load.nxv2i16.p0(ptr undef, i32 8, undef, undef) + %sext.nxv2i16to64 = sext %load2.nxv2i16 to + %load2.nxv4i32 = call @llvm.masked.load.nxv4i32.p0(ptr undef, i32 8, undef, undef) + %sext.nxv4i32to64 = sext %load2.nxv4i32 to + %load2.nxv2i32 = call @llvm.masked.load.nxv2i32.p0(ptr undef, i32 8, undef, undef) + %sext.nxv2i32to64 = sext %load2.nxv2i32 to + + ret void +} + + declare <2 x i8> @llvm.masked.load.v2i8.p0(ptr, i32, <2 x i1>, <2 x i8>) declare <4 x i8> @llvm.masked.load.v4i8.p0(ptr, i32, <4 x i1>, <4 x i8>) declare <8 x i8> @llvm.masked.load.v8i8.p0(ptr, i32, <8 x i1>, <8 x i8>) diff --git a/llvm/test/Analysis/CostModel/AArch64/sve-ldst.ll b/llvm/test/Analysis/CostModel/AArch64/sve-ldst.ll --- a/llvm/test/Analysis/CostModel/AArch64/sve-ldst.ll +++ b/llvm/test/Analysis/CostModel/AArch64/sve-ldst.ll @@ -27,3 +27,87 @@ store undef, ptr undef ret void } + +define void @scalable_ext_loads() { +; CHECK-LABEL: 'scalable_ext_loads' +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load.nxv16i8 = load , ptr undef, align 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %zext.nxv16i8to16 = zext %load.nxv16i8 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load.nxv8i8 = load , ptr undef, align 8 +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %zext.nxv8i8to16 = zext %load.nxv8i8 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load.nxv4i8 = load , ptr undef, align 4 +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %zext.nxv4i8to32 = zext %load.nxv4i8 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load.nxv2i8 = load , ptr undef, align 2 +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %zext.nxv2i8to64 = zext %load.nxv2i8 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load.nxv8i16 = load , ptr undef, align 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %zext.nxv8i16to32 = zext %load.nxv8i16 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load.nxv4i16 = load , ptr undef, align 8 +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %zext.nxv4i16to32 = zext %load.nxv4i16 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load.nxv2i16 = load , ptr undef, align 4 +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %zext.nxv2i16to64 = zext %load.nxv2i16 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load.nxv4i32 = load , ptr undef, align 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %zext.nxv4i32to64 = zext %load.nxv4i32 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load.nxv2i32 = load , ptr undef, align 8 +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %zext.nxv2i32to64 = zext %load.nxv2i32 to + +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load2.nxv16i8 = load , ptr undef, align 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %sext.nxv16i8to16 = sext %load2.nxv16i8 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load2.nxv8i8 = load , ptr undef, align 8 +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %sext.nxv8i8to16 = sext %load2.nxv8i8 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load2.nxv4i8 = load , ptr undef, align 4 +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %sext.nxv4i8to32 = sext %load2.nxv4i8 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load2.nxv2i8 = load , ptr undef, align 2 +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %sext.nxv2i8to64 = sext %load2.nxv2i8 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load2.nxv8i16 = load , ptr undef, align 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %sext.nxv8i16to32 = sext %load2.nxv8i16 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load2.nxv4i16 = load , ptr undef, align 8 +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %sext.nxv4i16to32 = sext %load2.nxv4i16 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load2.nxv2i16 = load , ptr undef, align 4 +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %sext.nxv2i16to64 = sext %load2.nxv2i16 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load2.nxv4i32 = load , ptr undef, align 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %sext.nxv4i32to64 = sext %load2.nxv4i32 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %load2.nxv2i32 = load , ptr undef, align 8 +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %sext.nxv2i32to64 = sext %load2.nxv2i32 to + + %load.nxv16i8 = load , ptr undef + %zext.nxv16i8to16 = zext %load.nxv16i8 to + %load.nxv8i8 = load , ptr undef + %zext.nxv8i8to16 = zext %load.nxv8i8 to + %load.nxv4i8 = load , ptr undef + %zext.nxv4i8to32 = zext %load.nxv4i8 to + %load.nxv2i8 = load , ptr undef + %zext.nxv2i8to64 = zext %load.nxv2i8 to + %load.nxv8i16 = load , ptr undef + %zext.nxv8i16to32 = zext %load.nxv8i16 to + %load.nxv4i16 = load , ptr undef + %zext.nxv4i16to32 = zext %load.nxv4i16 to + %load.nxv2i16 = load , ptr undef + %zext.nxv2i16to64 = zext %load.nxv2i16 to + %load.nxv4i32 = load , ptr undef + %zext.nxv4i32to64 = zext %load.nxv4i32 to + %load.nxv2i32 = load , ptr undef + %zext.nxv2i32to64 = zext %load.nxv2i32 to + + %load2.nxv16i8 = load , ptr undef + %sext.nxv16i8to16 = sext %load2.nxv16i8 to + %load2.nxv8i8 = load , ptr undef + %sext.nxv8i8to16 = sext %load2.nxv8i8 to + %load2.nxv4i8 = load , ptr undef + %sext.nxv4i8to32 = sext %load2.nxv4i8 to + %load2.nxv2i8 = load , ptr undef + %sext.nxv2i8to64 = sext %load2.nxv2i8 to + %load2.nxv8i16 = load , ptr undef + %sext.nxv8i16to32 = sext %load2.nxv8i16 to + %load2.nxv4i16 = load , ptr undef + %sext.nxv4i16to32 = sext %load2.nxv4i16 to + %load2.nxv2i16 = load , ptr undef + %sext.nxv2i16to64 = sext %load2.nxv2i16 to + %load2.nxv4i32 = load , ptr undef + %sext.nxv4i32to64 = sext %load2.nxv4i32 to + %load2.nxv2i32 = load , ptr undef + %sext.nxv2i32to64 = sext %load2.nxv2i32 to + + ret void +} + +;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: +; CHECK: {{.*}}