r291582 - [ARM] Use generic bitreverse intrinsic, rather than ARM specific rbit.
Chad Rosier via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 10 10:55:11 PST 2017
Author: mcrosier
Date: Tue Jan 10 12:55:11 2017
New Revision: 291582
URL: http://llvm.org/viewvc/llvm-project?rev=291582&view=rev
Log:
[ARM] Use generic bitreverse intrinsic, rather than ARM specific rbit.
The backend already supports lowering this intrinsic to a rbit instruction.
Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/test/CodeGen/arm_acle.c
cfe/trunk/test/CodeGen/builtins-arm.c
Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=291582&r1=291581&r2=291582&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Tue Jan 10 12:55:11 2017
@@ -4318,9 +4318,9 @@ Value *CodeGenFunction::EmitARMBuiltinEx
}
if (BuiltinID == ARM::BI__builtin_arm_rbit) {
- return Builder.CreateCall(CGM.getIntrinsic(Intrinsic::arm_rbit),
- EmitScalarExpr(E->getArg(0)),
- "rbit");
+ llvm::Value *Arg = EmitScalarExpr(E->getArg(0));
+ return Builder.CreateCall(
+ CGM.getIntrinsic(Intrinsic::bitreverse, Arg->getType()), Arg, "rbit");
}
if (BuiltinID == ARM::BI__clear_cache) {
Modified: cfe/trunk/test/CodeGen/arm_acle.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm_acle.c?rev=291582&r1=291581&r2=291582&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/arm_acle.c (original)
+++ cfe/trunk/test/CodeGen/arm_acle.c Tue Jan 10 12:55:11 2017
@@ -244,22 +244,22 @@ int16_t test_revsh(int16_t t) {
}
// ARM-LABEL: test_rbit
-// AArch32: call i32 @llvm.arm.rbit
+// AArch32: call i32 @llvm.bitreverse.i32
// AArch64: call i32 @llvm.bitreverse.i32
uint32_t test_rbit(uint32_t t) {
return __rbit(t);
}
// ARM-LABEL: test_rbitl
-// AArch32: call i32 @llvm.arm.rbit
+// AArch32: call i32 @llvm.bitreverse.i32
// AArch64: call i64 @llvm.bitreverse.i64
long test_rbitl(long t) {
return __rbitl(t);
}
// ARM-LABEL: test_rbitll
-// AArch32: call i32 @llvm.arm.rbit
-// AArch32: call i32 @llvm.arm.rbit
+// AArch32: call i32 @llvm.bitreverse.i32
+// AArch32: call i32 @llvm.bitreverse.i32
// AArch64: call i64 @llvm.bitreverse.i64
uint64_t test_rbitll(uint64_t t) {
return __rbitll(t);
Modified: cfe/trunk/test/CodeGen/builtins-arm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-arm.c?rev=291582&r1=291581&r2=291582&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/builtins-arm.c (original)
+++ cfe/trunk/test/CodeGen/builtins-arm.c Tue Jan 10 12:55:11 2017
@@ -68,7 +68,7 @@ void test_barrier() {
__builtin_arm_isb(3); //CHECK: call {{.*}} @llvm.arm.isb(i32 3)
}
-// CHECK: call {{.*}} @llvm.arm.rbit(i32 %a)
+// CHECK: call {{.*}} @llvm.bitreverse.i32(i32 %a)
unsigned rbit(unsigned a) {
return __builtin_arm_rbit(a);
More information about the cfe-commits
mailing list