brintos

brintos / llvm-project-archived public Read only

0
0
Text · 41.6 KiB · c005695 Raw
892 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-attributes --check-globals all --version 52; Test the generation of the attribute amdgpu-no-flat-scratch-init3; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -passes=amdgpu-attributor < %s | FileCheck -check-prefixes=GFX9 %s4; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -passes=amdgpu-attributor < %s | FileCheck -check-prefixes=GFX10 %s5 6;; tests of addrspacecast7 8;.9; GFX9: @gv.fptr0 = external hidden unnamed_addr addrspace(4) constant ptr, align 410;.11; GFX10: @gv.fptr0 = external hidden unnamed_addr addrspace(4) constant ptr, align 412;.13define void @without_global_to_flat_addrspacecast(ptr addrspace(1) %ptr) {14; GFX9-LABEL: define void @without_global_to_flat_addrspacecast(15; GFX9-SAME: ptr addrspace(1) [[PTR:%.*]]) #[[ATTR0:[0-9]+]] {16; GFX9-NEXT:    store volatile i32 0, ptr addrspace(1) [[PTR]], align 417; GFX9-NEXT:    ret void18;19; GFX10-LABEL: define void @without_global_to_flat_addrspacecast(20; GFX10-SAME: ptr addrspace(1) [[PTR:%.*]]) #[[ATTR0:[0-9]+]] {21; GFX10-NEXT:    store volatile i32 0, ptr addrspace(1) [[PTR]], align 422; GFX10-NEXT:    ret void23;24  store volatile i32 0, ptr addrspace(1) %ptr25  ret void26}27 28define amdgpu_kernel void @without_global_to_flat_addrspacecast_cc_kernel(ptr addrspace(1) %ptr) {29; GFX9-LABEL: define amdgpu_kernel void @without_global_to_flat_addrspacecast_cc_kernel(30; GFX9-SAME: ptr addrspace(1) [[PTR:%.*]]) #[[ATTR0]] {31; GFX9-NEXT:    store volatile i32 0, ptr addrspace(1) [[PTR]], align 432; GFX9-NEXT:    ret void33;34; GFX10-LABEL: define amdgpu_kernel void @without_global_to_flat_addrspacecast_cc_kernel(35; GFX10-SAME: ptr addrspace(1) [[PTR:%.*]]) #[[ATTR0]] {36; GFX10-NEXT:    store volatile i32 0, ptr addrspace(1) [[PTR]], align 437; GFX10-NEXT:    ret void38;39  store volatile i32 0, ptr addrspace(1) %ptr40  ret void41}42 43define void @with_global_to_flat_addrspacecast(ptr addrspace(1) %ptr) {44; GFX9-LABEL: define void @with_global_to_flat_addrspacecast(45; GFX9-SAME: ptr addrspace(1) [[PTR:%.*]]) #[[ATTR0]] {46; GFX9-NEXT:    [[STOF:%.*]] = addrspacecast ptr addrspace(1) [[PTR]] to ptr47; GFX9-NEXT:    store volatile i32 0, ptr [[STOF]], align 4, !noalias.addrspace [[META0:![0-9]+]]48; GFX9-NEXT:    ret void49;50; GFX10-LABEL: define void @with_global_to_flat_addrspacecast(51; GFX10-SAME: ptr addrspace(1) [[PTR:%.*]]) #[[ATTR0]] {52; GFX10-NEXT:    [[STOF:%.*]] = addrspacecast ptr addrspace(1) [[PTR]] to ptr53; GFX10-NEXT:    store volatile i32 0, ptr [[STOF]], align 4, !noalias.addrspace [[META0:![0-9]+]]54; GFX10-NEXT:    ret void55;56  %stof = addrspacecast ptr addrspace(1) %ptr to ptr57  store volatile i32 0, ptr %stof58  ret void59}60 61define amdgpu_kernel void @with_global_to_flat_addrspacecast_cc_kernel(ptr addrspace(1) %ptr) {62; GFX9-LABEL: define amdgpu_kernel void @with_global_to_flat_addrspacecast_cc_kernel(63; GFX9-SAME: ptr addrspace(1) [[PTR:%.*]]) #[[ATTR0]] {64; GFX9-NEXT:    [[STOF:%.*]] = addrspacecast ptr addrspace(1) [[PTR]] to ptr65; GFX9-NEXT:    store volatile i32 0, ptr [[STOF]], align 4, !noalias.addrspace [[META0]]66; GFX9-NEXT:    ret void67;68; GFX10-LABEL: define amdgpu_kernel void @with_global_to_flat_addrspacecast_cc_kernel(69; GFX10-SAME: ptr addrspace(1) [[PTR:%.*]]) #[[ATTR0]] {70; GFX10-NEXT:    [[STOF:%.*]] = addrspacecast ptr addrspace(1) [[PTR]] to ptr71; GFX10-NEXT:    store volatile i32 0, ptr [[STOF]], align 4, !noalias.addrspace [[META0]]72; GFX10-NEXT:    ret void73;74  %stof = addrspacecast ptr addrspace(1) %ptr to ptr75  store volatile i32 0, ptr %stof76  ret void77}78 79define void @without_region_to_flat_addrspacecast(ptr addrspace(2) %ptr) {80; GFX9-LABEL: define void @without_region_to_flat_addrspacecast(81; GFX9-SAME: ptr addrspace(2) [[PTR:%.*]]) #[[ATTR0]] {82; GFX9-NEXT:    store volatile i32 0, ptr addrspace(2) [[PTR]], align 483; GFX9-NEXT:    ret void84;85; GFX10-LABEL: define void @without_region_to_flat_addrspacecast(86; GFX10-SAME: ptr addrspace(2) [[PTR:%.*]]) #[[ATTR0]] {87; GFX10-NEXT:    store volatile i32 0, ptr addrspace(2) [[PTR]], align 488; GFX10-NEXT:    ret void89;90  store volatile i32 0, ptr addrspace(2) %ptr91  ret void92}93 94define amdgpu_kernel void @without_region_to_flat_addrspacecast_cc_kernel(ptr addrspace(2) %ptr) {95; GFX9-LABEL: define amdgpu_kernel void @without_region_to_flat_addrspacecast_cc_kernel(96; GFX9-SAME: ptr addrspace(2) [[PTR:%.*]]) #[[ATTR0]] {97; GFX9-NEXT:    store volatile i32 0, ptr addrspace(2) [[PTR]], align 498; GFX9-NEXT:    ret void99;100; GFX10-LABEL: define amdgpu_kernel void @without_region_to_flat_addrspacecast_cc_kernel(101; GFX10-SAME: ptr addrspace(2) [[PTR:%.*]]) #[[ATTR0]] {102; GFX10-NEXT:    store volatile i32 0, ptr addrspace(2) [[PTR]], align 4103; GFX10-NEXT:    ret void104;105  store volatile i32 0, ptr addrspace(2) %ptr106  ret void107}108 109define void @with_region_to_flat_addrspacecast(ptr addrspace(2) %ptr) {110; GFX9-LABEL: define void @with_region_to_flat_addrspacecast(111; GFX9-SAME: ptr addrspace(2) [[PTR:%.*]]) #[[ATTR0]] {112; GFX9-NEXT:    [[STOF:%.*]] = addrspacecast ptr addrspace(2) [[PTR]] to ptr113; GFX9-NEXT:    store volatile i32 0, ptr [[STOF]], align 4, !noalias.addrspace [[META1:![0-9]+]]114; GFX9-NEXT:    ret void115;116; GFX10-LABEL: define void @with_region_to_flat_addrspacecast(117; GFX10-SAME: ptr addrspace(2) [[PTR:%.*]]) #[[ATTR0]] {118; GFX10-NEXT:    [[STOF:%.*]] = addrspacecast ptr addrspace(2) [[PTR]] to ptr119; GFX10-NEXT:    store volatile i32 0, ptr [[STOF]], align 4, !noalias.addrspace [[META1:![0-9]+]]120; GFX10-NEXT:    ret void121;122  %stof = addrspacecast ptr addrspace(2) %ptr to ptr123  store volatile i32 0, ptr %stof124  ret void125}126 127define amdgpu_kernel void @with_region_to_flat_addrspacecast_cc_kernel(ptr addrspace(2) %ptr) {128; GFX9-LABEL: define amdgpu_kernel void @with_region_to_flat_addrspacecast_cc_kernel(129; GFX9-SAME: ptr addrspace(2) [[PTR:%.*]]) #[[ATTR0]] {130; GFX9-NEXT:    [[STOF:%.*]] = addrspacecast ptr addrspace(2) [[PTR]] to ptr131; GFX9-NEXT:    store volatile i32 0, ptr [[STOF]], align 4, !noalias.addrspace [[META1]]132; GFX9-NEXT:    ret void133;134; GFX10-LABEL: define amdgpu_kernel void @with_region_to_flat_addrspacecast_cc_kernel(135; GFX10-SAME: ptr addrspace(2) [[PTR:%.*]]) #[[ATTR0]] {136; GFX10-NEXT:    [[STOF:%.*]] = addrspacecast ptr addrspace(2) [[PTR]] to ptr137; GFX10-NEXT:    store volatile i32 0, ptr [[STOF]], align 4, !noalias.addrspace [[META1]]138; GFX10-NEXT:    ret void139;140  %stof = addrspacecast ptr addrspace(2) %ptr to ptr141  store volatile i32 0, ptr %stof142  ret void143}144 145define void @without_group_to_flat_addrspacecast(ptr addrspace(3) %ptr) {146; GFX9-LABEL: define void @without_group_to_flat_addrspacecast(147; GFX9-SAME: ptr addrspace(3) [[PTR:%.*]]) #[[ATTR0]] {148; GFX9-NEXT:    store volatile i32 0, ptr addrspace(3) [[PTR]], align 4149; GFX9-NEXT:    ret void150;151; GFX10-LABEL: define void @without_group_to_flat_addrspacecast(152; GFX10-SAME: ptr addrspace(3) [[PTR:%.*]]) #[[ATTR0]] {153; GFX10-NEXT:    store volatile i32 0, ptr addrspace(3) [[PTR]], align 4154; GFX10-NEXT:    ret void155;156  store volatile i32 0, ptr addrspace(3) %ptr157  ret void158}159 160define amdgpu_kernel void @without_group_to_flat_addrspacecast_cc_kernel(ptr addrspace(3) %ptr) {161; GFX9-LABEL: define amdgpu_kernel void @without_group_to_flat_addrspacecast_cc_kernel(162; GFX9-SAME: ptr addrspace(3) [[PTR:%.*]]) #[[ATTR0]] {163; GFX9-NEXT:    store volatile i32 0, ptr addrspace(3) [[PTR]], align 4164; GFX9-NEXT:    ret void165;166; GFX10-LABEL: define amdgpu_kernel void @without_group_to_flat_addrspacecast_cc_kernel(167; GFX10-SAME: ptr addrspace(3) [[PTR:%.*]]) #[[ATTR0]] {168; GFX10-NEXT:    store volatile i32 0, ptr addrspace(3) [[PTR]], align 4169; GFX10-NEXT:    ret void170;171  store volatile i32 0, ptr addrspace(3) %ptr172  ret void173}174 175define void @with_group_to_flat_addrspacecast(ptr addrspace(3) %ptr) {176; GFX9-LABEL: define void @with_group_to_flat_addrspacecast(177; GFX9-SAME: ptr addrspace(3) [[PTR:%.*]]) #[[ATTR0]] {178; GFX9-NEXT:    [[STOF:%.*]] = addrspacecast ptr addrspace(3) [[PTR]] to ptr179; GFX9-NEXT:    store volatile i32 0, ptr [[STOF]], align 4, !noalias.addrspace [[META2:![0-9]+]]180; GFX9-NEXT:    ret void181;182; GFX10-LABEL: define void @with_group_to_flat_addrspacecast(183; GFX10-SAME: ptr addrspace(3) [[PTR:%.*]]) #[[ATTR0]] {184; GFX10-NEXT:    [[STOF:%.*]] = addrspacecast ptr addrspace(3) [[PTR]] to ptr185; GFX10-NEXT:    store volatile i32 0, ptr [[STOF]], align 4, !noalias.addrspace [[META2:![0-9]+]]186; GFX10-NEXT:    ret void187;188  %stof = addrspacecast ptr addrspace(3) %ptr to ptr189  store volatile i32 0, ptr %stof190  ret void191}192 193define amdgpu_kernel void @with_group_to_flat_addrspacecast_cc_kernel(ptr addrspace(3) %ptr) {194; GFX9-LABEL: define amdgpu_kernel void @with_group_to_flat_addrspacecast_cc_kernel(195; GFX9-SAME: ptr addrspace(3) [[PTR:%.*]]) #[[ATTR0]] {196; GFX9-NEXT:    [[STOF:%.*]] = addrspacecast ptr addrspace(3) [[PTR]] to ptr197; GFX9-NEXT:    store volatile i32 0, ptr [[STOF]], align 4, !noalias.addrspace [[META2]]198; GFX9-NEXT:    ret void199;200; GFX10-LABEL: define amdgpu_kernel void @with_group_to_flat_addrspacecast_cc_kernel(201; GFX10-SAME: ptr addrspace(3) [[PTR:%.*]]) #[[ATTR0]] {202; GFX10-NEXT:    [[STOF:%.*]] = addrspacecast ptr addrspace(3) [[PTR]] to ptr203; GFX10-NEXT:    store volatile i32 0, ptr [[STOF]], align 4, !noalias.addrspace [[META2]]204; GFX10-NEXT:    ret void205;206  %stof = addrspacecast ptr addrspace(3) %ptr to ptr207  store volatile i32 0, ptr %stof208  ret void209}210 211define void @without_constant_to_flat_addrspacecast(ptr addrspace(4) %ptr) {212; GFX9-LABEL: define void @without_constant_to_flat_addrspacecast(213; GFX9-SAME: ptr addrspace(4) [[PTR:%.*]]) #[[ATTR0]] {214; GFX9-NEXT:    store volatile i32 0, ptr addrspace(4) [[PTR]], align 4215; GFX9-NEXT:    ret void216;217; GFX10-LABEL: define void @without_constant_to_flat_addrspacecast(218; GFX10-SAME: ptr addrspace(4) [[PTR:%.*]]) #[[ATTR0]] {219; GFX10-NEXT:    store volatile i32 0, ptr addrspace(4) [[PTR]], align 4220; GFX10-NEXT:    ret void221;222  store volatile i32 0, ptr addrspace(4) %ptr223  ret void224}225 226define amdgpu_kernel void @without_constant_to_flat_addrspacecast_cc_kernel(ptr addrspace(4) %ptr) {227; GFX9-LABEL: define amdgpu_kernel void @without_constant_to_flat_addrspacecast_cc_kernel(228; GFX9-SAME: ptr addrspace(4) [[PTR:%.*]]) #[[ATTR0]] {229; GFX9-NEXT:    store volatile i32 0, ptr addrspace(4) [[PTR]], align 4230; GFX9-NEXT:    ret void231;232; GFX10-LABEL: define amdgpu_kernel void @without_constant_to_flat_addrspacecast_cc_kernel(233; GFX10-SAME: ptr addrspace(4) [[PTR:%.*]]) #[[ATTR0]] {234; GFX10-NEXT:    store volatile i32 0, ptr addrspace(4) [[PTR]], align 4235; GFX10-NEXT:    ret void236;237  store volatile i32 0, ptr addrspace(4) %ptr238  ret void239}240 241define void @with_constant_to_flat_addrspacecast(ptr addrspace(4) %ptr) {242; GFX9-LABEL: define void @with_constant_to_flat_addrspacecast(243; GFX9-SAME: ptr addrspace(4) [[PTR:%.*]]) #[[ATTR0]] {244; GFX9-NEXT:    [[STOF:%.*]] = addrspacecast ptr addrspace(4) [[PTR]] to ptr245; GFX9-NEXT:    store volatile i32 0, ptr [[STOF]], align 4, !noalias.addrspace [[META3:![0-9]+]]246; GFX9-NEXT:    ret void247;248; GFX10-LABEL: define void @with_constant_to_flat_addrspacecast(249; GFX10-SAME: ptr addrspace(4) [[PTR:%.*]]) #[[ATTR0]] {250; GFX10-NEXT:    [[STOF:%.*]] = addrspacecast ptr addrspace(4) [[PTR]] to ptr251; GFX10-NEXT:    store volatile i32 0, ptr [[STOF]], align 4, !noalias.addrspace [[META3:![0-9]+]]252; GFX10-NEXT:    ret void253;254  %stof = addrspacecast ptr addrspace(4) %ptr to ptr255  store volatile i32 0, ptr %stof256  ret void257}258 259define amdgpu_kernel void @with_constant_to_flat_addrspacecast_cc_kernel(ptr addrspace(4) %ptr) {260; GFX9-LABEL: define amdgpu_kernel void @with_constant_to_flat_addrspacecast_cc_kernel(261; GFX9-SAME: ptr addrspace(4) [[PTR:%.*]]) #[[ATTR0]] {262; GFX9-NEXT:    [[STOF:%.*]] = addrspacecast ptr addrspace(4) [[PTR]] to ptr263; GFX9-NEXT:    store volatile i32 0, ptr [[STOF]], align 4, !noalias.addrspace [[META3]]264; GFX9-NEXT:    ret void265;266; GFX10-LABEL: define amdgpu_kernel void @with_constant_to_flat_addrspacecast_cc_kernel(267; GFX10-SAME: ptr addrspace(4) [[PTR:%.*]]) #[[ATTR0]] {268; GFX10-NEXT:    [[STOF:%.*]] = addrspacecast ptr addrspace(4) [[PTR]] to ptr269; GFX10-NEXT:    store volatile i32 0, ptr [[STOF]], align 4, !noalias.addrspace [[META3]]270; GFX10-NEXT:    ret void271;272  %stof = addrspacecast ptr addrspace(4) %ptr to ptr273  store volatile i32 0, ptr %stof274  ret void275}276 277define void @without_private_to_flat_addrspacecast(ptr addrspace(5) %ptr) {278; GFX9-LABEL: define void @without_private_to_flat_addrspacecast(279; GFX9-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR0]] {280; GFX9-NEXT:    store volatile i32 0, ptr addrspace(5) [[PTR]], align 4281; GFX9-NEXT:    ret void282;283; GFX10-LABEL: define void @without_private_to_flat_addrspacecast(284; GFX10-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR0]] {285; GFX10-NEXT:    store volatile i32 0, ptr addrspace(5) [[PTR]], align 4286; GFX10-NEXT:    ret void287;288  store volatile i32 0, ptr addrspace(5) %ptr289  ret void290}291 292define amdgpu_kernel void @without_private_to_flat_addrspacecast_cc_kernel(ptr addrspace(5) %ptr) {293; GFX9-LABEL: define amdgpu_kernel void @without_private_to_flat_addrspacecast_cc_kernel(294; GFX9-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR0]] {295; GFX9-NEXT:    store volatile i32 0, ptr addrspace(5) [[PTR]], align 4296; GFX9-NEXT:    ret void297;298; GFX10-LABEL: define amdgpu_kernel void @without_private_to_flat_addrspacecast_cc_kernel(299; GFX10-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR0]] {300; GFX10-NEXT:    store volatile i32 0, ptr addrspace(5) [[PTR]], align 4301; GFX10-NEXT:    ret void302;303  store volatile i32 0, ptr addrspace(5) %ptr304  ret void305}306 307define void @with_private_to_flat_addrspacecast(ptr addrspace(5) %ptr) {308; GFX9-LABEL: define void @with_private_to_flat_addrspacecast(309; GFX9-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR1:[0-9]+]] {310; GFX9-NEXT:    [[STOF:%.*]] = addrspacecast ptr addrspace(5) [[PTR]] to ptr311; GFX9-NEXT:    store volatile i32 0, ptr [[STOF]], align 4, !noalias.addrspace [[META4:![0-9]+]]312; GFX9-NEXT:    ret void313;314; GFX10-LABEL: define void @with_private_to_flat_addrspacecast(315; GFX10-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR1:[0-9]+]] {316; GFX10-NEXT:    [[STOF:%.*]] = addrspacecast ptr addrspace(5) [[PTR]] to ptr317; GFX10-NEXT:    store volatile i32 0, ptr [[STOF]], align 4, !noalias.addrspace [[META4:![0-9]+]]318; GFX10-NEXT:    ret void319;320  %stof = addrspacecast ptr addrspace(5) %ptr to ptr321  store volatile i32 0, ptr %stof322  ret void323}324 325define amdgpu_kernel void @with_private_to_flat_addrspacecast_cc_kernel(ptr addrspace(5) %ptr) {326; GFX9-LABEL: define amdgpu_kernel void @with_private_to_flat_addrspacecast_cc_kernel(327; GFX9-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR1]] {328; GFX9-NEXT:    [[STOF:%.*]] = addrspacecast ptr addrspace(5) [[PTR]] to ptr329; GFX9-NEXT:    store volatile i32 0, ptr [[STOF]], align 4, !noalias.addrspace [[META4]]330; GFX9-NEXT:    ret void331;332; GFX10-LABEL: define amdgpu_kernel void @with_private_to_flat_addrspacecast_cc_kernel(333; GFX10-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR1]] {334; GFX10-NEXT:    [[STOF:%.*]] = addrspacecast ptr addrspace(5) [[PTR]] to ptr335; GFX10-NEXT:    store volatile i32 0, ptr [[STOF]], align 4, !noalias.addrspace [[META4]]336; GFX10-NEXT:    ret void337;338  %stof = addrspacecast ptr addrspace(5) %ptr to ptr339  store volatile i32 0, ptr %stof340  ret void341}342 343define void @call_without_private_to_flat_addrspacecast(ptr addrspace(5) %ptr) {344; GFX9-LABEL: define void @call_without_private_to_flat_addrspacecast(345; GFX9-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR0]] {346; GFX9-NEXT:    call void @without_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])347; GFX9-NEXT:    ret void348;349; GFX10-LABEL: define void @call_without_private_to_flat_addrspacecast(350; GFX10-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR0]] {351; GFX10-NEXT:    call void @without_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])352; GFX10-NEXT:    ret void353;354  call void @without_private_to_flat_addrspacecast(ptr addrspace(5) %ptr)355  ret void356}357 358define amdgpu_kernel void @call_without_private_to_flat_addrspacecast_cc_kernel(ptr addrspace(5) %ptr) {359; GFX9-LABEL: define amdgpu_kernel void @call_without_private_to_flat_addrspacecast_cc_kernel(360; GFX9-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR0]] {361; GFX9-NEXT:    call void @without_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])362; GFX9-NEXT:    ret void363;364; GFX10-LABEL: define amdgpu_kernel void @call_without_private_to_flat_addrspacecast_cc_kernel(365; GFX10-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR0]] {366; GFX10-NEXT:    call void @without_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])367; GFX10-NEXT:    ret void368;369  call void @without_private_to_flat_addrspacecast(ptr addrspace(5) %ptr)370  ret void371}372 373define void @call_with_private_to_flat_addrspacecast(ptr addrspace(5) %ptr) {374; GFX9-LABEL: define void @call_with_private_to_flat_addrspacecast(375; GFX9-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR1]] {376; GFX9-NEXT:    call void @with_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])377; GFX9-NEXT:    ret void378;379; GFX10-LABEL: define void @call_with_private_to_flat_addrspacecast(380; GFX10-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR1]] {381; GFX10-NEXT:    call void @with_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])382; GFX10-NEXT:    ret void383;384  call void @with_private_to_flat_addrspacecast(ptr addrspace(5) %ptr)385  ret void386}387 388define amdgpu_kernel void @call_with_private_to_flat_addrspacecast_cc_kernel(ptr addrspace(5) %ptr) {389; GFX9-LABEL: define amdgpu_kernel void @call_with_private_to_flat_addrspacecast_cc_kernel(390; GFX9-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR1]] {391; GFX9-NEXT:    call void @with_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])392; GFX9-NEXT:    ret void393;394; GFX10-LABEL: define amdgpu_kernel void @call_with_private_to_flat_addrspacecast_cc_kernel(395; GFX10-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR1]] {396; GFX10-NEXT:    call void @with_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])397; GFX10-NEXT:    ret void398;399  call void @with_private_to_flat_addrspacecast(ptr addrspace(5) %ptr)400  ret void401}402 403define void @call_both_with_and_without_private_to_flat_addrspacecast(ptr addrspace(5) %ptr) {404; GFX9-LABEL: define void @call_both_with_and_without_private_to_flat_addrspacecast(405; GFX9-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR1]] {406; GFX9-NEXT:    call void @without_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])407; GFX9-NEXT:    call void @with_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])408; GFX9-NEXT:    ret void409;410; GFX10-LABEL: define void @call_both_with_and_without_private_to_flat_addrspacecast(411; GFX10-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR1]] {412; GFX10-NEXT:    call void @without_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])413; GFX10-NEXT:    call void @with_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])414; GFX10-NEXT:    ret void415;416  call void @without_private_to_flat_addrspacecast(ptr addrspace(5) %ptr)417  call void @with_private_to_flat_addrspacecast(ptr addrspace(5) %ptr)418  ret void419}420 421define amdgpu_kernel void @call_both_with_and_without_private_to_flat_addrspacecast_cc_kernel(ptr addrspace(5) %ptr) {422; GFX9-LABEL: define amdgpu_kernel void @call_both_with_and_without_private_to_flat_addrspacecast_cc_kernel(423; GFX9-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR1]] {424; GFX9-NEXT:    call void @without_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])425; GFX9-NEXT:    call void @with_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])426; GFX9-NEXT:    ret void427;428; GFX10-LABEL: define amdgpu_kernel void @call_both_with_and_without_private_to_flat_addrspacecast_cc_kernel(429; GFX10-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR1]] {430; GFX10-NEXT:    call void @without_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])431; GFX10-NEXT:    call void @with_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])432; GFX10-NEXT:    ret void433;434  call void @without_private_to_flat_addrspacecast(ptr addrspace(5) %ptr)435  call void @with_private_to_flat_addrspacecast(ptr addrspace(5) %ptr)436  ret void437}438 439define void @call_call_without_private_to_flat_addrspacecast(ptr addrspace(5) %ptr) {440; GFX9-LABEL: define void @call_call_without_private_to_flat_addrspacecast(441; GFX9-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR0]] {442; GFX9-NEXT:    call void @call_without_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])443; GFX9-NEXT:    ret void444;445; GFX10-LABEL: define void @call_call_without_private_to_flat_addrspacecast(446; GFX10-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR0]] {447; GFX10-NEXT:    call void @call_without_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])448; GFX10-NEXT:    ret void449;450  call void @call_without_private_to_flat_addrspacecast(ptr addrspace(5) %ptr)451  ret void452}453 454define amdgpu_kernel void @call_call_without_private_to_flat_addrspacecast_cc_kernel(ptr addrspace(5) %ptr) {455; GFX9-LABEL: define amdgpu_kernel void @call_call_without_private_to_flat_addrspacecast_cc_kernel(456; GFX9-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR0]] {457; GFX9-NEXT:    call void @call_without_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])458; GFX9-NEXT:    ret void459;460; GFX10-LABEL: define amdgpu_kernel void @call_call_without_private_to_flat_addrspacecast_cc_kernel(461; GFX10-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR0]] {462; GFX10-NEXT:    call void @call_without_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])463; GFX10-NEXT:    ret void464;465  call void @call_without_private_to_flat_addrspacecast(ptr addrspace(5) %ptr)466  ret void467}468 469define void @call_call_with_private_to_flat_addrspacecast(ptr addrspace(5) %ptr) {470; GFX9-LABEL: define void @call_call_with_private_to_flat_addrspacecast(471; GFX9-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR1]] {472; GFX9-NEXT:    call void @call_with_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])473; GFX9-NEXT:    ret void474;475; GFX10-LABEL: define void @call_call_with_private_to_flat_addrspacecast(476; GFX10-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR1]] {477; GFX10-NEXT:    call void @call_with_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])478; GFX10-NEXT:    ret void479;480  call void @call_with_private_to_flat_addrspacecast(ptr addrspace(5) %ptr)481  ret void482}483 484define amdgpu_kernel void @call_call_with_private_to_flat_addrspacecast_cc_kernel(ptr addrspace(5) %ptr) {485; GFX9-LABEL: define amdgpu_kernel void @call_call_with_private_to_flat_addrspacecast_cc_kernel(486; GFX9-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR1]] {487; GFX9-NEXT:    call void @call_with_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])488; GFX9-NEXT:    ret void489;490; GFX10-LABEL: define amdgpu_kernel void @call_call_with_private_to_flat_addrspacecast_cc_kernel(491; GFX10-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR1]] {492; GFX10-NEXT:    call void @call_with_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])493; GFX10-NEXT:    ret void494;495  call void @call_with_private_to_flat_addrspacecast(ptr addrspace(5) %ptr)496  ret void497}498 499define void @call_call_both_with_and_without_private_to_flat_addrspacecast(ptr addrspace(5) %ptr) {500; GFX9-LABEL: define void @call_call_both_with_and_without_private_to_flat_addrspacecast(501; GFX9-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR1]] {502; GFX9-NEXT:    call void @call_both_with_and_without_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])503; GFX9-NEXT:    ret void504;505; GFX10-LABEL: define void @call_call_both_with_and_without_private_to_flat_addrspacecast(506; GFX10-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR1]] {507; GFX10-NEXT:    call void @call_both_with_and_without_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])508; GFX10-NEXT:    ret void509;510  call void @call_both_with_and_without_private_to_flat_addrspacecast(ptr addrspace(5) %ptr)511  ret void512}513 514define amdgpu_kernel void @call_call_both_with_and_without_private_to_flat_addrspacecast_cc_kernel(ptr addrspace(5) %ptr) {515; GFX9-LABEL: define amdgpu_kernel void @call_call_both_with_and_without_private_to_flat_addrspacecast_cc_kernel(516; GFX9-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR1]] {517; GFX9-NEXT:    call void @call_both_with_and_without_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])518; GFX9-NEXT:    ret void519;520; GFX10-LABEL: define amdgpu_kernel void @call_call_both_with_and_without_private_to_flat_addrspacecast_cc_kernel(521; GFX10-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR1]] {522; GFX10-NEXT:    call void @call_both_with_and_without_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])523; GFX10-NEXT:    ret void524;525  call void @call_both_with_and_without_private_to_flat_addrspacecast(ptr addrspace(5) %ptr)526  ret void527}528 529define void @with_cast_call_without_private_to_flat_addrspacecast(ptr addrspace(5) %ptr) {530; GFX9-LABEL: define void @with_cast_call_without_private_to_flat_addrspacecast(531; GFX9-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR1]] {532; GFX9-NEXT:    [[STOF:%.*]] = addrspacecast ptr addrspace(5) [[PTR]] to ptr533; GFX9-NEXT:    store volatile i32 0, ptr [[STOF]], align 4, !noalias.addrspace [[META4]]534; GFX9-NEXT:    call void @without_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])535; GFX9-NEXT:    ret void536;537; GFX10-LABEL: define void @with_cast_call_without_private_to_flat_addrspacecast(538; GFX10-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR1]] {539; GFX10-NEXT:    [[STOF:%.*]] = addrspacecast ptr addrspace(5) [[PTR]] to ptr540; GFX10-NEXT:    store volatile i32 0, ptr [[STOF]], align 4, !noalias.addrspace [[META4]]541; GFX10-NEXT:    call void @without_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])542; GFX10-NEXT:    ret void543;544  %stof = addrspacecast ptr addrspace(5) %ptr to ptr545  store volatile i32 0, ptr %stof546  call void @without_private_to_flat_addrspacecast(ptr addrspace(5) %ptr)547  ret void548}549 550define amdgpu_kernel void @with_cast_call_without_private_to_flat_addrspacecast_cc_kernel(ptr addrspace(5) %ptr) {551; GFX9-LABEL: define amdgpu_kernel void @with_cast_call_without_private_to_flat_addrspacecast_cc_kernel(552; GFX9-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR1]] {553; GFX9-NEXT:    [[STOF:%.*]] = addrspacecast ptr addrspace(5) [[PTR]] to ptr554; GFX9-NEXT:    store volatile i32 0, ptr [[STOF]], align 4, !noalias.addrspace [[META4]]555; GFX9-NEXT:    call void @without_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])556; GFX9-NEXT:    ret void557;558; GFX10-LABEL: define amdgpu_kernel void @with_cast_call_without_private_to_flat_addrspacecast_cc_kernel(559; GFX10-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR1]] {560; GFX10-NEXT:    [[STOF:%.*]] = addrspacecast ptr addrspace(5) [[PTR]] to ptr561; GFX10-NEXT:    store volatile i32 0, ptr [[STOF]], align 4, !noalias.addrspace [[META4]]562; GFX10-NEXT:    call void @without_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])563; GFX10-NEXT:    ret void564;565  %stof = addrspacecast ptr addrspace(5) %ptr to ptr566  store volatile i32 0, ptr %stof567  call void @without_private_to_flat_addrspacecast(ptr addrspace(5) %ptr)568  ret void569}570 571define void @with_cast_call_with_private_to_flat_addrspacecast(ptr addrspace(5) %ptr) {572; GFX9-LABEL: define void @with_cast_call_with_private_to_flat_addrspacecast(573; GFX9-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR1]] {574; GFX9-NEXT:    [[STOF:%.*]] = addrspacecast ptr addrspace(5) [[PTR]] to ptr575; GFX9-NEXT:    store volatile i32 0, ptr [[STOF]], align 4, !noalias.addrspace [[META4]]576; GFX9-NEXT:    call void @with_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])577; GFX9-NEXT:    ret void578;579; GFX10-LABEL: define void @with_cast_call_with_private_to_flat_addrspacecast(580; GFX10-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR1]] {581; GFX10-NEXT:    [[STOF:%.*]] = addrspacecast ptr addrspace(5) [[PTR]] to ptr582; GFX10-NEXT:    store volatile i32 0, ptr [[STOF]], align 4, !noalias.addrspace [[META4]]583; GFX10-NEXT:    call void @with_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])584; GFX10-NEXT:    ret void585;586  %stof = addrspacecast ptr addrspace(5) %ptr to ptr587  store volatile i32 0, ptr %stof588  call void @with_private_to_flat_addrspacecast(ptr addrspace(5) %ptr)589  ret void590}591 592define amdgpu_kernel void @with_cast_call_with_private_to_flat_addrspacecast_cc_kernel(ptr addrspace(5) %ptr) {593; GFX9-LABEL: define amdgpu_kernel void @with_cast_call_with_private_to_flat_addrspacecast_cc_kernel(594; GFX9-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR1]] {595; GFX9-NEXT:    [[STOF:%.*]] = addrspacecast ptr addrspace(5) [[PTR]] to ptr596; GFX9-NEXT:    store volatile i32 0, ptr [[STOF]], align 4, !noalias.addrspace [[META4]]597; GFX9-NEXT:    call void @with_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])598; GFX9-NEXT:    ret void599;600; GFX10-LABEL: define amdgpu_kernel void @with_cast_call_with_private_to_flat_addrspacecast_cc_kernel(601; GFX10-SAME: ptr addrspace(5) [[PTR:%.*]]) #[[ATTR1]] {602; GFX10-NEXT:    [[STOF:%.*]] = addrspacecast ptr addrspace(5) [[PTR]] to ptr603; GFX10-NEXT:    store volatile i32 0, ptr [[STOF]], align 4, !noalias.addrspace [[META4]]604; GFX10-NEXT:    call void @with_private_to_flat_addrspacecast(ptr addrspace(5) [[PTR]])605; GFX10-NEXT:    ret void606;607  %stof = addrspacecast ptr addrspace(5) %ptr to ptr608  store volatile i32 0, ptr %stof609  call void @with_private_to_flat_addrspacecast(ptr addrspace(5) %ptr)610  ret void611}612 613;; tests of addrspacecast in a constant614 615define amdgpu_kernel void @private_constant_expression_use(ptr addrspace(1) nocapture %out) {616; GFX9-LABEL: define amdgpu_kernel void @private_constant_expression_use(617; GFX9-SAME: ptr addrspace(1) captures(none) [[OUT:%.*]]) #[[ATTR1]] {618; GFX9-NEXT:    store volatile ptr addrspacecast (ptr addrspace(5) inttoptr (i32 123 to ptr addrspace(5)) to ptr), ptr addrspace(1) [[OUT]], align 8619; GFX9-NEXT:    ret void620;621; GFX10-LABEL: define amdgpu_kernel void @private_constant_expression_use(622; GFX10-SAME: ptr addrspace(1) captures(none) [[OUT:%.*]]) #[[ATTR1]] {623; GFX10-NEXT:    store volatile ptr addrspacecast (ptr addrspace(5) inttoptr (i32 123 to ptr addrspace(5)) to ptr), ptr addrspace(1) [[OUT]], align 8624; GFX10-NEXT:    ret void625;626  store volatile ptr addrspacecast (ptr addrspace(5) inttoptr (i32 123 to ptr addrspace(5)) to ptr), ptr addrspace(1) %out, align 8627  ret void628}629 630;; tests of indirect call, intrinsics, inline asm631 632@gv.fptr0 = external hidden unnamed_addr addrspace(4) constant ptr, align 4633 634define void @with_indirect_call() {635; GFX9-LABEL: define void @with_indirect_call(636; GFX9-SAME: ) #[[ATTR2:[0-9]+]] {637; GFX9-NEXT:    [[FPTR:%.*]] = load ptr, ptr addrspace(4) @gv.fptr0, align 8638; GFX9-NEXT:    call void [[FPTR]]()639; GFX9-NEXT:    ret void640;641; GFX10-LABEL: define void @with_indirect_call(642; GFX10-SAME: ) #[[ATTR2:[0-9]+]] {643; GFX10-NEXT:    [[FPTR:%.*]] = load ptr, ptr addrspace(4) @gv.fptr0, align 8644; GFX10-NEXT:    call void [[FPTR]]()645; GFX10-NEXT:    ret void646;647  %fptr = load ptr, ptr addrspace(4) @gv.fptr0648  call void %fptr()649  ret void650}651 652define amdgpu_kernel void @with_indirect_call_cc_kernel() {653; GFX9-LABEL: define amdgpu_kernel void @with_indirect_call_cc_kernel(654; GFX9-SAME: ) #[[ATTR2]] {655; GFX9-NEXT:    [[FPTR:%.*]] = load ptr, ptr addrspace(4) @gv.fptr0, align 8656; GFX9-NEXT:    call void [[FPTR]]()657; GFX9-NEXT:    ret void658;659; GFX10-LABEL: define amdgpu_kernel void @with_indirect_call_cc_kernel(660; GFX10-SAME: ) #[[ATTR2]] {661; GFX10-NEXT:    [[FPTR:%.*]] = load ptr, ptr addrspace(4) @gv.fptr0, align 8662; GFX10-NEXT:    call void [[FPTR]]()663; GFX10-NEXT:    ret void664;665  %fptr = load ptr, ptr addrspace(4) @gv.fptr0666  call void %fptr()667  ret void668}669 670define void @call_with_indirect_call() {671; GFX9-LABEL: define void @call_with_indirect_call(672; GFX9-SAME: ) #[[ATTR2]] {673; GFX9-NEXT:    call void @with_indirect_call()674; GFX9-NEXT:    ret void675;676; GFX10-LABEL: define void @call_with_indirect_call(677; GFX10-SAME: ) #[[ATTR2]] {678; GFX10-NEXT:    call void @with_indirect_call()679; GFX10-NEXT:    ret void680;681  call void @with_indirect_call()682  ret void683}684 685define amdgpu_kernel void @call_with_indirect_call_cc_kernel() {686; GFX9-LABEL: define amdgpu_kernel void @call_with_indirect_call_cc_kernel(687; GFX9-SAME: ) #[[ATTR2]] {688; GFX9-NEXT:    call void @with_indirect_call()689; GFX9-NEXT:    ret void690;691; GFX10-LABEL: define amdgpu_kernel void @call_with_indirect_call_cc_kernel(692; GFX10-SAME: ) #[[ATTR2]] {693; GFX10-NEXT:    call void @with_indirect_call()694; GFX10-NEXT:    ret void695;696  call void @with_indirect_call()697  ret void698}699 700define void @empty() {701; GFX9-LABEL: define void @empty(702; GFX9-SAME: ) #[[ATTR0]] {703; GFX9-NEXT:    ret void704;705; GFX10-LABEL: define void @empty(706; GFX10-SAME: ) #[[ATTR0]] {707; GFX10-NEXT:    ret void708;709  ret void710}711 712define void @also_empty() {713; GFX9-LABEL: define void @also_empty(714; GFX9-SAME: ) #[[ATTR0]] {715; GFX9-NEXT:    ret void716;717; GFX10-LABEL: define void @also_empty(718; GFX10-SAME: ) #[[ATTR0]] {719; GFX10-NEXT:    ret void720;721  ret void722}723 724define amdgpu_kernel void @indirect_call_known_callees(i1 %cond) {725; GFX9-LABEL: define amdgpu_kernel void @indirect_call_known_callees(726; GFX9-SAME: i1 [[COND:%.*]]) #[[ATTR0]] {727; GFX9-NEXT:    [[FPTR:%.*]] = select i1 [[COND]], ptr @empty, ptr @also_empty728; GFX9-NEXT:    [[TMP1:%.*]] = icmp eq ptr [[FPTR]], @also_empty729; GFX9-NEXT:    br i1 [[TMP1]], label %[[BB2:.*]], label %[[BB3:.*]]730; GFX9:       [[BB2]]:731; GFX9-NEXT:    call void @also_empty()732; GFX9-NEXT:    br label %[[BB6:.*]]733; GFX9:       [[BB3]]:734; GFX9-NEXT:    br i1 true, label %[[BB4:.*]], label %[[BB5:.*]]735; GFX9:       [[BB4]]:736; GFX9-NEXT:    call void @empty()737; GFX9-NEXT:    br label %[[BB6]]738; GFX9:       [[BB5]]:739; GFX9-NEXT:    unreachable740; GFX9:       [[BB6]]:741; GFX9-NEXT:    ret void742;743; GFX10-LABEL: define amdgpu_kernel void @indirect_call_known_callees(744; GFX10-SAME: i1 [[COND:%.*]]) #[[ATTR0]] {745; GFX10-NEXT:    [[FPTR:%.*]] = select i1 [[COND]], ptr @empty, ptr @also_empty746; GFX10-NEXT:    [[TMP1:%.*]] = icmp eq ptr [[FPTR]], @also_empty747; GFX10-NEXT:    br i1 [[TMP1]], label %[[BB2:.*]], label %[[BB3:.*]]748; GFX10:       [[BB2]]:749; GFX10-NEXT:    call void @also_empty()750; GFX10-NEXT:    br label %[[BB6:.*]]751; GFX10:       [[BB3]]:752; GFX10-NEXT:    br i1 true, label %[[BB4:.*]], label %[[BB5:.*]]753; GFX10:       [[BB4]]:754; GFX10-NEXT:    call void @empty()755; GFX10-NEXT:    br label %[[BB6]]756; GFX10:       [[BB5]]:757; GFX10-NEXT:    unreachable758; GFX10:       [[BB6]]:759; GFX10-NEXT:    ret void760;761  %fptr = select i1 %cond, ptr @empty, ptr @also_empty762  call void %fptr()763  ret void764}765 766declare i32 @llvm.amdgcn.workgroup.id.x()767 768define void @use_intrinsic_workitem_id_x() {769; GFX9-LABEL: define void @use_intrinsic_workitem_id_x(770; GFX9-SAME: ) #[[ATTR4:[0-9]+]] {771; GFX9-NEXT:    [[VAL:%.*]] = call i32 @llvm.amdgcn.workitem.id.x()772; GFX9-NEXT:    store volatile i32 [[VAL]], ptr addrspace(1) null, align 4773; GFX9-NEXT:    ret void774;775; GFX10-LABEL: define void @use_intrinsic_workitem_id_x(776; GFX10-SAME: ) #[[ATTR4:[0-9]+]] {777; GFX10-NEXT:    [[VAL:%.*]] = call i32 @llvm.amdgcn.workitem.id.x()778; GFX10-NEXT:    store volatile i32 [[VAL]], ptr addrspace(1) null, align 4779; GFX10-NEXT:    ret void780;781  %val = call i32 @llvm.amdgcn.workitem.id.x()782  store volatile i32 %val, ptr addrspace(1) null783  ret void784}785 786define amdgpu_kernel void @use_intrinsic_workitem_id_x_cc_kernel() {787; GFX9-LABEL: define amdgpu_kernel void @use_intrinsic_workitem_id_x_cc_kernel(788; GFX9-SAME: ) #[[ATTR0]] {789; GFX9-NEXT:    [[VAL:%.*]] = call i32 @llvm.amdgcn.workitem.id.x()790; GFX9-NEXT:    store volatile i32 [[VAL]], ptr addrspace(1) null, align 4791; GFX9-NEXT:    ret void792;793; GFX10-LABEL: define amdgpu_kernel void @use_intrinsic_workitem_id_x_cc_kernel(794; GFX10-SAME: ) #[[ATTR0]] {795; GFX10-NEXT:    [[VAL:%.*]] = call i32 @llvm.amdgcn.workitem.id.x()796; GFX10-NEXT:    store volatile i32 [[VAL]], ptr addrspace(1) null, align 4797; GFX10-NEXT:    ret void798;799  %val = call i32 @llvm.amdgcn.workitem.id.x()800  store volatile i32 %val, ptr addrspace(1) null801  ret void802}803 804define void @call_use_intrinsic_workitem_id_x() {805; GFX9-LABEL: define void @call_use_intrinsic_workitem_id_x(806; GFX9-SAME: ) #[[ATTR4]] {807; GFX9-NEXT:    call void @use_intrinsic_workitem_id_x()808; GFX9-NEXT:    ret void809;810; GFX10-LABEL: define void @call_use_intrinsic_workitem_id_x(811; GFX10-SAME: ) #[[ATTR4]] {812; GFX10-NEXT:    call void @use_intrinsic_workitem_id_x()813; GFX10-NEXT:    ret void814;815  call void @use_intrinsic_workitem_id_x()816  ret void817}818 819define amdgpu_kernel void @call_use_intrinsic_workitem_id_x_cc_kernel() {820; GFX9-LABEL: define amdgpu_kernel void @call_use_intrinsic_workitem_id_x_cc_kernel(821; GFX9-SAME: ) #[[ATTR4]] {822; GFX9-NEXT:    call void @use_intrinsic_workitem_id_x()823; GFX9-NEXT:    ret void824;825; GFX10-LABEL: define amdgpu_kernel void @call_use_intrinsic_workitem_id_x_cc_kernel(826; GFX10-SAME: ) #[[ATTR4]] {827; GFX10-NEXT:    call void @use_intrinsic_workitem_id_x()828; GFX10-NEXT:    ret void829;830  call void @use_intrinsic_workitem_id_x()831  ret void832}833 834define amdgpu_kernel void @calls_intrin_ascast_cc_kernel(ptr addrspace(3) %ptr) {835; GFX9-LABEL: define amdgpu_kernel void @calls_intrin_ascast_cc_kernel(836; GFX9-SAME: ptr addrspace(3) [[PTR:%.*]]) #[[ATTR1]] {837; GFX9-NEXT:    [[TMP1:%.*]] = call ptr @llvm.amdgcn.addrspacecast.nonnull.p0.p3(ptr addrspace(3) [[PTR]])838; GFX9-NEXT:    store volatile i32 7, ptr [[TMP1]], align 4839; GFX9-NEXT:    ret void840;841; GFX10-LABEL: define amdgpu_kernel void @calls_intrin_ascast_cc_kernel(842; GFX10-SAME: ptr addrspace(3) [[PTR:%.*]]) #[[ATTR1]] {843; GFX10-NEXT:    [[TMP1:%.*]] = call ptr @llvm.amdgcn.addrspacecast.nonnull.p0.p3(ptr addrspace(3) [[PTR]])844; GFX10-NEXT:    store volatile i32 7, ptr [[TMP1]], align 4845; GFX10-NEXT:    ret void846;847  %1 = call ptr @llvm.amdgcn.addrspacecast.nonnull.p0.p3(ptr addrspace(3) %ptr)848  store volatile i32 7, ptr %1, align 4849  ret void850}851 852define amdgpu_kernel void @with_inline_asm() {853; GFX9-LABEL: define amdgpu_kernel void @with_inline_asm(854; GFX9-SAME: ) #[[ATTR0]] {855; GFX9-NEXT:    call void asm sideeffect "856; GFX9-NEXT:    ret void857;858; GFX10-LABEL: define amdgpu_kernel void @with_inline_asm(859; GFX10-SAME: ) #[[ATTR0]] {860; GFX10-NEXT:    call void asm sideeffect "861; GFX10-NEXT:    ret void862;863  call void asm sideeffect "; use $0", "a"(i32 poison)864  ret void865}866 867;.868; GFX9: attributes #[[ATTR0]] = { "amdgpu-no-cluster-id-x" "amdgpu-no-cluster-id-y" "amdgpu-no-cluster-id-z" "amdgpu-no-completion-action" "amdgpu-no-default-queue" "amdgpu-no-dispatch-id" "amdgpu-no-dispatch-ptr" "amdgpu-no-flat-scratch-init" "amdgpu-no-heap-ptr" "amdgpu-no-hostcall-ptr" "amdgpu-no-implicitarg-ptr" "amdgpu-no-lds-kernel-id" "amdgpu-no-multigrid-sync-arg" "amdgpu-no-queue-ptr" "amdgpu-no-workgroup-id-x" "amdgpu-no-workgroup-id-y" "amdgpu-no-workgroup-id-z" "amdgpu-no-workitem-id-x" "amdgpu-no-workitem-id-y" "amdgpu-no-workitem-id-z" "target-cpu"="gfx900" "uniform-work-group-size"="false" }869; GFX9: attributes #[[ATTR1]] = { "amdgpu-no-cluster-id-x" "amdgpu-no-cluster-id-y" "amdgpu-no-cluster-id-z" "amdgpu-no-completion-action" "amdgpu-no-default-queue" "amdgpu-no-dispatch-id" "amdgpu-no-dispatch-ptr" "amdgpu-no-heap-ptr" "amdgpu-no-hostcall-ptr" "amdgpu-no-implicitarg-ptr" "amdgpu-no-lds-kernel-id" "amdgpu-no-multigrid-sync-arg" "amdgpu-no-queue-ptr" "amdgpu-no-workgroup-id-x" "amdgpu-no-workgroup-id-y" "amdgpu-no-workgroup-id-z" "amdgpu-no-workitem-id-x" "amdgpu-no-workitem-id-y" "amdgpu-no-workitem-id-z" "target-cpu"="gfx900" "uniform-work-group-size"="false" }870; GFX9: attributes #[[ATTR2]] = { "target-cpu"="gfx900" "uniform-work-group-size"="false" }871; GFX9: attributes #[[ATTR3:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) "target-cpu"="gfx900" }872; GFX9: attributes #[[ATTR4]] = { "amdgpu-no-cluster-id-x" "amdgpu-no-cluster-id-y" "amdgpu-no-cluster-id-z" "amdgpu-no-completion-action" "amdgpu-no-default-queue" "amdgpu-no-dispatch-id" "amdgpu-no-dispatch-ptr" "amdgpu-no-flat-scratch-init" "amdgpu-no-heap-ptr" "amdgpu-no-hostcall-ptr" "amdgpu-no-implicitarg-ptr" "amdgpu-no-lds-kernel-id" "amdgpu-no-multigrid-sync-arg" "amdgpu-no-queue-ptr" "amdgpu-no-workgroup-id-x" "amdgpu-no-workgroup-id-y" "amdgpu-no-workgroup-id-z" "amdgpu-no-workitem-id-y" "amdgpu-no-workitem-id-z" "target-cpu"="gfx900" "uniform-work-group-size"="false" }873;.874; GFX10: attributes #[[ATTR0]] = { "amdgpu-no-cluster-id-x" "amdgpu-no-cluster-id-y" "amdgpu-no-cluster-id-z" "amdgpu-no-completion-action" "amdgpu-no-default-queue" "amdgpu-no-dispatch-id" "amdgpu-no-dispatch-ptr" "amdgpu-no-flat-scratch-init" "amdgpu-no-heap-ptr" "amdgpu-no-hostcall-ptr" "amdgpu-no-implicitarg-ptr" "amdgpu-no-lds-kernel-id" "amdgpu-no-multigrid-sync-arg" "amdgpu-no-queue-ptr" "amdgpu-no-workgroup-id-x" "amdgpu-no-workgroup-id-y" "amdgpu-no-workgroup-id-z" "amdgpu-no-workitem-id-x" "amdgpu-no-workitem-id-y" "amdgpu-no-workitem-id-z" "target-cpu"="gfx1010" "uniform-work-group-size"="false" }875; GFX10: attributes #[[ATTR1]] = { "amdgpu-no-cluster-id-x" "amdgpu-no-cluster-id-y" "amdgpu-no-cluster-id-z" "amdgpu-no-completion-action" "amdgpu-no-default-queue" "amdgpu-no-dispatch-id" "amdgpu-no-dispatch-ptr" "amdgpu-no-heap-ptr" "amdgpu-no-hostcall-ptr" "amdgpu-no-implicitarg-ptr" "amdgpu-no-lds-kernel-id" "amdgpu-no-multigrid-sync-arg" "amdgpu-no-queue-ptr" "amdgpu-no-workgroup-id-x" "amdgpu-no-workgroup-id-y" "amdgpu-no-workgroup-id-z" "amdgpu-no-workitem-id-x" "amdgpu-no-workitem-id-y" "amdgpu-no-workitem-id-z" "target-cpu"="gfx1010" "uniform-work-group-size"="false" }876; GFX10: attributes #[[ATTR2]] = { "target-cpu"="gfx1010" "uniform-work-group-size"="false" }877; GFX10: attributes #[[ATTR3:[0-9]+]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) "target-cpu"="gfx1010" }878; GFX10: attributes #[[ATTR4]] = { "amdgpu-no-cluster-id-x" "amdgpu-no-cluster-id-y" "amdgpu-no-cluster-id-z" "amdgpu-no-completion-action" "amdgpu-no-default-queue" "amdgpu-no-dispatch-id" "amdgpu-no-dispatch-ptr" "amdgpu-no-flat-scratch-init" "amdgpu-no-heap-ptr" "amdgpu-no-hostcall-ptr" "amdgpu-no-implicitarg-ptr" "amdgpu-no-lds-kernel-id" "amdgpu-no-multigrid-sync-arg" "amdgpu-no-queue-ptr" "amdgpu-no-workgroup-id-x" "amdgpu-no-workgroup-id-y" "amdgpu-no-workgroup-id-z" "amdgpu-no-workitem-id-y" "amdgpu-no-workitem-id-z" "target-cpu"="gfx1010" "uniform-work-group-size"="false" }879;.880; GFX9: [[META0]] = !{i32 2, i32 10}881; GFX9: [[META1]] = !{i32 1, i32 2, i32 3, i32 10}882; GFX9: [[META2]] = !{i32 1, i32 3, i32 4, i32 10}883; GFX9: [[META3]] = !{i32 1, i32 4, i32 5, i32 10}884; GFX9: [[META4]] = !{i32 1, i32 5, i32 6, i32 10}885;.886; GFX10: [[META0]] = !{i32 2, i32 10}887; GFX10: [[META1]] = !{i32 1, i32 2, i32 3, i32 10}888; GFX10: [[META2]] = !{i32 1, i32 3, i32 4, i32 10}889; GFX10: [[META3]] = !{i32 1, i32 4, i32 5, i32 10}890; GFX10: [[META4]] = !{i32 1, i32 5, i32 6, i32 10}891;.892