[clang] dba8fce - Fix frint ACLE intrinsic names

Michael Platings via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 29 01:14:35 PDT 2022


Author: Michael Platings
Date: 2022-09-29T09:13:07+01:00
New Revision: dba8fced969e2eca9e8650a874293927db17d131

URL: https://github.com/llvm/llvm-project/commit/dba8fced969e2eca9e8650a874293927db17d131
DIFF: https://github.com/llvm/llvm-project/commit/dba8fced969e2eca9e8650a874293927db17d131.diff

LOG: Fix frint ACLE intrinsic names

Although the instruction names begin "frint", the ACLE spec states that
the intrinsic names begin "__rint", without the "f".

Differential Revision: https://reviews.llvm.org/D134824

Added: 
    

Modified: 
    clang/include/clang/Basic/BuiltinsAArch64.def
    clang/lib/CodeGen/CGBuiltin.cpp
    clang/lib/Headers/arm_acle.h
    clang/test/CodeGen/aarch64-v8.5a-scalar-frint3264-intrinsic.c

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Basic/BuiltinsAArch64.def b/clang/include/clang/Basic/BuiltinsAArch64.def
index 3c0a5f12681d0..036df7435bfba 100644
--- a/clang/include/clang/Basic/BuiltinsAArch64.def
+++ b/clang/include/clang/Basic/BuiltinsAArch64.def
@@ -107,14 +107,14 @@ BUILTIN(__builtin_arm_tcancel, "vWUIi", "n")
 BUILTIN(__builtin_arm_ttest, "WUi", "nc")
 
 // Armv8.5-A FP rounding intrinsics
-BUILTIN(__builtin_arm_frint32zf, "ff", "")
-BUILTIN(__builtin_arm_frint32z, "dd", "")
-BUILTIN(__builtin_arm_frint64zf, "ff", "")
-BUILTIN(__builtin_arm_frint64z, "dd", "")
-BUILTIN(__builtin_arm_frint32xf, "ff", "")
-BUILTIN(__builtin_arm_frint32x, "dd", "")
-BUILTIN(__builtin_arm_frint64xf, "ff", "")
-BUILTIN(__builtin_arm_frint64x, "dd", "")
+BUILTIN(__builtin_arm_rint32zf, "ff", "")
+BUILTIN(__builtin_arm_rint32z, "dd", "")
+BUILTIN(__builtin_arm_rint64zf, "ff", "")
+BUILTIN(__builtin_arm_rint64z, "dd", "")
+BUILTIN(__builtin_arm_rint32xf, "ff", "")
+BUILTIN(__builtin_arm_rint32x, "dd", "")
+BUILTIN(__builtin_arm_rint64xf, "ff", "")
+BUILTIN(__builtin_arm_rint64x, "dd", "")
 
 // Armv8.5-A Random number generation intrinsics
 BUILTIN(__builtin_arm_rndr,   "iWUi*", "n")

diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 2d8b0175e2ffa..786ed8c5935f9 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -9538,32 +9538,32 @@ Value *CodeGenFunction::EmitAArch64BuiltinExpr(unsigned BuiltinID,
                               "cls");
   }
 
