1; RUN: opt -cost-model -analyze -mtriple=amdgcn-unknown-amdhsa -mcpu=gfx900 -mattr=+half-rate-64-ops < %s | FileCheck -check-prefixes=FASTF64,FASTF16,ALL %s 2; RUN: opt -cost-model -analyze -mtriple=amdgcn-unknown-amdhsa -mattr=-half-rate-64-ops < %s | FileCheck -check-prefixes=SLOWF64,SLOWF16,ALL %s 3; RUN: opt -cost-model -cost-kind=code-size -analyze -mtriple=amdgcn-unknown-amdhsa -mcpu=gfx900 -mattr=+half-rate-64-ops < %s | FileCheck -check-prefixes=FASTF16,SIZEALL,ALL %s 4; RUN: opt -cost-model -cost-kind=code-size -analyze -mtriple=amdgcn-unknown-amdhsa -mattr=-half-rate-64-ops < %s | FileCheck -check-prefixes=SLOWF16,SIZEALL,ALL %s 5; RUN: opt -cost-model -analyze -mtriple=amdgcn-unknown-amdhsa -mcpu=gfx90a -mattr=+half-rate-64-ops < %s | FileCheck -check-prefixes=GFX90A-FASTF64,FASTF16,PACKEDF32,ALL %s 6; END. 7 8; ALL-LABEL: 'fadd_f32' 9; ALL: estimated cost of 1 for {{.*}} fadd float 10; NOPACKEDF32: estimated cost of 2 for {{.*}} fadd <2 x float> 11; PACKEDF32: estimated cost of 1 for {{.*}} fadd <2 x float> 12; Allow for 4 when v3f32 is illegal and TargetLowering thinks it needs widening, 13; and 3 when it is legal. 14; NOPACKEDF32: estimated cost of {{[34]}} for {{.*}} fadd <3 x float> 15; PACKEDF32: estimated cost of 2 for {{.*}} fadd <3 x float> 16; Allow for 8 when v5f32 is illegal and TargetLowering thinks it needs widening, 17; and 5 when it is legal. 18; NOPACKEDF32: estimated cost of {{[58]}} for {{.*}} fadd <5 x float> 19; PACKEDF32: estimated cost of 3 for {{.*}} fadd <5 x float> 20define amdgpu_kernel void @fadd_f32() #0 { 21 %f32 = fadd float undef, undef 22 %v2f32 = fadd <2 x float> undef, undef 23 %v3f32 = fadd <3 x float> undef, undef 24 %v5f32 = fadd <5 x float> undef, undef 25 ret void 26} 27 28; ALL-LABEL: 'fadd_f64' 29; GFX90A-FASTF64: estimated cost of 1 for {{.*}} fadd double 30; FASTF64: estimated cost of 2 for {{.*}} fadd double 31; SLOWF64: estimated cost of 4 for {{.*}} fadd double 32; SIZEALL: estimated cost of 2 for {{.*}} fadd double 33; GFX90A-FASTF64: estimated cost of 2 for {{.*}} fadd <2 x double> 34; FASTF64: estimated cost of 4 for {{.*}} fadd <2 x double> 35; SLOWF64: estimated cost of 8 for {{.*}} fadd <2 x double> 36; SIZEALL: estimated cost of 4 for {{.*}} fadd <2 x double> 37; GFX90A-FASTF64: estimated cost of 3 for {{.*}} fadd <3 x double> 38; FASTF64: estimated cost of 6 for {{.*}} fadd <3 x double> 39; SLOWF64: estimated cost of 12 for {{.*}} fadd <3 x double> 40; SIZEALL: estimated cost of 6 for {{.*}} fadd <3 x double> 41define amdgpu_kernel void @fadd_f64() #0 { 42 %f64 = fadd double undef, undef 43 %v2f64 = fadd <2 x double> undef, undef 44 %v3f64 = fadd <3 x double> undef, undef 45 ret void 46} 47 48; ALL-LABEL: 'fadd_f16' 49; ALL: estimated cost of 1 for {{.*}} fadd half 50; SLOWF16: estimated cost of 2 for {{.*}} fadd <2 x half> 51; FASTF16: estimated cost of 1 for {{.*}} fadd <2 x half> 52; SLOWF16: estimated cost of 4 for {{.*}} fadd <3 x half> 53; FASTF16: estimated cost of 2 for {{.*}} fadd <3 x half> 54; SLOWF16: estimated cost of 4 for {{.*}} fadd <4 x half> 55; FASTF16: estimated cost of 2 for {{.*}} fadd <4 x half> 56define amdgpu_kernel void @fadd_f16() #0 { 57 %f16 = fadd half undef, undef 58 %v2f16 = fadd <2 x half> undef, undef 59 %v3f16 = fadd <3 x half> undef, undef 60 %v4f16 = fadd <4 x half> undef, undef 61 ret void 62} 63 64attributes #0 = { nounwind } 65