diff --git a/llvm/test/Analysis/CostModel/AArch64/vector-extract.ll b/llvm/test/Analysis/CostModel/AArch64/vector-extract.ll new file mode 100644 --- /dev/null +++ b/llvm/test/Analysis/CostModel/AArch64/vector-extract.ll @@ -0,0 +1,171 @@ +; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py +; RUN: opt < %s -passes="print" 2>&1 -disable-output -mtriple=aarch64 -mcpu=generic | FileCheck %s --check-prefix=GENERIC +; RUN: opt < %s -passes="print" 2>&1 -disable-output -mtriple=aarch64 -mcpu=neoverse-n1 | FileCheck %s --check-prefix=NEOVERSE-N1 + +define void @extract_double(<2 x double> %vec) { +; GENERIC-LABEL: 'extract_double' +; GENERIC-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %extract_0 = extractelement <2 x double> %vec, i32 0 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_1 = extractelement <2 x double> %vec, i32 1 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void +; +; NEOVERSE-N1-LABEL: 'extract_double' +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %extract_0 = extractelement <2 x double> %vec, i32 0 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_1 = extractelement <2 x double> %vec, i32 1 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void +; + %extract_0 = extractelement<2 x double> %vec, i32 0 + %extract_1 = extractelement<2 x double> %vec, i32 1 + ret void +} + +define void @extract_float(<4 x float> %vec) { +; GENERIC-LABEL: 'extract_float' +; GENERIC-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %extract_0 = extractelement <4 x float> %vec, i32 0 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_1 = extractelement <4 x float> %vec, i32 1 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_2 = extractelement <4 x float> %vec, i32 2 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_3 = extractelement <4 x float> %vec, i32 3 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void +; +; NEOVERSE-N1-LABEL: 'extract_float' +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %extract_0 = extractelement <4 x float> %vec, i32 0 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_1 = extractelement <4 x float> %vec, i32 1 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_2 = extractelement <4 x float> %vec, i32 2 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_3 = extractelement <4 x float> %vec, i32 3 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void +; + %extract_0 = extractelement<4 x float> %vec, i32 0 + %extract_1 = extractelement<4 x float> %vec, i32 1 + %extract_2 = extractelement<4 x float> %vec, i32 2 + %extract_3 = extractelement<4 x float> %vec, i32 3 + ret void +} + +define void @extract_i64(<2 x i64> %vec) { +; GENERIC-LABEL: 'extract_i64' +; GENERIC-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %extract_0 = extractelement <2 x i64> %vec, i32 0 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_1 = extractelement <2 x i64> %vec, i32 1 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void +; +; NEOVERSE-N1-LABEL: 'extract_i64' +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %extract_0 = extractelement <2 x i64> %vec, i32 0 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_1 = extractelement <2 x i64> %vec, i32 1 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void +; + %extract_0 = extractelement<2 x i64> %vec, i32 0 + %extract_1 = extractelement<2 x i64> %vec, i32 1 + ret void +} + +define void @extract_i32(<4 x i32> %vec) { +; GENERIC-LABEL: 'extract_i32' +; GENERIC-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %extract_0 = extractelement <4 x i32> %vec, i32 0 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_1 = extractelement <4 x i32> %vec, i32 1 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_2 = extractelement <4 x i32> %vec, i32 2 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_3 = extractelement <4 x i32> %vec, i32 3 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void +; +; NEOVERSE-N1-LABEL: 'extract_i32' +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %extract_0 = extractelement <4 x i32> %vec, i32 0 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_1 = extractelement <4 x i32> %vec, i32 1 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_2 = extractelement <4 x i32> %vec, i32 2 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_3 = extractelement <4 x i32> %vec, i32 3 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void +; + %extract_0 = extractelement<4 x i32> %vec, i32 0 + %extract_1 = extractelement<4 x i32> %vec, i32 1 + %extract_2 = extractelement<4 x i32> %vec, i32 2 + %extract_3 = extractelement<4 x i32> %vec, i32 3 + ret void +} + +define void @extract_i16(<8 x i16> %vec) { +; GENERIC-LABEL: 'extract_i16' +; GENERIC-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %extract_0 = extractelement <8 x i16> %vec, i32 0 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_1 = extractelement <8 x i16> %vec, i32 1 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_2 = extractelement <8 x i16> %vec, i32 2 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_3 = extractelement <8 x i16> %vec, i32 3 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_4 = extractelement <8 x i16> %vec, i32 4 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_5 = extractelement <8 x i16> %vec, i32 5 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_6 = extractelement <8 x i16> %vec, i32 6 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_7 = extractelement <8 x i16> %vec, i32 7 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void +; +; NEOVERSE-N1-LABEL: 'extract_i16' +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %extract_0 = extractelement <8 x i16> %vec, i32 0 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_1 = extractelement <8 x i16> %vec, i32 1 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_2 = extractelement <8 x i16> %vec, i32 2 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_3 = extractelement <8 x i16> %vec, i32 3 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_4 = extractelement <8 x i16> %vec, i32 4 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_5 = extractelement <8 x i16> %vec, i32 5 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_6 = extractelement <8 x i16> %vec, i32 6 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_7 = extractelement <8 x i16> %vec, i32 7 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void +; + %extract_0 = extractelement<8 x i16> %vec, i32 0 + %extract_1 = extractelement<8 x i16> %vec, i32 1 + %extract_2 = extractelement<8 x i16> %vec, i32 2 + %extract_3 = extractelement<8 x i16> %vec, i32 3 + %extract_4 = extractelement<8 x i16> %vec, i32 4 + %extract_5 = extractelement<8 x i16> %vec, i32 5 + %extract_6 = extractelement<8 x i16> %vec, i32 6 + %extract_7 = extractelement<8 x i16> %vec, i32 7 + ret void +} + +define void @extract_i8(<16 x i8> %vec) { +; GENERIC-LABEL: 'extract_i8' +; GENERIC-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %extract_0 = extractelement <16 x i8> %vec, i32 0 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_1 = extractelement <16 x i8> %vec, i32 1 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_2 = extractelement <16 x i8> %vec, i32 2 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_3 = extractelement <16 x i8> %vec, i32 3 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_4 = extractelement <16 x i8> %vec, i32 4 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_5 = extractelement <16 x i8> %vec, i32 5 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_6 = extractelement <16 x i8> %vec, i32 6 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_7 = extractelement <16 x i8> %vec, i32 7 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_8 = extractelement <16 x i8> %vec, i32 8 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_9 = extractelement <16 x i8> %vec, i32 9 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_10 = extractelement <16 x i8> %vec, i32 10 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_11 = extractelement <16 x i8> %vec, i32 11 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_12 = extractelement <16 x i8> %vec, i32 12 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_13 = extractelement <16 x i8> %vec, i32 13 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_14 = extractelement <16 x i8> %vec, i32 14 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_15 = extractelement <16 x i8> %vec, i32 15 +; GENERIC-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void +; +; NEOVERSE-N1-LABEL: 'extract_i8' +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %extract_0 = extractelement <16 x i8> %vec, i32 0 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_1 = extractelement <16 x i8> %vec, i32 1 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_2 = extractelement <16 x i8> %vec, i32 2 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_3 = extractelement <16 x i8> %vec, i32 3 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_4 = extractelement <16 x i8> %vec, i32 4 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_5 = extractelement <16 x i8> %vec, i32 5 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_6 = extractelement <16 x i8> %vec, i32 6 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_7 = extractelement <16 x i8> %vec, i32 7 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_8 = extractelement <16 x i8> %vec, i32 8 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_9 = extractelement <16 x i8> %vec, i32 9 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_10 = extractelement <16 x i8> %vec, i32 10 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_11 = extractelement <16 x i8> %vec, i32 11 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_12 = extractelement <16 x i8> %vec, i32 12 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_13 = extractelement <16 x i8> %vec, i32 13 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_14 = extractelement <16 x i8> %vec, i32 14 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %extract_15 = extractelement <16 x i8> %vec, i32 15 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void +; + %extract_0 = extractelement<16 x i8> %vec, i32 0 + %extract_1 = extractelement<16 x i8> %vec, i32 1 + %extract_2 = extractelement<16 x i8> %vec, i32 2 + %extract_3 = extractelement<16 x i8> %vec, i32 3 + %extract_4 = extractelement<16 x i8> %vec, i32 4 + %extract_5 = extractelement<16 x i8> %vec, i32 5 + %extract_6 = extractelement<16 x i8> %vec, i32 6 + %extract_7 = extractelement<16 x i8> %vec, i32 7 + %extract_8 = extractelement<16 x i8> %vec, i32 8 + %extract_9 = extractelement<16 x i8> %vec, i32 9 + %extract_10 = extractelement<16 x i8> %vec, i32 10 + %extract_11 = extractelement<16 x i8> %vec, i32 11 + %extract_12 = extractelement<16 x i8> %vec, i32 12 + %extract_13 = extractelement<16 x i8> %vec, i32 13 + %extract_14 = extractelement<16 x i8> %vec, i32 14 + %extract_15 = extractelement<16 x i8> %vec, i32 15 + ret void +}