1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -global-isel -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 < %s | FileCheck -check-prefix=GFX9 %s
3 ; RUN: llc -global-isel -mtriple=amdgcn-amd-amdhsa -mcpu=fiji < %s | FileCheck -check-prefix=GFX8 %s
4 ; RUN: llc -global-isel -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 < %s | FileCheck -check-prefix=GFX10 %s
6 define <2 x i16> @v_mul_v2i16(<2 x i16> %a, <2 x i16> %b) {
7 ; GFX9-LABEL: v_mul_v2i16:
9 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
10 ; GFX9-NEXT: v_pk_mul_lo_u16 v0, v0, v1
11 ; GFX9-NEXT: s_setpc_b64 s[30:31]
13 ; GFX8-LABEL: v_mul_v2i16:
15 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
16 ; GFX8-NEXT: v_mul_lo_u16_e32 v2, v0, v1
17 ; GFX8-NEXT: v_mul_lo_u16_sdwa v0, v0, v1 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
18 ; GFX8-NEXT: v_or_b32_e32 v0, v2, v0
19 ; GFX8-NEXT: s_setpc_b64 s[30:31]
21 ; GFX10-LABEL: v_mul_v2i16:
23 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
24 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
25 ; GFX10-NEXT: v_pk_mul_lo_u16 v0, v0, v1
26 ; GFX10-NEXT: s_setpc_b64 s[30:31]
27 %mul = mul <2 x i16> %a, %b
31 define <2 x i16> @v_mul_v2i16_fneg_lhs(<2 x half> %a, <2 x i16> %b) {
32 ; GFX9-LABEL: v_mul_v2i16_fneg_lhs:
34 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
35 ; GFX9-NEXT: v_pk_mul_lo_u16 v0, v0, v1 neg_lo:[1,0] neg_hi:[1,0]
36 ; GFX9-NEXT: s_setpc_b64 s[30:31]
38 ; GFX8-LABEL: v_mul_v2i16_fneg_lhs:
40 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
41 ; GFX8-NEXT: v_xor_b32_e32 v0, 0x80008000, v0
42 ; GFX8-NEXT: v_mul_lo_u16_e32 v2, v0, v1
43 ; GFX8-NEXT: v_mul_lo_u16_sdwa v0, v0, v1 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
44 ; GFX8-NEXT: v_or_b32_e32 v0, v2, v0
45 ; GFX8-NEXT: s_setpc_b64 s[30:31]
47 ; GFX10-LABEL: v_mul_v2i16_fneg_lhs:
49 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
50 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
51 ; GFX10-NEXT: v_pk_mul_lo_u16 v0, v0, v1 neg_lo:[1,0] neg_hi:[1,0]
52 ; GFX10-NEXT: s_setpc_b64 s[30:31]
53 %neg.a = fneg <2 x half> %a
54 %cast.neg.a = bitcast <2 x half> %neg.a to <2 x i16>
55 %mul = mul <2 x i16> %cast.neg.a, %b
59 define <2 x i16> @v_mul_v2i16_fneg_rhs(<2 x i16> %a, <2 x half> %b) {
60 ; GFX9-LABEL: v_mul_v2i16_fneg_rhs:
62 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
63 ; GFX9-NEXT: v_pk_mul_lo_u16 v0, v0, v1 neg_lo:[0,1] neg_hi:[0,1]
64 ; GFX9-NEXT: s_setpc_b64 s[30:31]
66 ; GFX8-LABEL: v_mul_v2i16_fneg_rhs:
68 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
69 ; GFX8-NEXT: v_xor_b32_e32 v1, 0x80008000, v1
70 ; GFX8-NEXT: v_mul_lo_u16_e32 v2, v0, v1
71 ; GFX8-NEXT: v_mul_lo_u16_sdwa v0, v0, v1 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
72 ; GFX8-NEXT: v_or_b32_e32 v0, v2, v0
73 ; GFX8-NEXT: s_setpc_b64 s[30:31]
75 ; GFX10-LABEL: v_mul_v2i16_fneg_rhs:
77 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
78 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
79 ; GFX10-NEXT: v_pk_mul_lo_u16 v0, v0, v1 neg_lo:[0,1] neg_hi:[0,1]
80 ; GFX10-NEXT: s_setpc_b64 s[30:31]
81 %neg.b = fneg <2 x half> %b
82 %cast.neg.b = bitcast <2 x half> %neg.b to <2 x i16>
83 %mul = mul <2 x i16> %a, %cast.neg.b
87 define <2 x i16> @v_mul_v2i16_fneg_lhs_fneg_rhs(<2 x half> %a, <2 x half> %b) {
88 ; GFX9-LABEL: v_mul_v2i16_fneg_lhs_fneg_rhs:
90 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
91 ; GFX9-NEXT: v_pk_mul_lo_u16 v0, v0, v1 neg_lo:[1,1] neg_hi:[1,1]
92 ; GFX9-NEXT: s_setpc_b64 s[30:31]
94 ; GFX8-LABEL: v_mul_v2i16_fneg_lhs_fneg_rhs:
96 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
97 ; GFX8-NEXT: s_mov_b32 s4, 0x80008000
98 ; GFX8-NEXT: v_xor_b32_e32 v0, s4, v0
99 ; GFX8-NEXT: v_xor_b32_e32 v1, s4, v1
100 ; GFX8-NEXT: v_mul_lo_u16_e32 v2, v0, v1
101 ; GFX8-NEXT: v_mul_lo_u16_sdwa v0, v0, v1 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:WORD_1 src1_sel:WORD_1
102 ; GFX8-NEXT: v_or_b32_e32 v0, v2, v0
103 ; GFX8-NEXT: s_setpc_b64 s[30:31]
105 ; GFX10-LABEL: v_mul_v2i16_fneg_lhs_fneg_rhs:
107 ; GFX10-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
108 ; GFX10-NEXT: s_waitcnt_vscnt null, 0x0
109 ; GFX10-NEXT: v_pk_mul_lo_u16 v0, v0, v1 neg_lo:[1,1] neg_hi:[1,1]
110 ; GFX10-NEXT: s_setpc_b64 s[30:31]
111 %neg.a = fneg <2 x half> %a
112 %neg.b = fneg <2 x half> %b
113 %cast.neg.a = bitcast <2 x half> %neg.a to <2 x i16>
114 %cast.neg.b = bitcast <2 x half> %neg.b to <2 x i16>
115 %mul = mul <2 x i16> %cast.neg.a, %cast.neg.b