1; RUN: llc -march=amdgcn -mcpu=gfx803 -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=GFX8 %s 2; RUN: llc -march=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=GFX9 %s 3; RUN: llc -march=amdgcn -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=GFX10 %s 4 5; FIXME: GFX9 should be producing v_mad_u16 instead of v_mad_legacy_u16. 6 7; GCN-LABEL: {{^}}mad_u16 8; GCN: {{flat|global}}_load_ushort v[[A:[0-9]+]] 9; GCN: {{flat|global}}_load_ushort v[[B:[0-9]+]] 10; GCN: {{flat|global}}_load_ushort v[[C:[0-9]+]] 11; GFX8: v_mad_u16 v[[R:[0-9]+]], v[[A]], v[[B]], v[[C]] 12; GFX9: v_mad_legacy_u16 v[[R:[0-9]+]], v[[A]], v[[B]], v[[C]] 13; GFX10: v_mad_u16 v[[R:[0-9]+]], v[[A]], v[[B]], v[[C]] 14; GCN: {{flat|global}}_store_short v{{.+}}, v[[R]] 15; GCN: s_endpgm 16define amdgpu_kernel void @mad_u16( 17 i16 addrspace(1)* %r, 18 i16 addrspace(1)* %a, 19 i16 addrspace(1)* %b, 20 i16 addrspace(1)* %c) { 21entry: 22 %tid = call i32 @llvm.amdgcn.workitem.id.x() 23 %a.gep = getelementptr inbounds i16, i16 addrspace(1)* %a, i32 %tid 24 %b.gep = getelementptr inbounds i16, i16 addrspace(1)* %b, i32 %tid 25 %c.gep = getelementptr inbounds i16, i16 addrspace(1)* %c, i32 %tid 26 27 %a.val = load volatile i16, i16 addrspace(1)* %a.gep 28 %b.val = load volatile i16, i16 addrspace(1)* %b.gep 29 %c.val = load volatile i16, i16 addrspace(1)* %c.gep 30 31 %m.val = mul i16 %a.val, %b.val 32 %r.val = add i16 %m.val, %c.val 33 34 store i16 %r.val, i16 addrspace(1)* %r 35 ret void 36} 37 38declare i32 @llvm.amdgcn.workitem.id.x() 39