1; RUN: llc -march=amdgcn -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GFX10 %s 2; RUN: llc -march=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GFX9 %s 3 4; GCN-LABEL: {{^}}test_add_lit: 5; GFX10: v_add_co_u32_e64 v{{[0-9]+}}, vcc_lo, 0x80992bff, v{{[0-9]+}} 6; GFX10: v_add_co_ci_u32_e32 v{{[0-9]+}}, vcc_lo, 0xe7, v{{[0-9]+}}, vcc_lo 7; GFX9: v_mov_b32_e32 [[C2:v[0-9]+]], 0xe7 8; GFX9: v_add_co_u32_e32 v{{[0-9]+}}, vcc, 0x80992bff, v{{[0-9]+}} 9; GFX9: v_addc_co_u32_e32 v{{[0-9]+}}, vcc, v{{[0-9]+}}, [[C2]], vcc 10define amdgpu_kernel void @test_add_lit(i64 addrspace(1)* %p) { 11 %id = tail call i32 @llvm.amdgcn.workitem.id.x() 12 %ptr = getelementptr inbounds i64, i64 addrspace(1)* %p, i32 %id 13 %load = load i64, i64 addrspace(1)* %ptr, align 8 14 %add = add nsw i64 %load, 994294967295 15 store i64 %add, i64 addrspace(1)* %ptr, align 8 16 ret void 17} 18 19; GCN-LABEL: {{^}}test_cndmask_lit: 20; GFX10: v_cndmask_b32_e32 v{{[0-9]+}}, 0x3039, v{{[0-9]+}}, vcc_lo 21; GFX9: v_mov_b32_e32 [[C:v[0-9]+]], 0x3039 22; GFX9: v_cndmask_b32_e32 v{{[0-9]+}}, [[C]], v{{[0-9]+}}, vcc 23define amdgpu_kernel void @test_cndmask_lit(i32 addrspace(1)* %p) { 24 %id = tail call i32 @llvm.amdgcn.workitem.id.x() 25 %n = add nuw nsw i32 %id, 1 26 %p1 = getelementptr inbounds i32, i32 addrspace(1)* %p, i32 %id 27 %v1 = load i32, i32 addrspace(1)* %p1, align 4 28 %p2 = getelementptr inbounds i32, i32 addrspace(1)* %p, i32 %n 29 %v2 = load i32, i32 addrspace(1)* %p2, align 4 30 %cmp = icmp sgt i32 %v1, 0 31 %sel = select i1 %cmp, i32 12345, i32 %v2 32 store i32 %sel, i32 addrspace(1)* %p1, align 4 33 ret void 34} 35 36; GCN-LABEL: {{^}}test_bfe_2lit_s: 37; GFX10: v_mov_b32_e32 [[C1:v[0-9]+]], 0xddd5 38; GFX10: v_bfe_u32 v{{[0-9]+}}, 0x3039, s{{[0-9]+}}, [[C1]] 39; GFX9-DAG: v_mov_b32_e32 [[C2:v[0-9]+]], 0xddd5 40; GFX9-DAG: s_movk_i32 [[C1:s[0-9]+]], 0x3039 41; GFX9: v_bfe_u32 v{{[0-9]+}}, [[C1]], v{{[0-9]+}}, [[C2]] 42define amdgpu_kernel void @test_bfe_2lit_s(i32 addrspace(1)* %p, i32 %src) { 43 %bfe = call i32 @llvm.amdgcn.ubfe.i32(i32 12345, i32 %src, i32 56789) 44 store i32 %bfe, i32 addrspace(1)* %p, align 4 45 ret void 46} 47 48; GCN-LABEL: {{^}}test_bfe_2lit_v: 49; GFX10: s_movk_i32 [[C1:s[0-9]+]], 0x3039 50; GFX10: v_bfe_u32 v{{[0-9]+}}, [[C1]], v{{[0-9]+}}, 0xddd5 51; GFX9-DAG: v_mov_b32_e32 [[C2:v[0-9]+]], 0xddd5 52; GFX9-DAG: s_movk_i32 [[C1:s[0-9]+]], 0x3039 53; GFX9: v_bfe_u32 v{{[0-9]+}}, [[C1]], v{{[0-9]+}}, [[C2]] 54define amdgpu_kernel void @test_bfe_2lit_v(i32 addrspace(1)* %p) { 55 %id = tail call i32 @llvm.amdgcn.workitem.id.x() 56 %ptr = getelementptr inbounds i32, i32 addrspace(1)* %p, i32 %id 57 %load = load i32, i32 addrspace(1)* %ptr, align 4 58 %bfe = call i32 @llvm.amdgcn.ubfe.i32(i32 12345, i32 %load, i32 56789) 59 store i32 %bfe, i32 addrspace(1)* %ptr, align 4 60 ret void 61} 62 63declare i32 @llvm.amdgcn.workitem.id.x() 64declare i32 @llvm.amdgcn.ubfe.i32(i32, i32, i32) 65