1module &module:1:0:$full:$large:$default; 2 3/* Tests for load/store addressing modes. */ 4 5/* { dg-do compile } */ 6/* { dg-options "-fdump-tree-original" } */ 7 8prog kernel &Kernel(kernarg_u64 %input_ptr, kernarg_u64 %input_ptr2, kernarg_u64 %output_ptr) 9{ 10 global_u32 %global_array[4]; 11 12 ld_kernarg_u64 $d0, [%input_ptr]; 13 ld_kernarg_u64 $d2, [%input_ptr2]; 14 ld_global_u32 $s0, [$d0]; 15 ld_global_u64 $d1, [$d2 + 4]; 16 17 ld_global_u32 $s2, [%global_array][$d1 + 4]; 18 19 ld_kernarg_u64 $d0, [%output_ptr]; 20 st_global_u32 $s0, [$d0]; 21 st_global_u32 $s1, [$d0 + 4]; 22 st_global_u32 $s2, [$d0 + 8]; 23 24 ret; 25}; 26 27/* %input_ptr, %input_ptr2 and %output_ptr accesses should generate offsets to the __args array */ 28/* { dg-final { scan-tree-dump "__args;\[\n \]+d0 =" "original"} } */ 29/* { dg-final { scan-tree-dump "\\\(__args \\\+ 8\\\);\[\n \]+d2 =" "original"} } */ 30/* { dg-final { scan-tree-dump "\\\(__args \\\+ 16\\\);\[\n \]+d0 =" "original"} } */ 31 32/* ld_global_u32 $s0, [$d0] */ 33/* { dg-final { scan-tree-dump "\\\*\\\(unsigned int \\\*\\\) d0;\[\n \]+s0 =" "original"} } */ 34 35/* ld_global_u64 $d1, [$d2 + 4] pointer arithmetics*/ 36/* { dg-final { scan-tree-dump "d2 \\\+ 4\\\);\[\n \]+d1 = " "original"} } */ 37 38/* ld_global_u32 $s2, [%global_array][$d1 + 4]; is the most complex form */ 39/* { dg-final { scan-tree-dump "\\\(unsigned long\\\) &_Kernel.global_array\\\) \\\+ \\\(unsigned long\\\) d1\\\) \\\+ 4" "original" } } */ 40