summaryrefslogtreecommitdiff
path: root/test/Sema
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2019-09-09 17:48:05 +0000
committerCraig Topper <craig.topper@intel.com>2019-09-09 17:48:05 +0000
commitbe0512174749830dec1b57e24e139514279cb30e (patch)
treec3ee85d2e0ed8c8c415021a1669c0ffb5ebdec90 /test/Sema
parentdf4be6a74738a169cea26d97ef2fb0cf2e546413 (diff)
downloadclang-be0512174749830dec1b57e24e139514279cb30e.tar.gz
[X86] Allow _MM_FROUND_CUR_DIRECTION and _MM_FROUND_NO_EXC to be used together on instructions that only support SAE and not embedded rounding.
Current for SAE instructions we only allow _MM_FROUND_CUR_DIRECTION(bit 2) or _MM_FROUND_NO_EXC(bit 3) to be used as the immediate passed to the inrinsics. But these instructions don't perform rounding so _MM_FROUND_CUR_DIRECTION is just sort of a default placeholder when you don't want to suppress exceptions. Using _MM_FROUND_NO_EXC by itself is really bit equivalent to (_MM_FROUND_NO_EXC | _MM_FROUND_TO_NEAREST_INT) since _MM_FROUND_TO_NEAREST_INT is 0. Since we aren't rounding on these instructions we should also accept (_MM_FROUND_CUR_DIRECTION | _MM_FROUND_NO_EXC) as equivalent to (_MM_FROUND_NO_EXC). icc allows this, but gcc does not. Differential Revision: https://reviews.llvm.org/D67289 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371430 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema')
-rw-r--r--test/Sema/builtins-x86.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/Sema/builtins-x86.c b/test/Sema/builtins-x86.c
index 6a2a47d779..dca0bdc720 100644
--- a/test/Sema/builtins-x86.c
+++ b/test/Sema/builtins-x86.c
@@ -81,6 +81,19 @@ __mmask16 test__builtin_ia32_cmpps512_mask_rounding(__m512 __a, __m512 __b, __mm
return __builtin_ia32_cmpps512_mask(__a, __b, 0, __u, 0); // expected-error {{invalid rounding argument}}
}
+// Make sure we allow 4(CUR_DIRECTION), 8(NO_EXC), and 12(CUR_DIRECTION|NOEXC) for SAE arguments.
+__mmask16 test__builtin_ia32_cmpps512_mask_rounding_cur_dir(__m512 __a, __m512 __b, __mmask16 __u) {
+ return __builtin_ia32_cmpps512_mask(__a, __b, 0, __u, 4); // no-error
+}
+
+__mmask16 test__builtin_ia32_cmpps512_mask_rounding_sae1(__m512 __a, __m512 __b, __mmask16 __u) {
+ return __builtin_ia32_cmpps512_mask(__a, __b, 0, __u, 8); // no-error
+}
+
+__mmask16 test__builtin_ia32_cmpps512_mask_rounding_sae2(__m512 __a, __m512 __b, __mmask16 __u) {
+ return __builtin_ia32_cmpps512_mask(__a, __b, 0, __u, 12); // no-error
+}
+
__m512 test__builtin_ia32_getmantps512_mask(__m512 a, __m512 b) {
return __builtin_ia32_getmantps512_mask(a, 0, b, (__mmask16)-1, 10); // expected-error {{invalid rounding argument}}
}