]> granicus.if.org Git - clang/commitdiff
[ARM] Use generic bitreverse intrinsic, rather than ARM specific rbit.
authorChad Rosier <mcrosier@codeaurora.org>
Tue, 10 Jan 2017 18:55:11 +0000 (18:55 +0000)
committerChad Rosier <mcrosier@codeaurora.org>
Tue, 10 Jan 2017 18:55:11 +0000 (18:55 +0000)
The backend already supports lowering this intrinsic to a rbit instruction.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291582 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGBuiltin.cpp
test/CodeGen/arm_acle.c
test/CodeGen/builtins-arm.c

index f297d622c332862f5c902aa014d17b2c9b760b5c..2ede1d46b3d5f38e6536872a027a29c36482342d 100644 (file)
@@ -4318,9 +4318,9 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID,
   }
 
   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) {
index 60e95e526695e4c21440b171e604b89848c67f16..b4f39bef15722ef43de90ea71be7318d8b9f94e3 100644 (file)
@@ -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);
index a385bd27546a4b56f533044beff5baa78f57ae35..0dc4c7dd77906cb96169c064ea8989922147da36 100644 (file)
@@ -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);