1; RUN: opt -cost-model -analyze -mtriple=aarch64-linux-gnu -mattr=+neon < %s | FileCheck %s 2 3; Verify the cost of integer division by constant. 4 5define <16 x i8> @sdiv8xi16(<16 x i8> %x) { 6; CHECK-LABEL: 'Cost Model Analysis' for function 'sdiv8xi16': 7; CHECK: Found an estimated cost of 9 for instruction: %div = sdiv <16 x i8> %x, <i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9> 8 %div = sdiv <16 x i8> %x, <i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9> 9 ret <16 x i8> %div 10} 11 12define <8 x i16> @sdiv16xi8(<8 x i16> %x) { 13; CHECK-LABEL: 'Cost Model Analysis' for function 'sdiv16xi8': 14; CHECK: Found an estimated cost of 9 for instruction: %div = sdiv <8 x i16> %x, <i16 9, i16 9, i16 9, i16 9, i16 9, i16 9, i16 9, i16 9> 15 %div = sdiv <8 x i16> %x, <i16 9, i16 9, i16 9, i16 9, i16 9, i16 9, i16 9, i16 9> 16 ret <8 x i16> %div 17} 18 19define <4 x i32> @sdiv32xi4(<4 x i32> %x) { 20; CHECK-LABEL: 'Cost Model Analysis' for function 'sdiv32xi4': 21; CHECK: Found an estimated cost of 9 for instruction: %div = sdiv <4 x i32> %x, <i32 9, i32 9, i32 9, i32 9> 22 %div = sdiv <4 x i32> %x, <i32 9, i32 9, i32 9, i32 9> 23 ret <4 x i32> %div 24} 25 26define <16 x i8> @udiv8xi16(<16 x i8> %x) { 27; CHECK-LABEL: 'Cost Model Analysis' for function 'udiv8xi16': 28; CHECK: Found an estimated cost of 9 for instruction: %div = udiv <16 x i8> %x, <i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9> 29 %div = udiv <16 x i8> %x, <i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9, i8 9> 30 ret <16 x i8> %div 31} 32 33define <8 x i16> @udiv16xi8(<8 x i16> %x) { 34; CHECK-LABEL: 'Cost Model Analysis' for function 'udiv16xi8': 35; CHECK: Found an estimated cost of 9 for instruction: %div = udiv <8 x i16> %x, <i16 9, i16 9, i16 9, i16 9, i16 9, i16 9, i16 9, i16 9> 36 %div = udiv <8 x i16> %x, <i16 9, i16 9, i16 9, i16 9, i16 9, i16 9, i16 9, i16 9> 37 ret <8 x i16> %div 38} 39 40define <4 x i32> @udiv32xi4(<4 x i32> %x) { 41; CHECK-LABEL: Printing analysis 'Cost Model Analysis' for function 'udiv32xi4': 42; CHECK: Found an estimated cost of 9 for instruction: %div = udiv <4 x i32> %x, <i32 9, i32 9, i32 9, i32 9> 43 %div = udiv <4 x i32> %x, <i32 9, i32 9, i32 9, i32 9> 44 ret <4 x i32> %div 45} 46