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
4 ; RUN: llc < %s -mtriple=amdgcn-amd-mesa3d -mcpu=gfx1010 -verify-machineinstrs | FileCheck -check-prefix=GFX10 %s
6 ; ===================================================================================
8 ; ===================================================================================
10 define amdgpu_ps float @shl_add(i32 %a, i32 %b, i32 %c) {
13 ; VI-NEXT: v_lshlrev_b32_e32 v0, v1, v0
14 ; VI-NEXT: v_add_u32_e32 v0, vcc, v0, v2
15 ; VI-NEXT: ; return to shader part epilog
17 ; GFX9-LABEL: shl_add:
19 ; GFX9-NEXT: v_lshl_add_u32 v0, v0, v1, v2
20 ; GFX9-NEXT: ; return to shader part epilog
22 ; GFX10-LABEL: shl_add:
24 ; GFX10-NEXT: v_lshl_add_u32 v0, v0, v1, v2
25 ; GFX10-NEXT: ; implicit-def: $vcc_hi
26 ; GFX10-NEXT: ; return to shader part epilog
28 %result = add i32 %x, %c
29 %bc = bitcast i32 %result to float
33 ; ThreeOp instruction variant not used due to Constant Bus Limitations
34 define amdgpu_ps float @shl_add_vgpr_a(i32 %a, i32 inreg %b, i32 inreg %c) {
35 ; VI-LABEL: shl_add_vgpr_a:
37 ; VI-NEXT: v_lshlrev_b32_e32 v0, s2, v0
38 ; VI-NEXT: v_add_u32_e32 v0, vcc, s3, v0
39 ; VI-NEXT: ; return to shader part epilog
41 ; GFX9-LABEL: shl_add_vgpr_a:
43 ; GFX9-NEXT: v_lshlrev_b32_e32 v0, s2, v0
44 ; GFX9-NEXT: v_add_u32_e32 v0, s3, v0
45 ; GFX9-NEXT: ; return to shader part epilog
47 ; GFX10-LABEL: shl_add_vgpr_a:
49 ; GFX10-NEXT: v_lshl_add_u32 v0, v0, s2, s3
50 ; GFX10-NEXT: ; implicit-def: $vcc_hi
51 ; GFX10-NEXT: ; return to shader part epilog
53 %result = add i32 %x, %c
54 %bc = bitcast i32 %result to float
58 define amdgpu_ps float @shl_add_vgpr_all(i32 %a, i32 %b, i32 %c) {
59 ; VI-LABEL: shl_add_vgpr_all:
61 ; VI-NEXT: v_lshlrev_b32_e32 v0, v1, v0
62 ; VI-NEXT: v_add_u32_e32 v0, vcc, v0, v2
63 ; VI-NEXT: ; return to shader part epilog
65 ; GFX9-LABEL: shl_add_vgpr_all:
67 ; GFX9-NEXT: v_lshl_add_u32 v0, v0, v1, v2
68 ; GFX9-NEXT: ; return to shader part epilog
70 ; GFX10-LABEL: shl_add_vgpr_all:
72 ; GFX10-NEXT: v_lshl_add_u32 v0, v0, v1, v2
73 ; GFX10-NEXT: ; implicit-def: $vcc_hi
74 ; GFX10-NEXT: ; return to shader part epilog
76 %result = add i32 %x, %c
77 %bc = bitcast i32 %result to float
81 define amdgpu_ps float @shl_add_vgpr_ab(i32 %a, i32 %b, i32 inreg %c) {
82 ; VI-LABEL: shl_add_vgpr_ab:
84 ; VI-NEXT: v_lshlrev_b32_e32 v0, v1, v0
85 ; VI-NEXT: v_add_u32_e32 v0, vcc, s2, v0
86 ; VI-NEXT: ; return to shader part epilog
88 ; GFX9-LABEL: shl_add_vgpr_ab:
90 ; GFX9-NEXT: v_lshl_add_u32 v0, v0, v1, s2
91 ; GFX9-NEXT: ; return to shader part epilog
93 ; GFX10-LABEL: shl_add_vgpr_ab:
95 ; GFX10-NEXT: v_lshl_add_u32 v0, v0, v1, s2
96 ; GFX10-NEXT: ; implicit-def: $vcc_hi
97 ; GFX10-NEXT: ; return to shader part epilog
99 %result = add i32 %x, %c
100 %bc = bitcast i32 %result to float
104 define amdgpu_ps float @shl_add_vgpr_const(i32 %a, i32 %b) {
105 ; VI-LABEL: shl_add_vgpr_const:
107 ; VI-NEXT: v_lshlrev_b32_e32 v0, 3, v0
108 ; VI-NEXT: v_add_u32_e32 v0, vcc, v0, v1
109 ; VI-NEXT: ; return to shader part epilog
111 ; GFX9-LABEL: shl_add_vgpr_const:
113 ; GFX9-NEXT: v_lshl_add_u32 v0, v0, 3, v1
114 ; GFX9-NEXT: ; return to shader part epilog
116 ; GFX10-LABEL: shl_add_vgpr_const:
118 ; GFX10-NEXT: v_lshl_add_u32 v0, v0, 3, v1
119 ; GFX10-NEXT: ; implicit-def: $vcc_hi
120 ; GFX10-NEXT: ; return to shader part epilog
122 %result = add i32 %x, %b
123 %bc = bitcast i32 %result to float