[PATCH] D57210: [AArch64] Make the test for rsr and rsr64 stricter

Petr Hosek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 24 17:12:46 PST 2019


phosek created this revision.
phosek added reviewers: samparker, efriedma, t.p.northover, rnk.
Herald added subscribers: cfe-commits, kristof.beyls, javed.absar.

ACLE specifies that return type for rsr and rsr64 is uint32_t and
uint64_t respectively. D56852 <https://reviews.llvm.org/D56852> change the return type of rsr64 from
unsigned long to unsigned long long which at least on Linux doesn't
match uint64_t, but the test isn't strict enough to detect that
because compiler implicitly converts unsigned long long to uint64_t,
but it breaks other uses such as printf with PRIx64 type specifier.
This change makes the test stricter enforcing that the return type
of rsr and rsr64 builtins is what is actually specified in ACLE.


Repository:
  rC Clang

https://reviews.llvm.org/D57210

Files:
  clang/test/CodeGen/builtins-arm64.c


Index: clang/test/CodeGen/builtins-arm64.c
===================================================================
--- clang/test/CodeGen/builtins-arm64.c
+++ clang/test/CodeGen/builtins-arm64.c
@@ -51,12 +51,16 @@
 // CHECK: call {{.*}} @llvm.prefetch(i8* null, i32 0, i32 3, i32 0)
 }
 
-unsigned rsr() {
+__typeof__(__builtin_arm_rsr("1:2:3:4:5")) rsr(void);
+
+uint32_t rsr() {
   // CHECK: [[V0:[%A-Za-z0-9.]+]] = call i64 @llvm.read_register.i64(metadata ![[M0:[0-9]]])
   // CHECK-NEXT: trunc i64 [[V0]] to i32
   return __builtin_arm_rsr("1:2:3:4:5");
 }
 
+__typeof__(__builtin_arm_rsr64("1:2:3:4:5")) rsr64(void);
+
 uint64_t rsr64() {
   // CHECK: call i64 @llvm.read_register.i64(metadata ![[M0:[0-9]]])
   return __builtin_arm_rsr64("1:2:3:4:5");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57210.183448.patch
Type: text/x-patch
Size: 756 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190125/bcec1feb/attachment.bin>


More information about the cfe-commits mailing list