[PATCH] D85010: [clang][ARM] Add name-mangling test for direct __fp16 arguments.

Simon Tatham via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 31 01:33:26 PDT 2020


simon_tatham created this revision.
simon_tatham added reviewers: LukeGeeson, stuij, chill, miyuki, labrinea.
Herald added subscribers: cfe-commits, danielkiss, kristof.beyls.
Herald added a project: clang.
simon_tatham requested review of this revision.

`clang/test/CodeGenCXX/fp16-mangle.cpp` tests pointers to __fp16, but
if you give the `-fallow-half-arguments-and-returns` option, then
clang can also leave an __fp16 unmodified as a function argument or
return type. This regression test checks the name-mangling of that.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85010

Files:
  clang/test/CodeGenCXX/fp16-mangle-arg-return.cpp


Index: clang/test/CodeGenCXX/fp16-mangle-arg-return.cpp
===================================================================
--- /dev/null
+++ clang/test/CodeGenCXX/fp16-mangle-arg-return.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -emit-llvm -o - -triple arm-arm-none-eabi -fallow-half-arguments-and-returns %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -triple aarch64-arm-none-eabi -fallow-half-arguments-and-returns %s | FileCheck %s
+
+// Test name-mangling of __fp16 passed directly as a function argument
+// (when that is permitted).
+
+// CHECK: define {{.*}}void @_Z13fp16_argumentDh(half %{{.*}})
+void fp16_argument(__fp16 arg) {}
+
+// Test name-mangling of __fp16 as a return type. The return type of
+// fp16_return itself isn't mentioned in the mangled name, so to test
+// this, we have to pass it a function pointer and make __fp16 the
+// return type of that.
+
+// CHECK: define {{.*}}void @_Z11fp16_returnPFDhvE(half ()* %{{.*}})
+void fp16_return(__fp16 (*func)(void)) {}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85010.282155.patch
Type: text/x-patch
Size: 998 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200731/23e1f352/attachment.bin>


More information about the cfe-commits mailing list