1; RUN: llc -march=amdgcn -mcpu=SI < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s 2 3; FUNC-LABEL: {{^}}round_f64: 4; SI: s_endpgm 5define void @round_f64(double addrspace(1)* %out, double %x) #0 { 6 %result = call double @llvm.round.f64(double %x) #1 7 store double %result, double addrspace(1)* %out 8 ret void 9} 10 11; This is a pretty large function, so just test a few of the 12; instructions that are necessary. 13 14; FUNC-LABEL: {{^}}v_round_f64: 15; SI: buffer_load_dwordx2 16; SI-DAG: v_bfe_u32 [[EXP:v[0-9]+]], v{{[0-9]+}}, 20, 11 17 18; SI-DAG: v_not_b32_e32 19; SI-DAG: v_not_b32_e32 20 21; SI-DAG: v_cmp_eq_i32 22 23; SI-DAG: s_mov_b32 [[BFIMASK:s[0-9]+]], 0x7fffffff 24; SI-DAG: v_cmp_gt_i32 25; SI-DAG: v_bfi_b32 [[COPYSIGN:v[0-9]+]], [[BFIMASK]] 26 27; SI: buffer_store_dwordx2 28; SI: s_endpgm 29define void @v_round_f64(double addrspace(1)* %out, double addrspace(1)* %in) #0 { 30 %tid = call i32 @llvm.amdgcn.workitem.id.x() #1 31 %gep = getelementptr double, double addrspace(1)* %in, i32 %tid 32 %out.gep = getelementptr double, double addrspace(1)* %out, i32 %tid 33 %x = load double, double addrspace(1)* %gep 34 %result = call double @llvm.round.f64(double %x) #1 35 store double %result, double addrspace(1)* %out.gep 36 ret void 37} 38 39; FUNC-LABEL: {{^}}round_v2f64: 40; SI: s_endpgm 41define void @round_v2f64(<2 x double> addrspace(1)* %out, <2 x double> %in) #0 { 42 %result = call <2 x double> @llvm.round.v2f64(<2 x double> %in) #1 43 store <2 x double> %result, <2 x double> addrspace(1)* %out 44 ret void 45} 46 47; FUNC-LABEL: {{^}}round_v4f64: 48; SI: s_endpgm 49define void @round_v4f64(<4 x double> addrspace(1)* %out, <4 x double> %in) #0 { 50 %result = call <4 x double> @llvm.round.v4f64(<4 x double> %in) #1 51 store <4 x double> %result, <4 x double> addrspace(1)* %out 52 ret void 53} 54 55; FUNC-LABEL: {{^}}round_v8f64: 56; SI: s_endpgm 57define void @round_v8f64(<8 x double> addrspace(1)* %out, <8 x double> %in) #0 { 58 %result = call <8 x double> @llvm.round.v8f64(<8 x double> %in) #1 59 store <8 x double> %result, <8 x double> addrspace(1)* %out 60 ret void 61} 62 63declare i32 @llvm.amdgcn.workitem.id.x() #1 64 65declare double @llvm.round.f64(double) #1 66declare <2 x double> @llvm.round.v2f64(<2 x double>) #1 67declare <4 x double> @llvm.round.v4f64(<4 x double>) #1 68declare <8 x double> @llvm.round.v8f64(<8 x double>) #1 69 70attributes #0 = { nounwind } 71attributes #1 = { nounwind readnone } 72