1; RUN: llc -march=amdgcn -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
2; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
3; RUN: llc -march=r600 -mcpu=redwood -verify-machineinstrs < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
4
5declare i32 @llvm.AMDGPU.bfm(i32, i32) nounwind readnone
6
7; FUNC-LABEL: {{^}}bfm_arg_arg:
8; SI: v_bfm
9; EG: BFM_INT
10define void @bfm_arg_arg(i32 addrspace(1)* %out, i32 %src0, i32 %src1) nounwind {
11  %bfm = call i32 @llvm.AMDGPU.bfm(i32 %src0, i32 %src1) nounwind readnone
12  store i32 %bfm, i32 addrspace(1)* %out, align 4
13  ret void
14}
15
16; FUNC-LABEL: {{^}}bfm_arg_imm:
17; SI: v_bfm
18; EG: BFM_INT
19define void @bfm_arg_imm(i32 addrspace(1)* %out, i32 %src0) nounwind {
20  %bfm = call i32 @llvm.AMDGPU.bfm(i32 %src0, i32 123) nounwind readnone
21  store i32 %bfm, i32 addrspace(1)* %out, align 4
22  ret void
23}
24
25; FUNC-LABEL: {{^}}bfm_imm_arg:
26; SI: v_bfm
27; EG: BFM_INT
28define void @bfm_imm_arg(i32 addrspace(1)* %out, i32 %src1) nounwind {
29  %bfm = call i32 @llvm.AMDGPU.bfm(i32 123, i32 %src1) nounwind readnone
30  store i32 %bfm, i32 addrspace(1)* %out, align 4
31  ret void
32}
33
34; FUNC-LABEL: {{^}}bfm_imm_imm:
35; SI: v_bfm
36; EG: BFM_INT
37define void @bfm_imm_imm(i32 addrspace(1)* %out) nounwind {
38  %bfm = call i32 @llvm.AMDGPU.bfm(i32 123, i32 456) nounwind readnone
39  store i32 %bfm, i32 addrspace(1)* %out, align 4
40  ret void
41}
42