1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py 2; RUN: opt < %s -mtriple=aarch64-unknown-linux-gnu -passes="print<cost-model>" -cost-kind=throughput 2>&1 -disable-output | FileCheck %s --check-prefix=THROUGHPUT 3 4; Verify the cost of (vector) multiply instructions. 5 6target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" 7 8define <2 x i8> @t1(<2 x i8> %a, <2 x i8> %b) { 9; THROUGHPUT-LABEL: 't1' 10; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <2 x i8> %a, %b 11; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i8> %1 12; 13 %1 = mul <2 x i8> %a, %b 14 ret <2 x i8> %1 15} 16 17define <4 x i8> @t2(<4 x i8> %a, <4 x i8> %b) { 18; THROUGHPUT-LABEL: 't2' 19; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <4 x i8> %a, %b 20; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i8> %1 21; 22 %1 = mul <4 x i8> %a, %b 23 ret <4 x i8> %1 24} 25 26define <8 x i8> @t3(<8 x i8> %a, <8 x i8> %b) { 27; THROUGHPUT-LABEL: 't3' 28; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <8 x i8> %a, %b 29; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i8> %1 30; 31 %1 = mul <8 x i8> %a, %b 32 ret <8 x i8> %1 33} 34 35define <16 x i8> @t4(<16 x i8> %a, <16 x i8> %b) { 36; THROUGHPUT-LABEL: 't4' 37; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <16 x i8> %a, %b 38; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i8> %1 39; 40 %1 = mul <16 x i8> %a, %b 41 ret <16 x i8> %1 42} 43 44define <32 x i8> @t5(<32 x i8> %a, <32 x i8> %b) { 45; THROUGHPUT-LABEL: 't5' 46; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %1 = mul <32 x i8> %a, %b 47; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <32 x i8> %1 48; 49 %1 = mul <32 x i8> %a, %b 50 ret <32 x i8> %1 51} 52 53define <2 x i16> @t6(<2 x i16> %a, <2 x i16> %b) { 54; THROUGHPUT-LABEL: 't6' 55; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <2 x i16> %a, %b 56; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i16> %1 57; 58 %1 = mul <2 x i16> %a, %b 59 ret <2 x i16> %1 60} 61 62define <4 x i16> @t7(<4 x i16> %a, <4 x i16> %b) { 63; THROUGHPUT-LABEL: 't7' 64; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <4 x i16> %a, %b 65; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i16> %1 66; 67 %1 = mul <4 x i16> %a, %b 68 ret <4 x i16> %1 69} 70 71define <8 x i16> @t8(<8 x i16> %a, <8 x i16> %b) { 72; THROUGHPUT-LABEL: 't8' 73; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <8 x i16> %a, %b 74; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i16> %1 75; 76 %1 = mul <8 x i16> %a, %b 77 ret <8 x i16> %1 78} 79 80define <16 x i16> @t9(<16 x i16> %a, <16 x i16> %b) { 81; THROUGHPUT-LABEL: 't9' 82; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %1 = mul <16 x i16> %a, %b 83; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <16 x i16> %1 84; 85 %1 = mul <16 x i16> %a, %b 86 ret <16 x i16> %1 87} 88 89define <2 x i32> @t10(<2 x i32> %a, <2 x i32> %b) { 90; THROUGHPUT-LABEL: 't10' 91; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <2 x i32> %a, %b 92; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i32> %1 93; 94 %1 = mul <2 x i32> %a, %b 95 ret <2 x i32> %1 96} 97 98define <4 x i32> @t11(<4 x i32> %a, <4 x i32> %b) { 99; THROUGHPUT-LABEL: 't11' 100; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = mul <4 x i32> %a, %b 101; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i32> %1 102; 103 %1 = mul <4 x i32> %a, %b 104 ret <4 x i32> %1 105} 106 107define <8 x i32> @t12(<8 x i32> %a, <8 x i32> %b) { 108; THROUGHPUT-LABEL: 't12' 109; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %1 = mul <8 x i32> %a, %b 110; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <8 x i32> %1 111; 112 %1 = mul <8 x i32> %a, %b 113 ret <8 x i32> %1 114} 115 116define <2 x i64> @t13(<2 x i64> %a, <2 x i64> %b) { 117; THROUGHPUT-LABEL: 't13' 118; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 14 for instruction: %1 = mul nsw <2 x i64> %a, %b 119; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <2 x i64> %1 120; 121 %1 = mul nsw <2 x i64> %a, %b 122 ret <2 x i64> %1 123} 124 125define <4 x i64> @t14(<4 x i64> %a, <4 x i64> %b) { 126; THROUGHPUT-LABEL: 't14' 127; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 28 for instruction: %1 = mul nsw <4 x i64> %a, %b 128; THROUGHPUT-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <4 x i64> %1 129; 130 %1 = mul nsw <4 x i64> %a, %b 131 ret <4 x i64> %1 132} 133