r337704 - [NEON] Define half-precision vmaxnm intrinsics only when available
Ivan A. Kosarev via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 23 09:01:36 PDT 2018
Author: kosarev
Date: Mon Jul 23 09:01:35 2018
New Revision: 337704
URL: http://llvm.org/viewvc/llvm-project?rev=337704&view=rev
Log:
[NEON] Define half-precision vmaxnm intrinsics only when available
Differential Revision: https://reviews.llvm.org/D49375
Modified:
cfe/trunk/include/clang/Basic/arm_neon.td
cfe/trunk/test/Sema/arm-no-fp16.c
Modified: cfe/trunk/include/clang/Basic/arm_neon.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/arm_neon.td?rev=337704&r1=337703&r2=337704&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/arm_neon.td (original)
+++ cfe/trunk/include/clang/Basic/arm_neon.td Mon Jul 23 09:01:35 2018
@@ -1466,8 +1466,10 @@ let ArchGuard = "defined(__ARM_FEATURE_F
// Max/Min
def VMAXH : SInst<"vmax", "ddd", "hQh">;
def VMINH : SInst<"vmin", "ddd", "hQh">;
- def FMAXNMH : SInst<"vmaxnm", "ddd", "hQh">;
- def FMINNMH : SInst<"vminnm", "ddd", "hQh">;
+ let ArchGuard = "__ARM_ARCH >= 8 && defined(__ARM_FEATURE_NUMERIC_MAXMIN) && defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)" in {
+ def FMAXNMH : SInst<"vmaxnm", "ddd", "hQh">;
+ def FMINNMH : SInst<"vminnm", "ddd", "hQh">;
+ }
// Multiplication/Division
def VMULH : SOpInst<"vmul", "ddd", "hQh", OP_MUL>;
Modified: cfe/trunk/test/Sema/arm-no-fp16.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/arm-no-fp16.c?rev=337704&r1=337703&r2=337704&view=diff
==============================================================================
--- cfe/trunk/test/Sema/arm-no-fp16.c (original)
+++ cfe/trunk/test/Sema/arm-no-fp16.c Mon Jul 23 09:01:35 2018
@@ -1,4 +1,6 @@
-// RUN: %clang_cc1 -triple thumbv7-none-eabi %s -target-feature +neon -target-feature -fp16 -fsyntax-only -verify
+// RUN: %clang_cc1 -triple thumbv7-none-eabi %s -target-feature +neon \
+// RUN: -fallow-half-arguments-and-returns -target-feature -fp16 \
+// RUN: -fsyntax-only -verify
#include <arm_neon.h>
@@ -65,3 +67,19 @@ float16x4_t test_vrndx_f16(float16x4_t a
float16x8_t test_vrndxq_f16(float16x8_t a) {
return vrndxq_f16(a); // expected-warning{{implicit declaration of function 'vrndxq_f16'}} expected-error{{returning 'int' from a function with incompatible result type 'float16x8_t'}}
}
+
+float16x4_t test_vmaxnm_f16(float16x4_t a, float16x4_t b) {
+ return vmaxnm_f16(a, b); // expected-warning{{implicit declaration of function 'vmaxnm_f16'}} expected-error{{returning 'int' from a function with incompatible result type 'float16x4_t'}}
+}
+
+float16x8_t test_vmaxnmq_f16(float16x8_t a, float16x8_t b) {
+ return vmaxnmq_f16(a, b); // expected-warning{{implicit declaration of function 'vmaxnmq_f16'}} expected-error{{returning 'int' from a function with incompatible result type 'float16x8_t'}}
+}
+
+float16x4_t test_vminnm_f16(float16x4_t a, float16x4_t b) {
+ return vminnm_f16(a, b); // expected-warning{{implicit declaration of function 'vminnm_f16'}} expected-error{{returning 'int' from a function with incompatible result type 'float16x4_t'}}
+}
+
+float16x8_t test_vminnmq_f16(float16x8_t a, float16x8_t b) {
+ return vminnmq_f16(a, b); // expected-warning{{implicit declaration of function 'vminnmq_f16'}} expected-error{{returning 'int' from a function with incompatible result type 'float16x8_t'}}
+}
More information about the cfe-commits
mailing list