1module &module:1:0:$full:$large:$default; 2 3/* Function calls and argument passing. */ 4 5/* { dg-do compile } */ 6/* { dg-options "-fdump-tree-gimple" } */ 7 8prog function &subfunction(arg_u32 %return_value)(arg_f32 %float_arg, arg_f64 %double_arg, arg_f16 %half_arg) { 9 ld_arg_f32 $s0, [%float_arg]; 10 cvt_u32_f32 $s0, $s0; 11 12 ld_arg_f64 $d0, [%double_arg]; 13 cvt_u32_f64 $s1, $d0; 14 15 ld_arg_f16 $s2, [%half_arg]; 16 cvt_u32_f16 $s2, $s2; 17 18 add_u32 $s3, $s0, $s1; 19 add_u32 $s3, $s3, $s2; 20 21 st_arg_u32 $s3, [%return_value]; 22 ret; 23}; 24 25prog kernel &kernel(kernarg_u64 %input_ptr, kernarg_u64 %output_ptr) 26{ 27 ld_kernarg_u64 $d0, [%input_ptr]; 28 ld_global_u32 $s0, [$d0]; 29 { 30 arg_f32 %float_arg; 31 arg_f64 %double_arg; 32 arg_f16 %half_arg; 33 arg_u32 %return_value; 34 35 st_arg_f32 12.0f, [%float_arg]; 36 st_arg_f64 640.0d, [%double_arg]; 37 st_arg_f16 12.0h, [%half_arg]; 38 39 call &subfunction(%return_value)(%float_arg, %double_arg, %half_arg); 40 41 ld_arg_u32 $s1, [%return_value]; 42 } 43 ld_kernarg_u64 $d1, [%output_ptr]; 44 st_global_u32 $s1, [$d0]; 45}; 46 47/* The generated function call should have the incoming arguments and three hidden arguments. */ 48 49/* { dg-final { scan-tree-dump "_\[0-9\]+ = subfunction \\\(_kernel.float_arg.\[_0-9\]+, _kernel.double_arg.\[_0-9\]+, _kernel.half_arg.\[_0-9\]+, __context, __group_base_addr, group_local_offset.*, __private_base_addr\\\);" "gimple"} } */ 50 51/* The callee should refer directly to the scalar arguments when it reads them. */ 52/* { dg-final { scan-tree-dump "= float_arg;" "gimple"} } */ 53/* { dg-final { scan-tree-dump "= double_arg;" "gimple"} } */ 54/* { dg-final { scan-tree-dump "= half_arg;" "gimple"} } */ 55 56/* The return value is stored to a temporary before returned. */ 57/* { dg-final { scan-tree-dump "_retvalue_temp = s3;" "gimple"} } */ 58/* { dg-final { scan-tree-dump "D.\[0-9\]+ = _retvalue_temp;" "gimple"} } */ 59/* { dg-final { scan-tree-dump "return D.\[0-9\]+;" "gimple"} } */ 60