150
|
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
|
|
5
|
|
6 ; ===================================================================================
|
|
7 ; V_AND_OR_B32
|
|
8 ; ===================================================================================
|
|
9
|
|
10 define amdgpu_ps float @and_or(i32 %a, i32 %b, i32 %c) {
|
|
11 ; VI-LABEL: and_or:
|
|
12 ; VI: ; %bb.0:
|
|
13 ; VI-NEXT: v_and_b32_e32 v0, v0, v1
|
|
14 ; VI-NEXT: v_or_b32_e32 v0, v0, v2
|
|
15 ; VI-NEXT: ; return to shader part epilog
|
|
16 ;
|
|
17 ; GFX9-LABEL: and_or:
|
|
18 ; GFX9: ; %bb.0:
|
|
19 ; GFX9-NEXT: v_and_or_b32 v0, v0, v1, v2
|
|
20 ; GFX9-NEXT: ; return to shader part epilog
|
|
21 ;
|
|
22 ; GFX10-LABEL: and_or:
|
|
23 ; GFX10: ; %bb.0:
|
|
24 ; GFX10-NEXT: v_and_or_b32 v0, v0, v1, v2
|
|
25 ; GFX10-NEXT: ; implicit-def: $vcc_hi
|
|
26 ; GFX10-NEXT: ; return to shader part epilog
|
|
27 %x = and i32 %a, %b
|
|
28 %result = or i32 %x, %c
|
|
29 %bc = bitcast i32 %result to float
|
|
30 ret float %bc
|
|
31 }
|
|
32
|
|
33 ; ThreeOp instruction variant not used due to Constant Bus Limitations
|
|
34 define amdgpu_ps float @and_or_vgpr_b(i32 inreg %a, i32 %b, i32 inreg %c) {
|
|
35 ; VI-LABEL: and_or_vgpr_b:
|
|
36 ; VI: ; %bb.0:
|
|
37 ; VI-NEXT: v_and_b32_e32 v0, s2, v0
|
|
38 ; VI-NEXT: v_or_b32_e32 v0, s3, v0
|
|
39 ; VI-NEXT: ; return to shader part epilog
|
|
40 ;
|
|
41 ; GFX9-LABEL: and_or_vgpr_b:
|
|
42 ; GFX9: ; %bb.0:
|
|
43 ; GFX9-NEXT: v_and_b32_e32 v0, s2, v0
|
|
44 ; GFX9-NEXT: v_or_b32_e32 v0, s3, v0
|
|
45 ; GFX9-NEXT: ; return to shader part epilog
|
|
46 ;
|
|
47 ; GFX10-LABEL: and_or_vgpr_b:
|
|
48 ; GFX10: ; %bb.0:
|
|
49 ; GFX10-NEXT: v_and_or_b32 v0, s2, v0, s3
|
|
50 ; GFX10-NEXT: ; implicit-def: $vcc_hi
|
|
51 ; GFX10-NEXT: ; return to shader part epilog
|
|
52 %x = and i32 %a, %b
|
|
53 %result = or i32 %x, %c
|
|
54 %bc = bitcast i32 %result to float
|
|
55 ret float %bc
|
|
56 }
|
|
57
|
|
58 define amdgpu_ps float @and_or_vgpr_ab(i32 %a, i32 %b, i32 inreg %c) {
|
|
59 ; VI-LABEL: and_or_vgpr_ab:
|
|
60 ; VI: ; %bb.0:
|
|
61 ; VI-NEXT: v_and_b32_e32 v0, v0, v1
|
|
62 ; VI-NEXT: v_or_b32_e32 v0, s2, v0
|
|
63 ; VI-NEXT: ; return to shader part epilog
|
|
64 ;
|
|
65 ; GFX9-LABEL: and_or_vgpr_ab:
|
|
66 ; GFX9: ; %bb.0:
|
|
67 ; GFX9-NEXT: v_and_or_b32 v0, v0, v1, s2
|
|
68 ; GFX9-NEXT: ; return to shader part epilog
|
|
69 ;
|
|
70 ; GFX10-LABEL: and_or_vgpr_ab:
|
|
71 ; GFX10: ; %bb.0:
|
|
72 ; GFX10-NEXT: v_and_or_b32 v0, v0, v1, s2
|
|
73 ; GFX10-NEXT: ; implicit-def: $vcc_hi
|
|
74 ; GFX10-NEXT: ; return to shader part epilog
|
|
75 %x = and i32 %a, %b
|
|
76 %result = or i32 %x, %c
|
|
77 %bc = bitcast i32 %result to float
|
|
78 ret float %bc
|
|
79 }
|
|
80
|
|
81 define amdgpu_ps float @and_or_vgpr_const(i32 %a, i32 %b) {
|
|
82 ; VI-LABEL: and_or_vgpr_const:
|
|
83 ; VI: ; %bb.0:
|
|
84 ; VI-NEXT: v_and_b32_e32 v0, 4, v0
|
|
85 ; VI-NEXT: v_or_b32_e32 v0, v0, v1
|
|
86 ; VI-NEXT: ; return to shader part epilog
|
|
87 ;
|
|
88 ; GFX9-LABEL: and_or_vgpr_const:
|
|
89 ; GFX9: ; %bb.0:
|
|
90 ; GFX9-NEXT: v_and_or_b32 v0, v0, 4, v1
|
|
91 ; GFX9-NEXT: ; return to shader part epilog
|
|
92 ;
|
|
93 ; GFX10-LABEL: and_or_vgpr_const:
|
|
94 ; GFX10: ; %bb.0:
|
|
95 ; GFX10-NEXT: v_and_or_b32 v0, v0, 4, v1
|
|
96 ; GFX10-NEXT: ; implicit-def: $vcc_hi
|
|
97 ; GFX10-NEXT: ; return to shader part epilog
|
|
98 %x = and i32 4, %a
|
|
99 %result = or i32 %x, %b
|
|
100 %bc = bitcast i32 %result to float
|
|
101 ret float %bc
|
|
102 }
|
|
103
|
|
104 define amdgpu_ps float @and_or_vgpr_const_inline_const(i32 %a) {
|
|
105 ; VI-LABEL: and_or_vgpr_const_inline_const:
|
|
106 ; VI: ; %bb.0:
|
|
107 ; VI-NEXT: v_and_b32_e32 v0, 20, v0
|
|
108 ; VI-NEXT: v_or_b32_e32 v0, 0x808, v0
|
|
109 ; VI-NEXT: ; return to shader part epilog
|
|
110 ;
|
|
111 ; GFX9-LABEL: and_or_vgpr_const_inline_const:
|
|
112 ; GFX9: ; %bb.0:
|
|
113 ; GFX9-NEXT: v_mov_b32_e32 v1, 0x808
|
|
114 ; GFX9-NEXT: v_and_or_b32 v0, v0, 20, v1
|
|
115 ; GFX9-NEXT: ; return to shader part epilog
|
|
116 ;
|
|
117 ; GFX10-LABEL: and_or_vgpr_const_inline_const:
|
|
118 ; GFX10: ; %bb.0:
|
|
119 ; GFX10-NEXT: v_and_or_b32 v0, v0, 20, 0x808
|
|
120 ; GFX10-NEXT: ; implicit-def: $vcc_hi
|
|
121 ; GFX10-NEXT: ; return to shader part epilog
|
|
122 %x = and i32 20, %a
|
|
123 %result = or i32 %x, 2056
|
|
124 %bc = bitcast i32 %result to float
|
|
125 ret float %bc
|
|
126 }
|
|
127
|
|
128 define amdgpu_ps float @and_or_vgpr_inline_const_x2(i32 %a) {
|
|
129 ; VI-LABEL: and_or_vgpr_inline_const_x2:
|
|
130 ; VI: ; %bb.0:
|
|
131 ; VI-NEXT: v_and_b32_e32 v0, 4, v0
|
|
132 ; VI-NEXT: v_or_b32_e32 v0, 1, v0
|
|
133 ; VI-NEXT: ; return to shader part epilog
|
|
134 ;
|
|
135 ; GFX9-LABEL: and_or_vgpr_inline_const_x2:
|
|
136 ; GFX9: ; %bb.0:
|
|
137 ; GFX9-NEXT: v_and_or_b32 v0, v0, 4, 1
|
|
138 ; GFX9-NEXT: ; return to shader part epilog
|
|
139 ;
|
|
140 ; GFX10-LABEL: and_or_vgpr_inline_const_x2:
|
|
141 ; GFX10: ; %bb.0:
|
|
142 ; GFX10-NEXT: v_and_or_b32 v0, v0, 4, 1
|
|
143 ; GFX10-NEXT: ; implicit-def: $vcc_hi
|
|
144 ; GFX10-NEXT: ; return to shader part epilog
|
|
145 %x = and i32 4, %a
|
|
146 %result = or i32 %x, 1
|
|
147 %bc = bitcast i32 %result to float
|
|
148 ret float %bc
|
|
149 }
|