1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=amdgcn-amd-mesa3d -mcpu=fiji -verify-machineinstrs | FileCheck -check-prefix=VI %s
3 ; RUN: llc < %s -mtriple=amdgcn-amd-mesa3d -mcpu=gfx900 -verify-machineinstrs | FileCheck -check-prefix=GFX9 %s
5 ; ===================================================================================
7 ; ===================================================================================
9 define amdgpu_ps float @add_shl(i32 %a, i32 %b, i32 %c) {
12 ; VI-NEXT: v_add_u32_e32 v0, vcc, v0, v1
13 ; VI-NEXT: v_lshlrev_b32_e32 v0, v2, v0
14 ; VI-NEXT: ; return to shader part epilog
16 ; GFX9-LABEL: add_shl:
18 ; GFX9-NEXT: v_add_lshl_u32 v0, v0, v1, v2
19 ; GFX9-NEXT: ; return to shader part epilog
21 %result = shl i32 %x, %c
22 %bc = bitcast i32 %result to float
26 define amdgpu_ps float @add_shl_vgpr_c(i32 inreg %a, i32 inreg %b, i32 %c) {
27 ; VI-LABEL: add_shl_vgpr_c:
29 ; VI-NEXT: s_add_i32 s2, s2, s3
30 ; VI-NEXT: v_lshlrev_b32_e64 v0, v0, s2
31 ; VI-NEXT: ; return to shader part epilog
33 ; GFX9-LABEL: add_shl_vgpr_c:
35 ; GFX9-NEXT: s_add_i32 s2, s2, s3
36 ; GFX9-NEXT: v_lshlrev_b32_e64 v0, v0, s2
37 ; GFX9-NEXT: ; return to shader part epilog
39 %result = shl i32 %x, %c
40 %bc = bitcast i32 %result to float
44 define amdgpu_ps float @add_shl_vgpr_ac(i32 %a, i32 inreg %b, i32 %c) {
45 ; VI-LABEL: add_shl_vgpr_ac:
47 ; VI-NEXT: v_add_u32_e32 v0, vcc, s2, v0
48 ; VI-NEXT: v_lshlrev_b32_e32 v0, v1, v0
49 ; VI-NEXT: ; return to shader part epilog
51 ; GFX9-LABEL: add_shl_vgpr_ac:
53 ; GFX9-NEXT: v_add_lshl_u32 v0, v0, s2, v1
54 ; GFX9-NEXT: ; return to shader part epilog
56 %result = shl i32 %x, %c
57 %bc = bitcast i32 %result to float
61 define amdgpu_ps float @add_shl_vgpr_const(i32 %a, i32 %b) {
62 ; VI-LABEL: add_shl_vgpr_const:
64 ; VI-NEXT: v_add_u32_e32 v0, vcc, v0, v1
65 ; VI-NEXT: v_lshlrev_b32_e32 v0, 9, v0
66 ; VI-NEXT: ; return to shader part epilog
68 ; GFX9-LABEL: add_shl_vgpr_const:
70 ; GFX9-NEXT: v_add_lshl_u32 v0, v0, v1, 9
71 ; GFX9-NEXT: ; return to shader part epilog
73 %result = shl i32 %x, 9
74 %bc = bitcast i32 %result to float
78 define amdgpu_ps float @add_shl_vgpr_const_inline_const(i32 %a) {
79 ; VI-LABEL: add_shl_vgpr_const_inline_const:
81 ; VI-NEXT: v_lshlrev_b32_e32 v0, 9, v0
82 ; VI-NEXT: v_add_u32_e32 v0, vcc, 0x7e800, v0
83 ; VI-NEXT: ; return to shader part epilog
85 ; GFX9-LABEL: add_shl_vgpr_const_inline_const:
87 ; GFX9-NEXT: v_mov_b32_e32 v1, 0x7e800
88 ; GFX9-NEXT: v_lshl_add_u32 v0, v0, 9, v1
89 ; GFX9-NEXT: ; return to shader part epilog
91 %result = shl i32 %x, 9
92 %bc = bitcast i32 %result to float
96 ; TODO: Non-optimal code generation because SelectionDAG combines
97 ; (shl (add x, CONST), y) ---> (add (shl x, y), CONST').
99 define amdgpu_ps float @add_shl_vgpr_inline_const_x2(i32 %a) {
100 ; VI-LABEL: add_shl_vgpr_inline_const_x2:
102 ; VI-NEXT: v_lshlrev_b32_e32 v0, 9, v0
103 ; VI-NEXT: v_add_u32_e32 v0, vcc, 0x600, v0
104 ; VI-NEXT: ; return to shader part epilog
106 ; GFX9-LABEL: add_shl_vgpr_inline_const_x2:
108 ; GFX9-NEXT: v_mov_b32_e32 v1, 0x600
109 ; GFX9-NEXT: v_lshl_add_u32 v0, v0, 9, v1
110 ; GFX9-NEXT: ; return to shader part epilog
112 %result = shl i32 %x, 9
113 %bc = bitcast i32 %result to float