101 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 22; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=riscv32 -mattr=+v | FileCheck --check-prefixes=CHECK,RV32 %s3; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -mtriple=riscv64 -mattr=+v | FileCheck --check-prefixes=CHECK,RV64 %s4 5; The mask here interleaves (%v1, %v0), not (%v0, %v1): it should still be cheap.6define <4 x i8> @interleave2_v2i8(<2 x i8> %v0, <2 x i8> %v1) {7; CHECK-LABEL: 'interleave2_v2i8'8; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %concat = shufflevector <2 x i8> %v0, <2 x i8> %v1, <4 x i32> <i32 0, i32 1, i32 2, i32 3>9; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %res = shufflevector <4 x i8> %concat, <4 x i8> poison, <4 x i32> <i32 2, i32 0, i32 3, i32 1>10; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i8> %res11;12 %concat = shufflevector <2 x i8> %v0, <2 x i8> %v1, <4 x i32> <i32 0, i32 1, i32 2, i32 3>13 %res = shufflevector <4 x i8> %concat, <4 x i8> poison, <4 x i32> <i32 2, i32 0, i32 3, i32 1>14 ret <4 x i8> %res15}16 17define <8 x i8> @interleave2_v8i8(<4 x i8> %v0, <4 x i8> %v1) {18; CHECK-LABEL: 'interleave2_v8i8'19; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %concat = shufflevector <4 x i8> %v0, <4 x i8> %v1, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>20; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %res = shufflevector <8 x i8> %concat, <8 x i8> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>21; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i8> %res22;23 %concat = shufflevector <4 x i8> %v0, <4 x i8> %v1, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>24 %res = shufflevector <8 x i8> %concat, <8 x i8> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>25 ret <8 x i8> %res26}27 28define <8 x i32> @interleave2_v8i32(<4 x i32> %v0, <4 x i32> %v1) {29; CHECK-LABEL: 'interleave2_v8i32'30; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %concat = shufflevector <4 x i32> %v0, <4 x i32> %v1, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>31; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %res = shufflevector <8 x i32> %concat, <8 x i32> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>32; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %res33;34 %concat = shufflevector <4 x i32> %v0, <4 x i32> %v1, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>35 %res = shufflevector <8 x i32> %concat, <8 x i32> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>36 ret <8 x i32> %res37}38 39; Should be expensive on RV32 because it can't widen40define <8 x i64> @interleave2_v8i64(<4 x i64> %v0, <4 x i64> %v1) {41; RV32-LABEL: 'interleave2_v8i64'42; RV32-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %concat = shufflevector <4 x i64> %v0, <4 x i64> %v1, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>43; RV32-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %res = shufflevector <8 x i64> %concat, <8 x i64> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>44; RV32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i64> %res45;46; RV64-LABEL: 'interleave2_v8i64'47; RV64-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %concat = shufflevector <4 x i64> %v0, <4 x i64> %v1, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>48; RV64-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %res = shufflevector <8 x i64> %concat, <8 x i64> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>49; RV64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i64> %res50;51 %concat = shufflevector <4 x i64> %v0, <4 x i64> %v1, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>52 %res = shufflevector <8 x i64> %concat, <8 x i64> poison, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>53 ret <8 x i64> %res54}55 56; TODO: getInstructionCost doesn't call getShuffleCost here because the shuffle changes length57define {<4 x i8>, <4 x i8>} @deinterleave_2(<8 x i8> %v) {58; CHECK-LABEL: 'deinterleave_2'59; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v0 = shufflevector <8 x i8> %v, <8 x i8> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>60; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v1 = shufflevector <8 x i8> %v, <8 x i8> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>61; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %res0 = insertvalue { <4 x i8>, <4 x i8> } poison, <4 x i8> %v0, 062; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %res1 = insertvalue { <4 x i8>, <4 x i8> } %res0, <4 x i8> %v1, 163; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <4 x i8>, <4 x i8> } %res164;65 %v0 = shufflevector <8 x i8> %v, <8 x i8> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>66 %v1 = shufflevector <8 x i8> %v, <8 x i8> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>67 %res0 = insertvalue {<4 x i8>, <4 x i8>} poison, <4 x i8> %v0, 068 %res1 = insertvalue {<4 x i8>, <4 x i8>} %res0, <4 x i8> %v1, 169 ret {<4 x i8>, <4 x i8>} %res170}71 72define {<4 x i32>, <4 x i32>} @deinterleave_2_m1_dest(<8 x i32> %v) {73; CHECK-LABEL: 'deinterleave_2_m1_dest'74; CHECK-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v0 = shufflevector <8 x i32> %v, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>75; CHECK-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v1 = shufflevector <8 x i32> %v, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>76; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %res0 = insertvalue { <4 x i32>, <4 x i32> } poison, <4 x i32> %v0, 077; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %res1 = insertvalue { <4 x i32>, <4 x i32> } %res0, <4 x i32> %v1, 178; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <4 x i32>, <4 x i32> } %res179;80 %v0 = shufflevector <8 x i32> %v, <8 x i32> poison, <4 x i32> <i32 0, i32 2, i32 4, i32 6>81 %v1 = shufflevector <8 x i32> %v, <8 x i32> poison, <4 x i32> <i32 1, i32 3, i32 5, i32 7>82 %res0 = insertvalue {<4 x i32>, <4 x i32>} poison, <4 x i32> %v0, 083 %res1 = insertvalue {<4 x i32>, <4 x i32>} %res0, <4 x i32> %v1, 184 ret {<4 x i32>, <4 x i32>} %res185}86 87define {<8 x i32>, <8 x i32>} @deinterleave_2_m2_dest(<16 x i32> %v) {88; CHECK-LABEL: 'deinterleave_2_m2_dest'89; CHECK-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %v0 = shufflevector <16 x i32> %v, <16 x i32> poison, <8 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14>90; CHECK-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %v1 = shufflevector <16 x i32> %v, <16 x i32> poison, <8 x i32> <i32 1, i32 3, i32 5, i32 7, i32 9, i32 11, i32 13, i32 15>91; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %res0 = insertvalue { <8 x i32>, <8 x i32> } poison, <8 x i32> %v0, 092; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %res1 = insertvalue { <8 x i32>, <8 x i32> } %res0, <8 x i32> %v1, 193; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret { <8 x i32>, <8 x i32> } %res194;95 %v0 = shufflevector <16 x i32> %v, <16 x i32> poison, <8 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14>96 %v1 = shufflevector <16 x i32> %v, <16 x i32> poison, <8 x i32> <i32 1, i32 3, i32 5, i32 7, i32 9, i32 11, i32 13, i32 15>97 %res0 = insertvalue {<8 x i32>, <8 x i32>} poison, <8 x i32> %v0, 098 %res1 = insertvalue {<8 x i32>, <8 x i32>} %res0, <8 x i32> %v1, 199 ret {<8 x i32>, <8 x i32>} %res1100}101