forked from OSchip/llvm-project
GlobalISel: Add G_BITREVERSE
This is the first failing pattern for AMDGPU and is trivial to handle. llvm-svn: 370927
This commit is contained in:
parent
5afc5a6c1b
commit
70becc20fa
|
@ -560,6 +560,9 @@ HANDLE_TARGET_OPCODE(G_CTPOP)
|
|||
/// Generic byte swap.
|
||||
HANDLE_TARGET_OPCODE(G_BSWAP)
|
||||
|
||||
/// Generic bit reverse.
|
||||
HANDLE_TARGET_OPCODE(G_BITREVERSE)
|
||||
|
||||
/// Floating point ceil.
|
||||
HANDLE_TARGET_OPCODE(G_FCEIL)
|
||||
|
||||
|
|
|
@ -171,6 +171,12 @@ def G_BSWAP : GenericInstruction {
|
|||
let hasSideEffects = 0;
|
||||
}
|
||||
|
||||
def G_BITREVERSE : GenericInstruction {
|
||||
let OutOperandList = (outs type0:$dst);
|
||||
let InOperandList = (ins type0:$src);
|
||||
let hasSideEffects = 0;
|
||||
}
|
||||
|
||||
def G_ADDRSPACE_CAST : GenericInstruction {
|
||||
let OutOperandList = (outs type0:$dst);
|
||||
let InOperandList = (ins type1:$src);
|
||||
|
|
|
@ -90,6 +90,7 @@ def : GINodeEquiv<G_INTRINSIC_W_SIDE_EFFECTS, intrinsic_void>;
|
|||
def : GINodeEquiv<G_INTRINSIC_W_SIDE_EFFECTS, intrinsic_w_chain>;
|
||||
def : GINodeEquiv<G_BR, br>;
|
||||
def : GINodeEquiv<G_BSWAP, bswap>;
|
||||
def : GINodeEquiv<G_BITREVERSE, bitreverse>;
|
||||
def : GINodeEquiv<G_CTLZ, ctlz>;
|
||||
def : GINodeEquiv<G_CTTZ, cttz>;
|
||||
def : GINodeEquiv<G_CTLZ_ZERO_UNDEF, ctlz_zero_undef>;
|
||||
|
|
|
@ -1194,6 +1194,8 @@ unsigned IRTranslator::getSimpleIntrinsicOpcode(Intrinsic::ID ID) {
|
|||
break;
|
||||
case Intrinsic::bswap:
|
||||
return TargetOpcode::G_BSWAP;
|
||||
case Intrinsic::bitreverse:
|
||||
return TargetOpcode::G_BITREVERSE;
|
||||
case Intrinsic::ceil:
|
||||
return TargetOpcode::G_FCEIL;
|
||||
case Intrinsic::cos:
|
||||
|
|
|
@ -1394,6 +1394,16 @@ define i32 @test_ctpop_intrinsic(i32 %a) {
|
|||
ret i32 %res
|
||||
}
|
||||
|
||||
declare i32 @llvm.bitreverse.i32(i32)
|
||||
define i32 @test_bitreverse_intrinsic(i32 %a) {
|
||||
; CHECK-LABEL: name: test_bitreverse
|
||||
; CHECK: [[A:%[0-9]+]]:_(s32) = COPY $w0
|
||||
; CHECK: [[RES:%[0-9]+]]:_(s32) = G_BITREVERSE [[A]]
|
||||
; CHECK: $w0 = COPY [[RES]]
|
||||
%res = call i32 @llvm.bitreverse.i32(i32 %a)
|
||||
ret i32 %res
|
||||
}
|
||||
|
||||
declare void @llvm.lifetime.start.p0i8(i64, i8*)
|
||||
declare void @llvm.lifetime.end.p0i8(i64, i8*)
|
||||
define void @test_lifetime_intrin() {
|
||||
|
|
|
@ -446,6 +446,9 @@
|
|||
# DEBUG-NEXT: G_BSWAP (opcode {{[0-9]+}}): 1 type index, 0 imm indices
|
||||
# DEBUG-NEXT: .. the first uncovered type index: 1, OK
|
||||
# DEBUG-NEXT: .. the first uncovered imm index: 0, OK
|
||||
# DEBUG-NEXT: G_BITREVERSE (opcode {{[0-9]+}}): 1 type index, 0 imm indices
|
||||
# DEBUG-NEXT: .. type index coverage check SKIPPED: no rules defined
|
||||
# DEBUG-NEXT: .. imm index coverage check SKIPPED: no rules defined
|
||||
# DEBUG-NEXT: G_FCEIL (opcode {{[0-9]+}}): 1 type index, 0 imm indices
|
||||
# DEBUG-NEXT: .. type index coverage check SKIPPED: user-defined predicate detected
|
||||
# DEBUG-NEXT: .. imm index coverage check SKIPPED: user-defined predicate detected
|
||||
|
|
Loading…
Reference in New Issue