-  if (BuiltinID == clang::AArch64::BI__builtin_arm_frint32zf ||
-      BuiltinID == clang::AArch64::BI__builtin_arm_frint32z) {
+  if (BuiltinID == clang::AArch64::BI__builtin_arm_rint32zf ||
+      BuiltinID == clang::AArch64::BI__builtin_arm_rint32z) {
     llvm::Value *Arg = EmitScalarExpr(E->getArg(0));
     llvm::Type *Ty = Arg->getType();
     return Builder.CreateCall(CGM.getIntrinsic(Intrinsic::aarch64_frint32z, Ty),
                               Arg, "frint32z");
   }
 
-  if (BuiltinID == clang::AArch64::BI__builtin_arm_frint64zf ||
-      BuiltinID == clang::AArch64::BI__builtin_arm_frint64z) {
+  if (BuiltinID == clang::AArch64::BI__builtin_arm_rint64zf ||
+      BuiltinID == clang::AArch64::BI__builtin_arm_rint64z) {
     llvm::Value *Arg = EmitScalarExpr(E->getArg(0));
     llvm::Type *Ty = Arg->getType();
     return Builder.CreateCall(CGM.getIntrinsic(Intrinsic::aarch64_frint64z, Ty),
                               Arg, "frint64z");
   }
 
-  if (BuiltinID == clang::AArch64::BI__builtin_arm_frint32xf ||
-      BuiltinID == clang::AArch64::BI__builtin_arm_frint32x) {
+  if (BuiltinID == clang::AArch64::BI__builtin_arm_rint32xf ||
+      BuiltinID == clang::AArch64::BI__builtin_arm_rint32x) {
     llvm::Value *Arg = EmitScalarExpr(E->getArg(0));
     llvm::Type *Ty = Arg->getType();
     return Builder.CreateCall(CGM.getIntrinsic(Intrinsic::aarch64_frint32x, Ty),
                               Arg, "frint32x");
   }
 
-  if (BuiltinID == clang::AArch64::BI__builtin_arm_frint64xf ||
-      BuiltinID == clang::AArch64::BI__builtin_arm_frint64x) {
+  if (BuiltinID == clang::AArch64::BI__builtin_arm_rint64xf ||
+      BuiltinID == clang::AArch64::BI__builtin_arm_rint64x) {
     llvm::Value *Arg = EmitScalarExpr(E->getArg(0));
     llvm::Type *Ty = Arg->getType();
     return Builder.CreateCall(CGM.getIntrinsic(Intrinsic::aarch64_frint64x, Ty),

diff  --git a/clang/lib/Headers/arm_acle.h b/clang/lib/Headers/arm_acle.h
index fc347f760d828..ed3fc1de1fd40 100644
--- a/clang/lib/Headers/arm_acle.h
+++ b/clang/lib/Headers/arm_acle.h
@@ -642,43 +642,43 @@ __jcvt(double __a) {
 /* Armv8.5-A FP rounding intrinsics */
 #if defined(__ARM_64BIT_STATE) && __ARM_64BIT_STATE && defined(__ARM_FEATURE_FRINT)
 static __inline__ float __attribute__((__always_inline__, __nodebug__))
-__frint32zf(float __a) {
-  return __builtin_arm_frint32zf(__a);
+__rint32zf(float __a) {
+  return __builtin_arm_rint32zf(__a);
 }
 
 static __inline__ double __attribute__((__always_inline__, __nodebug__))
-__frint32z(double __a) {
-  return __builtin_arm_frint32z(__a);
+__rint32z(double __a) {
+  return __builtin_arm_rint32z(__a);
 }
 
 static __inline__ float __attribute__((__always_inline__, __nodebug__))
-__frint64zf(float __a) {
-  return __builtin_arm_frint64zf(__a);
+__rint64zf(float __a) {
+  return __builtin_arm_rint64zf(__a);
 }
 
 static __inline__ double __attribute__((__always_inline__, __nodebug__))
-__frint64z(double __a) {
-  return __builtin_arm_frint64z(__a);
+__rint64z(double __a) {
+  return __builtin_arm_rint64z(__a);
 }
 
 static __inline__ float __attribute__((__always_inline__, __nodebug__))
-__frint32xf(float __a) {
-  return __builtin_arm_frint32xf(__a);
+__rint32xf(float __a) {
+  return __builtin_arm_rint32xf(__a);
 }
 
 static __inline__ double __attribute__((__always_inline__, __nodebug__))
-__frint32x(double __a) {
-  return __builtin_arm_frint32x(__a);
+__rint32x(double __a) {
+  return __builtin_arm_rint32x(__a);
 }
 
 static __inline__ float __attribute__((__always_inline__, __nodebug__))
-__frint64xf(float __a) {
-  return __builtin_arm_frint64xf(__a);
+__rint64xf(float __a) {
+  return __builtin_arm_rint64xf(__a);
 }
 
 static __inline__ double __attribute__((__always_inline__, __nodebug__))
-__frint64x(double __a) {
-  return __builtin_arm_frint64x(__a);
+__rint64x(double __a) {
+  return __builtin_arm_rint64x(__a);
 }
 #endif
 

diff  --git a/clang/test/CodeGen/aarch64-v8.5a-scalar-frint3264-intrinsic.c b/clang/test/CodeGen/aarch64-v8.5a-scalar-frint3264-intrinsic.c
index b57e921871294..9d9103707bd28 100644
--- a/clang/test/CodeGen/aarch64-v8.5a-scalar-frint3264-intrinsic.c
+++ b/clang/test/CodeGen/aarch64-v8.5a-scalar-frint3264-intrinsic.c
@@ -7,58 +7,58 @@
 
 #include <arm_acle.h>
 
-// CHECK-LABEL: test_frint32zf
+// CHECK-LABEL: test_rint32zf
 // CHECK:  [[RND:%.*]] =  call float @llvm.aarch64.frint32z.f32(float %a)
 // CHECK:  ret float [[RND]]
-float test_frint32zf(float a) {
-  return __frint32zf(a);
+float test_rint32zf(float a) {
+  return __rint32zf(a);
 }
 
-// CHECK-LABEL: test_frint32z
+// CHECK-LABEL: test_rint32z
 // CHECK:  [[RND:%.*]] =  call double @llvm.aarch64.frint32z.f64(double %a)
 // CHECK:  ret double [[RND]]
-double test_frint32z(double a) {
-  return __frint32z(a);
+double test_rint32z(double a) {
+  return __rint32z(a);
 }
 
-// CHECK-LABEL: test_frint64zf
+// CHECK-LABEL: test_rint64zf
 // CHECK:  [[RND:%.*]] =  call float @llvm.aarch64.frint64z.f32(float %a)
 // CHECK:  ret float [[RND]]
-float test_frint64zf(float a) {
-  return __frint64zf(a);
+float test_rint64zf(float a) {
+  return __rint64zf(a);
 }
 
-// CHECK-LABEL: test_frint64z
+// CHECK-LABEL: test_rint64z
 // CHECK:  [[RND:%.*]] =  call double @llvm.aarch64.frint64z.f64(double %a)
 // CHECK:  ret double [[RND]]
-double test_frint64z(double a) {
-  return __frint64z(a);
+double test_rint64z(double a) {
+  return __rint64z(a);
 }
 
-// CHECK-LABEL: test_frint32xf
+// CHECK-LABEL: test_rint32xf
 // CHECK:  [[RND:%.*]] =  call float @llvm.aarch64.frint32x.f32(float %a)
 // CHECK:  ret float [[RND]]
-float test_frint32xf(float a) {
-  return __frint32xf(a);
+float test_rint32xf(float a) {
+  return __rint32xf(a);
 }
 
-// CHECK-LABEL: test_frint32x
+// CHECK-LABEL: test_rint32x
 // CHECK:  [[RND:%.*]] =  call double @llvm.aarch64.frint32x.f64(double %a)
 // CHECK:  ret double [[RND]]
-double test_frint32x(double a) {
-  return __frint32x(a);
+double test_rint32x(double a) {
+  return __rint32x(a);
 }
 
-// CHECK-LABEL: test_frint64xf
+// CHECK-LABEL: test_rint64xf
 // CHECK:  [[RND:%.*]] =  call float @llvm.aarch64.frint64x.f32(float %a)
 // CHECK:  ret float [[RND]]
-float test_frint64xf(float a) {
-  return __frint64xf(a);
+float test_rint64xf(float a) {
+  return __rint64xf(a);
 }
 
-// CHECK-LABEL: test_frint64x
+// CHECK-LABEL: test_rint64x
 // CHECK:  [[RND:%.*]] =  call double @llvm.aarch64.frint64x.f64(double %a)
 // CHECK:  ret double [[RND]]
-double test_frint64x(double a) {
-  return __frint64x(a);
+double test_rint64x(double a) {
+  return __rint64x(a);
 }


        


More information about the cfe-commits mailing list