1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
2 ; RUN: llc -mtriple=amdgcn -mcpu=gfx950 -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,GFX950-SDAG %s
3 ; RUN: llc -global-isel -mtriple=amdgcn -mcpu=gfx950 -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefixes=GCN,GFX950-GISEL %s
5 declare i32 @llvm.amdgcn.bitop3.i32(i32, i32, i32, i32)
6 declare i16 @llvm.amdgcn.bitop3.i16(i16, i16, i16, i32)
8 define amdgpu_ps float @bitop3_b32_vvv(i32 %a, i32 %b, i32 %c) {
9 ; GCN-LABEL: bitop3_b32_vvv:
11 ; GCN-NEXT: v_bitop3_b32 v0, v0, v1, v2 bitop3:0xf
12 ; GCN-NEXT: ; return to shader part epilog
13 %ret = call i32 @llvm.amdgcn.bitop3.i32(i32 %a, i32 %b, i32 %c, i32 15)
14 %ret_cast = bitcast i32 %ret to float
18 define amdgpu_ps float @bitop3_b32_svv(i32 inreg %a, i32 %b, i32 %c) {
19 ; GCN-LABEL: bitop3_b32_svv:
21 ; GCN-NEXT: v_bitop3_b32 v0, s0, v0, v1 bitop3:0x10
22 ; GCN-NEXT: ; return to shader part epilog
23 %ret = call i32 @llvm.amdgcn.bitop3.i32(i32 %a, i32 %b, i32 %c, i32 16)
24 %ret_cast = bitcast i32 %ret to float
28 define amdgpu_ps float @bitop3_b32_ssv(i32 inreg %a, i32 inreg %b, i32 %c) {
29 ; GCN-LABEL: bitop3_b32_ssv:
31 ; GCN-NEXT: v_mov_b32_e32 v1, s1
32 ; GCN-NEXT: v_bitop3_b32 v0, s0, v1, v0 bitop3:0x11
33 ; GCN-NEXT: ; return to shader part epilog
34 %ret = call i32 @llvm.amdgcn.bitop3.i32(i32 %a, i32 %b, i32 %c, i32 17)
35 %ret_cast = bitcast i32 %ret to float
39 define amdgpu_ps float @bitop3_b32_sss(i32 inreg %a, i32 inreg %b, i32 inreg %c) {
40 ; GCN-LABEL: bitop3_b32_sss:
42 ; GCN-NEXT: v_mov_b32_e32 v0, s1
43 ; GCN-NEXT: v_mov_b32_e32 v1, s2
44 ; GCN-NEXT: v_bitop3_b32 v0, s0, v0, v1 bitop3:0x12
45 ; GCN-NEXT: ; return to shader part epilog
46 %ret = call i32 @llvm.amdgcn.bitop3.i32(i32 %a, i32 %b, i32 %c, i32 18)
47 %ret_cast = bitcast i32 %ret to float
51 define amdgpu_ps float @bitop3_b32_vvi(i32 %a, i32 %b) {
52 ; GFX950-SDAG-LABEL: bitop3_b32_vvi:
53 ; GFX950-SDAG: ; %bb.0:
54 ; GFX950-SDAG-NEXT: s_movk_i32 s0, 0x3e8
55 ; GFX950-SDAG-NEXT: v_bitop3_b32 v0, v0, v1, s0 bitop3:0x13
56 ; GFX950-SDAG-NEXT: ; return to shader part epilog
58 ; GFX950-GISEL-LABEL: bitop3_b32_vvi:
59 ; GFX950-GISEL: ; %bb.0:
60 ; GFX950-GISEL-NEXT: v_mov_b32_e32 v2, 0x3e8
61 ; GFX950-GISEL-NEXT: v_bitop3_b32 v0, v0, v1, v2 bitop3:0x13
62 ; GFX950-GISEL-NEXT: ; return to shader part epilog
63 %ret = call i32 @llvm.amdgcn.bitop3.i32(i32 %a, i32 %b, i32 1000, i32 19)
64 %ret_cast = bitcast i32 %ret to float
68 define amdgpu_ps float @bitop3_b32_vii(i32 %a) {
69 ; GFX950-SDAG-LABEL: bitop3_b32_vii:
70 ; GFX950-SDAG: ; %bb.0:
71 ; GFX950-SDAG-NEXT: s_movk_i32 s0, 0x7d0
72 ; GFX950-SDAG-NEXT: v_mov_b32_e32 v1, 0x3e8
73 ; GFX950-SDAG-NEXT: v_bitop3_b32 v0, v0, s0, v1 bitop3:0x14
74 ; GFX950-SDAG-NEXT: ; return to shader part epilog
76 ; GFX950-GISEL-LABEL: bitop3_b32_vii:
77 ; GFX950-GISEL: ; %bb.0:
78 ; GFX950-GISEL-NEXT: v_mov_b32_e32 v1, 0x7d0
79 ; GFX950-GISEL-NEXT: v_mov_b32_e32 v2, 0x3e8
80 ; GFX950-GISEL-NEXT: v_bitop3_b32 v0, v0, v1, v2 bitop3:0x14
81 ; GFX950-GISEL-NEXT: ; return to shader part epilog
82 %ret = call i32 @llvm.amdgcn.bitop3.i32(i32 %a, i32 2000, i32 1000, i32 20)
83 %ret_cast = bitcast i32 %ret to float
87 ; FIXME: Constant fold this
89 define amdgpu_ps float @bitop3_b32_iii() {
90 ; GFX950-SDAG-LABEL: bitop3_b32_iii:
91 ; GFX950-SDAG: ; %bb.0:
92 ; GFX950-SDAG-NEXT: s_movk_i32 s0, 0xbb8
93 ; GFX950-SDAG-NEXT: v_mov_b32_e32 v0, 0x7d0
94 ; GFX950-SDAG-NEXT: v_mov_b32_e32 v1, 0x3e8
95 ; GFX950-SDAG-NEXT: v_bitop3_b32 v0, s0, v0, v1 bitop3:0x15
96 ; GFX950-SDAG-NEXT: ; return to shader part epilog
98 ; GFX950-GISEL-LABEL: bitop3_b32_iii:
99 ; GFX950-GISEL: ; %bb.0:
100 ; GFX950-GISEL-NEXT: v_mov_b32_e32 v0, 0xbb8
101 ; GFX950-GISEL-NEXT: v_mov_b32_e32 v1, 0x7d0
102 ; GFX950-GISEL-NEXT: v_mov_b32_e32 v2, 0x3e8
103 ; GFX950-GISEL-NEXT: v_bitop3_b32 v0, v0, v1, v2 bitop3:0x15
104 ; GFX950-GISEL-NEXT: ; return to shader part epilog
105 %ret = call i32 @llvm.amdgcn.bitop3.i32(i32 3000, i32 2000, i32 1000, i32 21)
106 %ret_cast = bitcast i32 %ret to float
110 define amdgpu_ps half @bitop3_b16_vvv(i16 %a, i16 %b, i16 %c) {
111 ; GCN-LABEL: bitop3_b16_vvv:
113 ; GCN-NEXT: v_bitop3_b16 v0, v0, v1, v2 bitop3:0xf
114 ; GCN-NEXT: ; return to shader part epilog
115 %ret = call i16 @llvm.amdgcn.bitop3.i16(i16 %a, i16 %b, i16 %c, i32 15)
116 %ret_cast = bitcast i16 %ret to half
120 define amdgpu_ps half @bitop3_b16_svv(i16 inreg %a, i16 %b, i16 %c) {
121 ; GCN-LABEL: bitop3_b16_svv:
123 ; GCN-NEXT: v_bitop3_b16 v0, s0, v0, v1 bitop3:0x10
124 ; GCN-NEXT: ; return to shader part epilog
125 %ret = call i16 @llvm.amdgcn.bitop3.i16(i16 %a, i16 %b, i16 %c, i32 16)
126 %ret_cast = bitcast i16 %ret to half
130 define amdgpu_ps half @bitop3_b16_ssv(i16 inreg %a, i16 inreg %b, i16 %c) {
131 ; GCN-LABEL: bitop3_b16_ssv:
133 ; GCN-NEXT: v_mov_b32_e32 v1, s1
134 ; GCN-NEXT: v_bitop3_b16 v0, s0, v1, v0 bitop3:0x11
135 ; GCN-NEXT: ; return to shader part epilog
136 %ret = call i16 @llvm.amdgcn.bitop3.i16(i16 %a, i16 %b, i16 %c, i32 17)
137 %ret_cast = bitcast i16 %ret to half
141 define amdgpu_ps half @bitop3_b16_sss(i16 inreg %a, i16 inreg %b, i16 inreg %c) {
142 ; GCN-LABEL: bitop3_b16_sss:
144 ; GCN-NEXT: v_mov_b32_e32 v0, s1
145 ; GCN-NEXT: v_mov_b32_e32 v1, s2
146 ; GCN-NEXT: v_bitop3_b16 v0, s0, v0, v1 bitop3:0x12
147 ; GCN-NEXT: ; return to shader part epilog
148 %ret = call i16 @llvm.amdgcn.bitop3.i16(i16 %a, i16 %b, i16 %c, i32 18)
149 %ret_cast = bitcast i16 %ret to half
153 define amdgpu_ps half @bitop3_b16_vvi(i16 %a, i16 %b) {
154 ; GFX950-SDAG-LABEL: bitop3_b16_vvi:
155 ; GFX950-SDAG: ; %bb.0:
156 ; GFX950-SDAG-NEXT: s_movk_i32 s0, 0x3e8
157 ; GFX950-SDAG-NEXT: v_bitop3_b16 v0, v0, v1, s0 bitop3:0x13
158 ; GFX950-SDAG-NEXT: ; return to shader part epilog
160 ; GFX950-GISEL-LABEL: bitop3_b16_vvi:
161 ; GFX950-GISEL: ; %bb.0:
162 ; GFX950-GISEL-NEXT: v_mov_b32_e32 v2, 0x3e8
163 ; GFX950-GISEL-NEXT: v_bitop3_b16 v0, v0, v1, v2 bitop3:0x13
164 ; GFX950-GISEL-NEXT: ; return to shader part epilog
165 %ret = call i16 @llvm.amdgcn.bitop3.i16(i16 %a, i16 %b, i16 1000, i32 19)
166 %ret_cast = bitcast i16 %ret to half
170 define amdgpu_ps half @bitop3_b16_vii(i16 %a) {
171 ; GFX950-SDAG-LABEL: bitop3_b16_vii:
172 ; GFX950-SDAG: ; %bb.0:
173 ; GFX950-SDAG-NEXT: s_movk_i32 s0, 0x7d0
174 ; GFX950-SDAG-NEXT: v_mov_b32_e32 v1, 0x3e8
175 ; GFX950-SDAG-NEXT: v_bitop3_b16 v0, v0, s0, v1 bitop3:0x14
176 ; GFX950-SDAG-NEXT: ; return to shader part epilog
178 ; GFX950-GISEL-LABEL: bitop3_b16_vii:
179 ; GFX950-GISEL: ; %bb.0:
180 ; GFX950-GISEL-NEXT: v_mov_b32_e32 v1, 0x7d0
181 ; GFX950-GISEL-NEXT: v_mov_b32_e32 v2, 0x3e8
182 ; GFX950-GISEL-NEXT: v_bitop3_b16 v0, v0, v1, v2 bitop3:0x14
183 ; GFX950-GISEL-NEXT: ; return to shader part epilog
184 %ret = call i16 @llvm.amdgcn.bitop3.i16(i16 %a, i16 2000, i16 1000, i32 20)
185 %ret_cast = bitcast i16 %ret to half
189 ; FIXME: Constant fold this
190 define amdgpu_ps half @bitop3_b16_iii() {
191 ; GFX950-SDAG-LABEL: bitop3_b16_iii:
192 ; GFX950-SDAG: ; %bb.0:
193 ; GFX950-SDAG-NEXT: s_movk_i32 s0, 0xbb8
194 ; GFX950-SDAG-NEXT: v_mov_b32_e32 v0, 0x7d0
195 ; GFX950-SDAG-NEXT: v_mov_b32_e32 v1, 0x3e8
196 ; GFX950-SDAG-NEXT: v_bitop3_b16 v0, s0, v0, v1 bitop3:0x15
197 ; GFX950-SDAG-NEXT: ; return to shader part epilog
199 ; GFX950-GISEL-LABEL: bitop3_b16_iii:
200 ; GFX950-GISEL: ; %bb.0:
201 ; GFX950-GISEL-NEXT: v_mov_b32_e32 v0, 0xbb8
202 ; GFX950-GISEL-NEXT: v_mov_b32_e32 v1, 0x7d0
203 ; GFX950-GISEL-NEXT: v_mov_b32_e32 v2, 0x3e8
204 ; GFX950-GISEL-NEXT: v_bitop3_b16 v0, v0, v1, v2 bitop3:0x15
205 ; GFX950-GISEL-NEXT: ; return to shader part epilog
206 %ret = call i16 @llvm.amdgcn.bitop3.i16(i16 3000, i16 2000, i16 1000, i32 21)
207 %ret_cast = bitcast i16 %ret to half