[clang] ed0e4c7 - [clang][ARM] Add name-mangling test for direct __fp16 arguments.

Simon Tatham via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 3 05:31:08 PDT 2020


Author: Simon Tatham
Date: 2020-08-03T13:30:50+01:00
New Revision: ed0e4c70c99d3afd87fb202ab03bda40512677e7

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

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

`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.

Reviewed By: miyuki

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

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

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/clang/test/CodeGenCXX/fp16-mangle-arg-return.cpp b/clang/test/CodeGenCXX/fp16-mangle-arg-return.cpp
new file mode 100644
index 000000000000..15214e13ad8a
--- /dev/null
+++ b/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)) {}


        


More information about the cfe-commits mailing list