1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -global-isel -mtriple=amdgcn-amd-mesa3d -mcpu=fiji -verify-machineinstrs < %s | FileCheck -check-prefix=VI %s
3 ; RUN: llc -global-isel -mtriple=amdgcn-amd-mesa3d -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -check-prefix=GFX9 %s
4 ; RUN: llc -global-isel -mtriple=amdgcn-amd-mesa3d -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefix=GFX10 %s
5 ; RUN: llc -global-isel -mtriple=amdgcn-amd-mesa3d -mcpu=gfx1100 -amdgpu-enable-delay-alu=0 -verify-machineinstrs < %s | FileCheck -check-prefix=GFX10 %s
7 ; ===================================================================================
9 ; ===================================================================================
11 define amdgpu_ps float @add_shl(i32 %a, i32 %b, i32 %c) {
14 ; VI-NEXT: v_add_u32_e32 v0, vcc, v0, v1
15 ; VI-NEXT: v_lshlrev_b32_e32 v0, v2, v0
16 ; VI-NEXT: ; return to shader part epilog
18 ; GFX9-LABEL: add_shl:
20 ; GFX9-NEXT: v_add_lshl_u32 v0, v0, v1, v2
21 ; GFX9-NEXT: ; return to shader part epilog
23 ; GFX10-LABEL: add_shl:
25 ; GFX10-NEXT: v_add_lshl_u32 v0, v0, v1, v2
26 ; GFX10-NEXT: ; return to shader part epilog
28 %result = shl i32 %x, %c
29 %bc = bitcast i32 %result to float
33 define amdgpu_ps float @add_shl_vgpr_c(i32 inreg %a, i32 inreg %b, i32 %c) {
34 ; VI-LABEL: add_shl_vgpr_c:
36 ; VI-NEXT: s_add_i32 s2, s2, s3
37 ; VI-NEXT: v_lshlrev_b32_e64 v0, v0, s2
38 ; VI-NEXT: ; return to shader part epilog
40 ; GFX9-LABEL: add_shl_vgpr_c:
42 ; GFX9-NEXT: s_add_i32 s2, s2, s3
43 ; GFX9-NEXT: v_lshlrev_b32_e64 v0, v0, s2
44 ; GFX9-NEXT: ; return to shader part epilog
46 ; GFX10-LABEL: add_shl_vgpr_c:
48 ; GFX10-NEXT: s_add_i32 s2, s2, s3
49 ; GFX10-NEXT: v_lshlrev_b32_e64 v0, v0, s2
50 ; GFX10-NEXT: ; return to shader part epilog
52 %result = shl i32 %x, %c
53 %bc = bitcast i32 %result to float
57 define amdgpu_ps float @add_shl_vgpr_ac(i32 %a, i32 inreg %b, i32 %c) {
58 ; VI-LABEL: add_shl_vgpr_ac:
60 ; VI-NEXT: v_add_u32_e32 v0, vcc, s2, v0
61 ; VI-NEXT: v_lshlrev_b32_e32 v0, v1, v0
62 ; VI-NEXT: ; return to shader part epilog
64 ; GFX9-LABEL: add_shl_vgpr_ac:
66 ; GFX9-NEXT: v_add_lshl_u32 v0, v0, s2, v1
67 ; GFX9-NEXT: ; return to shader part epilog
69 ; GFX10-LABEL: add_shl_vgpr_ac:
71 ; GFX10-NEXT: v_add_lshl_u32 v0, v0, s2, v1
72 ; GFX10-NEXT: ; return to shader part epilog
74 %result = shl i32 %x, %c
75 %bc = bitcast i32 %result to float
79 define amdgpu_ps float @add_shl_vgpr_const(i32 %a, i32 %b) {
80 ; VI-LABEL: add_shl_vgpr_const:
82 ; VI-NEXT: v_add_u32_e32 v0, vcc, v0, v1
83 ; VI-NEXT: v_lshlrev_b32_e32 v0, 9, v0
84 ; VI-NEXT: ; return to shader part epilog
86 ; GFX9-LABEL: add_shl_vgpr_const:
88 ; GFX9-NEXT: v_add_lshl_u32 v0, v0, v1, 9
89 ; GFX9-NEXT: ; return to shader part epilog
91 ; GFX10-LABEL: add_shl_vgpr_const:
93 ; GFX10-NEXT: v_add_lshl_u32 v0, v0, v1, 9
94 ; GFX10-NEXT: ; return to shader part epilog
96 %result = shl i32 %x, 9
97 %bc = bitcast i32 %result to float
101 define amdgpu_ps float @add_shl_vgpr_const_inline_const(i32 %a) {
102 ; VI-LABEL: add_shl_vgpr_const_inline_const:
104 ; VI-NEXT: v_lshlrev_b32_e32 v0, 9, v0
105 ; VI-NEXT: v_add_u32_e32 v0, vcc, 0x7e800, v0
106 ; VI-NEXT: ; return to shader part epilog
108 ; GFX9-LABEL: add_shl_vgpr_const_inline_const:
110 ; GFX9-NEXT: v_mov_b32_e32 v1, 0x7e800
111 ; GFX9-NEXT: v_lshl_add_u32 v0, v0, 9, v1
112 ; GFX9-NEXT: ; return to shader part epilog
114 ; GFX10-LABEL: add_shl_vgpr_const_inline_const:
116 ; GFX10-NEXT: v_lshl_add_u32 v0, v0, 9, 0x7e800
117 ; GFX10-NEXT: ; return to shader part epilog
118 %x = add i32 %a, 1012
119 %result = shl i32 %x, 9
120 %bc = bitcast i32 %result to float
124 define amdgpu_ps float @add_shl_vgpr_inline_const_x2(i32 %a) {
125 ; VI-LABEL: add_shl_vgpr_inline_const_x2:
127 ; VI-NEXT: v_lshlrev_b32_e32 v0, 9, v0
128 ; VI-NEXT: v_add_u32_e32 v0, vcc, 0x600, v0
129 ; VI-NEXT: ; return to shader part epilog
131 ; GFX9-LABEL: add_shl_vgpr_inline_const_x2:
133 ; GFX9-NEXT: v_mov_b32_e32 v1, 0x600
134 ; GFX9-NEXT: v_lshl_add_u32 v0, v0, 9, v1
135 ; GFX9-NEXT: ; return to shader part epilog
137 ; GFX10-LABEL: add_shl_vgpr_inline_const_x2:
139 ; GFX10-NEXT: v_lshl_add_u32 v0, v0, 9, 0x600
140 ; GFX10-NEXT: ; return to shader part epilog
142 %result = shl i32 %x, 9
143 %bc = bitcast i32 %result to float