1 ; RUN: llc -mtriple=amdgcn -mcpu=gfx600 -verify-machineinstrs < %s | FileCheck --check-prefix=GCN %s
2 ; RUN: llc -mtriple=amdgcn -mcpu=gfx700 -verify-machineinstrs < %s | FileCheck --check-prefix=GCN %s
3 ; RUN: llc -mtriple=amdgcn -mcpu=gfx801 -verify-machineinstrs < %s | FileCheck --check-prefix=GCN %s
4 ; RUN: llc -mtriple=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck --check-prefix=GCN %s
5 ; RUN: llc -mtriple=amdgcn -mcpu=gfx906 -verify-machineinstrs < %s | FileCheck --check-prefix=GCN-DL %s
7 ; GCN-LABEL: {{^}}scalar_xnor_i32_one_use
9 define amdgpu_kernel void @scalar_xnor_i32_one_use(
10 ptr addrspace(1) %r0, i32 %a, i32 %b) {
13 %r0.val = xor i32 %xor, -1
14 store i32 %r0.val, ptr addrspace(1) %r0
18 ; GCN-LABEL: {{^}}scalar_xnor_i32_mul_use
23 define amdgpu_kernel void @scalar_xnor_i32_mul_use(
24 ptr addrspace(1) %r0, ptr addrspace(1) %r1, i32 %a, i32 %b) {
27 %r0.val = xor i32 %xor, -1
28 %r1.val = add i32 %xor, %a
29 store i32 %r0.val, ptr addrspace(1) %r0
30 store i32 %r1.val, ptr addrspace(1) %r1
34 ; GCN-LABEL: {{^}}scalar_xnor_i64_one_use
36 define amdgpu_kernel void @scalar_xnor_i64_one_use(
37 ptr addrspace(1) %r0, i64 %a, i64 %b) {
40 %r0.val = xor i64 %xor, -1
41 store i64 %r0.val, ptr addrspace(1) %r0
45 ; GCN-LABEL: {{^}}scalar_xnor_i64_mul_use
51 define amdgpu_kernel void @scalar_xnor_i64_mul_use(
52 ptr addrspace(1) %r0, ptr addrspace(1) %r1, i64 %a, i64 %b) {
55 %r0.val = xor i64 %xor, -1
56 %r1.val = add i64 %xor, %a
57 store i64 %r0.val, ptr addrspace(1) %r0
58 store i64 %r1.val, ptr addrspace(1) %r1
62 ; GCN-LABEL: {{^}}vector_xnor_i32_one_use
67 define i32 @vector_xnor_i32_one_use(i32 %a, i32 %b) {
74 ; GCN-LABEL: {{^}}vector_xnor_i64_one_use
82 define i64 @vector_xnor_i64_one_use(i64 %a, i64 %b) {
89 ; GCN-LABEL: {{^}}xnor_s_v_i32_one_use
93 define amdgpu_kernel void @xnor_s_v_i32_one_use(ptr addrspace(1) %out, i32 %s) {
94 %v = call i32 @llvm.amdgcn.workitem.id.x() #1
97 store i32 %d, ptr addrspace(1) %out
101 ; GCN-LABEL: {{^}}xnor_v_s_i32_one_use
102 ; GCN-NOT: s_xnor_b32
105 define amdgpu_kernel void @xnor_v_s_i32_one_use(ptr addrspace(1) %out, i32 %s) {
106 %v = call i32 @llvm.amdgcn.workitem.id.x() #1
107 %xor = xor i32 %v, %s
108 %d = xor i32 %xor, -1
109 store i32 %d, ptr addrspace(1) %out
113 ; GCN-LABEL: {{^}}xnor_i64_s_v_one_use
114 ; GCN-NOT: s_xnor_b64
119 define amdgpu_kernel void @xnor_i64_s_v_one_use(
120 ptr addrspace(1) %r0, i64 %a) {
122 %b32 = call i32 @llvm.amdgcn.workitem.id.x() #1
123 %b64 = zext i32 %b32 to i64
124 %b = shl i64 %b64, 29
125 %xor = xor i64 %a, %b
126 %r0.val = xor i64 %xor, -1
127 store i64 %r0.val, ptr addrspace(1) %r0
131 ; GCN-LABEL: {{^}}xnor_i64_v_s_one_use
132 ; GCN-NOT: s_xnor_b64
137 define amdgpu_kernel void @xnor_i64_v_s_one_use(
138 ptr addrspace(1) %r0, i64 %a) {
140 %b32 = call i32 @llvm.amdgcn.workitem.id.x() #1
141 %b64 = zext i32 %b32 to i64
142 %b = shl i64 %b64, 29
143 %xor = xor i64 %b, %a
144 %r0.val = xor i64 %xor, -1
145 store i64 %r0.val, ptr addrspace(1) %r0
149 ; GCN-LABEL: {{^}}vector_xor_na_b_i32_one_use
150 ; GCN-NOT: s_xnor_b32
154 define i32 @vector_xor_na_b_i32_one_use(i32 %a, i32 %b) {
161 ; GCN-LABEL: {{^}}vector_xor_a_nb_i32_one_use
162 ; GCN-NOT: s_xnor_b32
166 define i32 @vector_xor_a_nb_i32_one_use(i32 %a, i32 %b) {
173 ; GCN-LABEL: {{^}}scalar_xor_a_nb_i64_one_use
175 define amdgpu_kernel void @scalar_xor_a_nb_i64_one_use(
176 ptr addrspace(1) %r0, i64 %a, i64 %b) {
179 %r0.val = xor i64 %a, %nb
180 store i64 %r0.val, ptr addrspace(1) %r0
184 ; GCN-LABEL: {{^}}scalar_xor_na_b_i64_one_use
186 define amdgpu_kernel void @scalar_xor_na_b_i64_one_use(
187 ptr addrspace(1) %r0, i64 %a, i64 %b) {
190 %r0.val = xor i64 %na, %b
191 store i64 %r0.val, ptr addrspace(1) %r0
195 ; Function Attrs: nounwind readnone
196 declare i32 @llvm.amdgcn.workitem.id.x() #0