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
6 ; ===================================================================================
8 ; ===================================================================================
10 define amdgpu_ps float @add_shl(i32 %a, i32 %b, i32 %c) {
13 ; VI-NEXT: v_add_u32_e32 v0, vcc, v0, v1
14 ; VI-NEXT: v_lshlrev_b32_e32 v0, v2, v0
15 ; VI-NEXT: ; return to shader part epilog
17 ; GFX9-LABEL: add_shl:
19 ; GFX9-NEXT: v_add_lshl_u32 v0, v0, v1, v2
20 ; GFX9-NEXT: ; return to shader part epilog
22 ; GFX10-LABEL: add_shl:
24 ; GFX10-NEXT: v_add_lshl_u32 v0, v0, v1, v2
25 ; GFX10-NEXT: ; return to shader part epilog
27 %result = shl i32 %x, %c
28 %bc = bitcast i32 %result to float
32 define amdgpu_ps float @add_shl_vgpr_c(i32 inreg %a, i32 inreg %b, i32 %c) {
33 ; VI-LABEL: add_shl_vgpr_c:
35 ; VI-NEXT: s_add_i32 s2, s2, s3
36 ; VI-NEXT: v_lshlrev_b32_e64 v0, v0, s2
37 ; VI-NEXT: ; return to shader part epilog
39 ; GFX9-LABEL: add_shl_vgpr_c:
41 ; GFX9-NEXT: s_add_i32 s2, s2, s3
42 ; GFX9-NEXT: v_lshlrev_b32_e64 v0, v0, s2
43 ; GFX9-NEXT: ; return to shader part epilog
45 ; GFX10-LABEL: add_shl_vgpr_c:
47 ; GFX10-NEXT: s_add_i32 s2, s2, s3
48 ; GFX10-NEXT: v_lshlrev_b32_e64 v0, v0, s2
49 ; GFX10-NEXT: ; return to shader part epilog
51 %result = shl i32 %x, %c
52 %bc = bitcast i32 %result to float
56 define amdgpu_ps float @add_shl_vgpr_ac(i32 %a, i32 inreg %b, i32 %c) {
57 ; VI-LABEL: add_shl_vgpr_ac:
59 ; VI-NEXT: v_add_u32_e32 v0, vcc, s2, v0
60 ; VI-NEXT: v_lshlrev_b32_e32 v0, v1, v0
61 ; VI-NEXT: ; return to shader part epilog
63 ; GFX9-LABEL: add_shl_vgpr_ac:
65 ; GFX9-NEXT: v_add_lshl_u32 v0, v0, s2, v1
66 ; GFX9-NEXT: ; return to shader part epilog
68 ; GFX10-LABEL: add_shl_vgpr_ac:
70 ; GFX10-NEXT: v_add_lshl_u32 v0, v0, s2, v1
71 ; GFX10-NEXT: ; return to shader part epilog
73 %result = shl i32 %x, %c
74 %bc = bitcast i32 %result to float
78 define amdgpu_ps float @add_shl_vgpr_const(i32 %a, i32 %b) {
79 ; VI-LABEL: add_shl_vgpr_const:
81 ; VI-NEXT: v_add_u32_e32 v0, vcc, v0, v1
82 ; VI-NEXT: v_lshlrev_b32_e32 v0, 9, v0
83 ; VI-NEXT: ; return to shader part epilog
85 ; GFX9-LABEL: add_shl_vgpr_const:
87 ; GFX9-NEXT: v_add_lshl_u32 v0, v0, v1, 9
88 ; GFX9-NEXT: ; return to shader part epilog
90 ; GFX10-LABEL: add_shl_vgpr_const:
92 ; GFX10-NEXT: v_add_lshl_u32 v0, v0, v1, 9
93 ; GFX10-NEXT: ; return to shader part epilog
95 %result = shl i32 %x, 9
96 %bc = bitcast i32 %result to float
100 define amdgpu_ps float @add_shl_vgpr_const_inline_const(i32 %a) {
101 ; VI-LABEL: add_shl_vgpr_const_inline_const:
103 ; VI-NEXT: v_add_u32_e32 v0, vcc, 0x3f4, v0
104 ; VI-NEXT: v_lshlrev_b32_e32 v0, 9, v0
105 ; VI-NEXT: ; return to shader part epilog
107 ; GFX9-LABEL: add_shl_vgpr_const_inline_const:
109 ; GFX9-NEXT: v_mov_b32_e32 v1, 0x3f4
110 ; GFX9-NEXT: v_add_lshl_u32 v0, v0, v1, 9
111 ; GFX9-NEXT: ; return to shader part epilog
113 ; GFX10-LABEL: add_shl_vgpr_const_inline_const:
115 ; GFX10-NEXT: v_add_lshl_u32 v0, 0x3f4, v0, 9
116 ; GFX10-NEXT: ; return to shader part epilog
117 %x = add i32 %a, 1012
118 %result = shl i32 %x, 9
119 %bc = bitcast i32 %result to float
123 define amdgpu_ps float @add_shl_vgpr_inline_const_x2(i32 %a) {
124 ; VI-LABEL: add_shl_vgpr_inline_const_x2:
126 ; VI-NEXT: v_add_u32_e32 v0, vcc, 3, v0
127 ; VI-NEXT: v_lshlrev_b32_e32 v0, 9, v0
128 ; VI-NEXT: ; return to shader part epilog
130 ; GFX9-LABEL: add_shl_vgpr_inline_const_x2:
132 ; GFX9-NEXT: v_add_lshl_u32 v0, v0, 3, 9
133 ; GFX9-NEXT: ; return to shader part epilog
135 ; GFX10-LABEL: add_shl_vgpr_inline_const_x2:
137 ; GFX10-NEXT: v_add_lshl_u32 v0, v0, 3, 9
138 ; GFX10-NEXT: ; return to shader part epilog
140 %result = shl i32 %x, 9
141 %bc = bitcast i32 %result to float