diff --git a/llvm/lib/Target/AArch64/AArch64Subtarget.cpp b/llvm/lib/Target/AArch64/AArch64Subtarget.cpp --- a/llvm/lib/Target/AArch64/AArch64Subtarget.cpp +++ b/llvm/lib/Target/AArch64/AArch64Subtarget.cpp @@ -188,6 +188,7 @@ PrefFunctionLogAlignment = 4; PrefLoopLogAlignment = 5; MaxBytesForLoopAlignment = 16; + VectorInsertExtractBaseCost = 1; break; case NeoverseN2: PrefFunctionLogAlignment = 4; diff --git a/llvm/test/Analysis/CostModel/AArch64/vector-extract.ll b/llvm/test/Analysis/CostModel/AArch64/vector-extract.ll --- a/llvm/test/Analysis/CostModel/AArch64/vector-extract.ll +++ b/llvm/test/Analysis/CostModel/AArch64/vector-extract.ll @@ -10,7 +10,7 @@ ; ; 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 1 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 @@ -28,9 +28,9 @@ ; ; 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 1 for instruction: %extract_1 = extractelement <4 x float> %vec, i32 1 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %extract_2 = extractelement <4 x float> %vec, i32 2 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 1 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 @@ -48,7 +48,7 @@ ; ; 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 1 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 @@ -66,9 +66,9 @@ ; ; 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 1 for instruction: %extract_1 = extractelement <4 x i32> %vec, i32 1 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %extract_2 = extractelement <4 x i32> %vec, i32 2 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 1 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 @@ -92,13 +92,13 @@ ; ; 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 1 for instruction: %extract_1 = extractelement <8 x i16> %vec, i32 1 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %extract_2 = extractelement <8 x i16> %vec, i32 2 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %extract_3 = extractelement <8 x i16> %vec, i32 3 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %extract_4 = extractelement <8 x i16> %vec, i32 4 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %extract_5 = extractelement <8 x i16> %vec, i32 5 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %extract_6 = extractelement <8 x i16> %vec, i32 6 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 1 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 @@ -134,21 +134,21 @@ ; ; 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 1 for instruction: %extract_1 = extractelement <16 x i8> %vec, i32 1 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %extract_2 = extractelement <16 x i8> %vec, i32 2 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %extract_3 = extractelement <16 x i8> %vec, i32 3 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %extract_4 = extractelement <16 x i8> %vec, i32 4 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %extract_5 = extractelement <16 x i8> %vec, i32 5 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %extract_6 = extractelement <16 x i8> %vec, i32 6 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %extract_7 = extractelement <16 x i8> %vec, i32 7 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %extract_8 = extractelement <16 x i8> %vec, i32 8 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %extract_9 = extractelement <16 x i8> %vec, i32 9 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %extract_10 = extractelement <16 x i8> %vec, i32 10 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %extract_11 = extractelement <16 x i8> %vec, i32 11 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %extract_12 = extractelement <16 x i8> %vec, i32 12 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %extract_13 = extractelement <16 x i8> %vec, i32 13 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %extract_14 = extractelement <16 x i8> %vec, i32 14 +; NEOVERSE-N1-NEXT: Cost Model: Found an estimated cost of 1 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