1; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -O1 < %s | FileCheck -check-prefixes=OPT,OPT-EXT %s 2; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -O1 --amdgpu-internalize-symbols < %s | FileCheck -check-prefixes=OPT,OPT-INT %s 3; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefix=LLC %s 4 5; OPT: declare void @foo4() local_unnamed_addr #0 6; OPT: define internal fastcc void @0() unnamed_addr #1 7; OPT-EXT: define void @foo3() local_unnamed_addr #1 8; OPT-INT: define internal fastcc void @foo3.2() unnamed_addr #1 9; OPT-EXT: define void @foo2() local_unnamed_addr #1 10; OPT-INT: define internal fastcc void @foo2.3() unnamed_addr #1 11; OPT-EXT: define void @foo1() local_unnamed_addr #1 12; OPT-EXT: tail call void @foo4() 13; OPT-EXT: tail call void @foo3() 14; OPT-EXT: tail call void @foo2() 15; OPT-EXT: tail call void @foo2() 16; OPT-EXT: tail call void @foo1() 17; OPT-EXT: tail call fastcc void @0() 18; OPT-INT: define internal fastcc void @foo1.1() unnamed_addr #1 19; OPT-INT: tail call void @foo4() 20; OPT-INT: tail call fastcc void @foo3.2() 21; OPT-INT: tail call fastcc void @foo2.3() 22; OPT-INT: tail call fastcc void @foo2.3() 23; OPT-INT: tail call fastcc void @foo1.1() 24; OPT-INT: tail call fastcc void @0() 25; OPT: ret void 26; OPT: define amdgpu_kernel void @kernel1() local_unnamed_addr #2 27; OPT-EXT: tail call fastcc void @foo1.1() 28; OPT-INT: tail call fastcc void @foo1() 29; OPT: ret void 30; OPT: define amdgpu_kernel void @kernel2() local_unnamed_addr #3 31; OPT-EXT: tail call void @foo2() 32; OPT-INT: tail call fastcc void @foo2.3() 33; OPT: ret void 34; OPT: define amdgpu_kernel void @kernel3() local_unnamed_addr #3 35; OPT-EXT: tail call void @foo1() 36; OPT-INT: tail call fastcc void @foo1.1() 37; OPT: ret void 38; OPT-EXT: define internal fastcc void @foo1.1() unnamed_addr #4 39; OPT-EXT: tail call void @foo4() 40; OPT-EXT: tail call fastcc void @foo3.2() 41; OPT-EXT: tail call fastcc void @foo2.3() 42; OPT-EXT: tail call fastcc void @foo2.3() 43; OPT-EXT: tail call fastcc void @foo1.1() 44; OPT-EXT: tail call fastcc void @1() 45; OPT-INT: define internal fastcc void @foo1() unnamed_addr #4 46; OPT-INT: tail call void @foo4() 47; OPT-INT: tail call fastcc void @foo3() 48; OPT-INT: tail call fastcc void @foo2() 49; OPT-INT: tail call fastcc void @foo2() 50; OPT-INT: tail call fastcc void @foo1() 51; OPT-INT: tail call fastcc void @1() 52; OPT: ret void 53; OPT: define internal fastcc void @1() unnamed_addr #4 54; OPT-EXT: define internal fastcc void @foo3.2() unnamed_addr #4 55; OPT-INT: define internal fastcc void @foo3() unnamed_addr #4 56; OPT-EXT: define internal fastcc void @foo2.3() unnamed_addr #4 57; OPT-INT: define internal fastcc void @foo2() unnamed_addr #4 58; OPT: attributes #0 = { {{.*}} "amdgpu-waves-per-eu"="1,1" "target-features"="+wavefrontsize64" } 59; OPT: attributes #1 = { {{.*}} "target-features"="{{.*}},-wavefrontsize16,-wavefrontsize32,+wavefrontsize64{{.*}}" } 60; OPT: attributes #2 = { {{.*}} "amdgpu-waves-per-eu"="2,4" "target-features"="+wavefrontsize32" } 61; OPT: attributes #3 = { {{.*}} "target-features"="+wavefrontsize64" } 62; OPT: attributes #4 = { {{.*}} "amdgpu-waves-per-eu"="2,4" "target-features"="{{.*}},-wavefrontsize16,+wavefrontsize32,-wavefrontsize64{{.*}}" } 63 64; LLC: foo3: 65; LLC: sample asm 66; LLC: foo2: 67; LLC: sample asm 68; LLC: foo1: 69; LLC: foo4@gotpcrel32@lo+4 70; LLC: foo4@gotpcrel32@hi+4 71; LLC: foo3@gotpcrel32@lo+4 72; LLC: foo3@gotpcrel32@hi+4 73; LLC: foo2@gotpcrel32@lo+4 74; LLC: foo2@gotpcrel32@hi+4 75; LLC: foo1@gotpcrel32@lo+4 76; LLC: foo1@gotpcrel32@hi+4 77; LLC: __unnamed_1@gotpcrel32@lo+4 78; LLC: __unnamed_1@gotpcrel32@hi+4 79; LLC: kernel1: 80; LLC: foo1@gotpcrel32@lo+4 81; LLC: foo1@gotpcrel32@hi+4 82; LLC: kernel2: 83; LLC: foo2@gotpcrel32@lo+4 84; LLC: foo2@gotpcrel32@hi+4 85; LLC: kernel3: 86; LLC: foo1@gotpcrel32@lo+4 87; LLC: foo1@gotpcrel32@hi+4 88 89declare void @foo4() #1 90 91define void @0() #1 { 92entry: 93 call void asm sideeffect "; sample asm", ""() 94 ret void 95} 96 97define void @foo3() #4 { 98entry: 99 call void asm sideeffect "; sample asm", ""() 100 ret void 101} 102 103define void @foo2() #1 { 104entry: 105 call void asm sideeffect "; sample asm", ""() 106 ret void 107} 108 109define void @foo1() #1 { 110entry: 111 tail call void @foo4() 112 tail call void @foo3() 113 tail call void @foo2() 114 tail call void @foo2() 115 tail call void @foo1() 116 tail call void @0() 117 ret void 118} 119 120define amdgpu_kernel void @kernel1() #0 { 121entry: 122 tail call void @foo1() 123 ret void 124} 125 126define amdgpu_kernel void @kernel2() #2 { 127entry: 128 tail call void @foo2() 129 ret void 130} 131 132define amdgpu_kernel void @kernel3() #3 { 133entry: 134 tail call void @foo1() 135 ret void 136} 137 138attributes #0 = { nounwind "target-features"="+wavefrontsize32" "amdgpu-waves-per-eu"="2,4" } 139attributes #1 = { noinline nounwind "target-features"="+wavefrontsize64" "amdgpu-waves-per-eu"="1,1" } 140attributes #2 = { nounwind "target-features"="+wavefrontsize64" } 141attributes #3 = { nounwind "target-features"="+wavefrontsize64" } 142attributes #4 = { noinline nounwind "target-features"="+wavefrontsize64" "amdgpu-waves-per-eu"="2,4" } 143