1 ; RUN: llc -amdgpu-scalarize-global-loads=false -march=amdgcn -mcpu=tahiti -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,SI %s
2 ; RUN: llc -amdgpu-scalarize-global-loads=false -march=amdgcn -mcpu=fiji -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,VI,GFX89 %s
3 ; RUN: llc -amdgpu-scalarize-global-loads=false -march=amdgcn -mcpu=gfx900 -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,GFX9,GFX89 %s
5 ; GCN-LABEL: {{^}}v_mul_i16:
6 ; SI: v_and_b32_e32 v{{[0-9]+}}, 0xffff, v{{[0-9]+}}
7 ; SI: v_and_b32_e32 v{{[0-9]+}}, 0xffff, v{{[0-9]+}}
10 ; GFX89: v_mul_lo_u16_e32 v0, v0, v1
11 define i16 @v_mul_i16(i16 %a, i16 %b) {
12 %r.val = mul i16 %a, %b
16 ; GCN-LABEL: {{^}}s_mul_i16:
18 define amdgpu_kernel void @s_mul_i16(i16 %a, i16 %b) {
19 %r.val = mul i16 %a, %b
20 store volatile i16 %r.val, ptr addrspace(1) null
24 ; FIXME: Should emit u16 mul here.
25 ; GCN-LABEL: {{^}}v_mul_i16_uniform_load:
27 define amdgpu_kernel void @v_mul_i16_uniform_load(
30 ptr addrspace(1) %b) {
32 %a.val = load i16, ptr addrspace(1) %a
33 %b.val = load i16, ptr addrspace(1) %b
34 %r.val = mul i16 %a.val, %b.val
35 store i16 %r.val, ptr addrspace(1) %r
39 ; GCN-LABEL: {{^}}v_mul_v2i16:
43 ; VI: v_mul_lo_u16_sdwa
44 ; VI: v_mul_lo_u16_e32
49 ; GFX9-NEXT: v_pk_mul_lo_u16 v0, v0, v1
50 ; GFX9-NEXT: s_setpc_b64
51 define <2 x i16> @v_mul_v2i16(<2 x i16> %a, <2 x i16> %b) {
52 %r.val = mul <2 x i16> %a, %b
56 ; FIXME: Unpack garbage on gfx9
57 ; GCN-LABEL: {{^}}v_mul_v3i16:
67 ; GFX9-NEXT: v_pk_mul_lo_u16
68 ; GFX9-NEXT: v_pk_mul_lo_u16
69 ; GFX9-NEXT: s_setpc_b64
70 define <3 x i16> @v_mul_v3i16(<3 x i16> %a, <3 x i16> %b) {
71 %r.val = mul <3 x i16> %a, %b
75 ; GCN-LABEL: {{^}}v_mul_v4i16:
81 ; VI: v_mul_lo_u16_sdwa
82 ; VI: v_mul_lo_u16_sdwa
83 ; VI: v_mul_lo_u16_e32
84 ; VI: v_mul_lo_u16_e32
89 ; GFX9-NEXT: v_pk_mul_lo_u16 v0, v0, v2
90 ; GFX9-NEXT: v_pk_mul_lo_u16 v1, v1, v3
91 ; GFX9-NEXT: s_setpc_b64
92 define <4 x i16> @v_mul_v4i16(<4 x i16> %a, <4 x i16> %b) {
93 %r.val = mul <4 x i16> %a, %b