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
5 ; FIXME: GFX9 should be producing v_mad_u16 instead of v_mad_legacy_u16.
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{{\[[0-9]+:[0-9]+\]}}, v[[R]]
16 define amdgpu_kernel void @mad_u16(
20 i16 addrspace(1)* %c) {
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
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
31 %m.val = mul i16 %a.val, %b.val
32 %r.val = add i16 %m.val, %c.val
34 store i16 %r.val, i16 addrspace(1)* %r
38 declare i32 @llvm.amdgcn.workitem.id.x()