R600/SI: Try to fix BFE operands when moving to VALU
[oota-llvm.git] / test / CodeGen / R600 / llvm.AMDGPU.bfe.i32.ll
1 ; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
2 ; RUN: llc -march=r600 -mcpu=redwood -show-mc-encoding -verify-machineinstrs < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
3
4 declare i32 @llvm.AMDGPU.bfe.i32(i32, i32, i32) nounwind readnone
5
6 ; FUNC-LABEL: @bfe_i32_arg_arg_arg
7 ; SI: V_BFE_I32
8 ; EG: BFE_INT
9 ; EG: encoding: [{{[x0-9a-f]+,[x0-9a-f]+,[x0-9a-f]+,[x0-9a-f]+,[x0-9a-f]+}},0xac
10 define void @bfe_i32_arg_arg_arg(i32 addrspace(1)* %out, i32 %src0, i32 %src1, i32 %src2) nounwind {
11   %bfe_i32 = call i32 @llvm.AMDGPU.bfe.i32(i32 %src0, i32 %src1, i32 %src1) nounwind readnone
12   store i32 %bfe_i32, i32 addrspace(1)* %out, align 4
13   ret void
14 }
15
16 ; FUNC-LABEL: @bfe_i32_arg_arg_imm
17 ; SI: V_BFE_I32
18 ; EG: BFE_INT
19 define void @bfe_i32_arg_arg_imm(i32 addrspace(1)* %out, i32 %src0, i32 %src1) nounwind {
20   %bfe_i32 = call i32 @llvm.AMDGPU.bfe.i32(i32 %src0, i32 %src1, i32 123) nounwind readnone
21   store i32 %bfe_i32, i32 addrspace(1)* %out, align 4
22   ret void
23 }
24
25 ; FUNC-LABEL: @bfe_i32_arg_imm_arg
26 ; SI: V_BFE_I32
27 ; EG: BFE_INT
28 define void @bfe_i32_arg_imm_arg(i32 addrspace(1)* %out, i32 %src0, i32 %src2) nounwind {
29   %bfe_i32 = call i32 @llvm.AMDGPU.bfe.i32(i32 %src0, i32 123, i32 %src2) nounwind readnone
30   store i32 %bfe_i32, i32 addrspace(1)* %out, align 4
31   ret void
32 }
33
34 ; FUNC-LABEL: @bfe_i32_imm_arg_arg
35 ; SI: V_BFE_I32
36 ; EG: BFE_INT
37 define void @bfe_i32_imm_arg_arg(i32 addrspace(1)* %out, i32 %src1, i32 %src2) nounwind {
38   %bfe_i32 = call i32 @llvm.AMDGPU.bfe.i32(i32 123, i32 %src1, i32 %src2) nounwind readnone
39   store i32 %bfe_i32, i32 addrspace(1)* %out, align 4
40   ret void
41 }
42
43 ; FUNC-LABEL: @v_bfe_print_arg
44 ; SI: V_BFE_I32 v{{[0-9]+}}, v{{[0-9]+}}, 2, 8
45 define void @v_bfe_print_arg(i32 addrspace(1)* %out, i32 addrspace(1)* %src0) nounwind {
46   %load = load i32 addrspace(1)* %src0, align 4
47   %bfe_i32 = call i32 @llvm.AMDGPU.bfe.i32(i32 %load, i32 2, i32 8) nounwind readnone
48   store i32 %bfe_i32, i32 addrspace(1)* %out, align 4
49   ret void
50 }