summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/attr-mode.c
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2016-02-01 18:58:24 +0000
committerReid Kleckner <rnk@google.com>2016-02-01 18:58:24 +0000
commitf27e752fe888f8a8fd38d7e65854f57040a13160 (patch)
tree46991c185e2f6dd0087d3f0640fefdcef43a08fc /clang/test/Sema/attr-mode.c
parentc8620dfd270c504a8e0b5159c937e875179217f9 (diff)
downloadbcm5719-llvm-f27e752fe888f8a8fd38d7e65854f57040a13160.tar.gz
bcm5719-llvm-f27e752fe888f8a8fd38d7e65854f57040a13160.zip
Fix attribute((mode([word|unwind_word]))) for x32
Patch by H.J. Lu ``` typedef unsigned int gcc_word __attribute__((mode(word))); ``` and ``` typedef unsigned int gcc_unwind_word __attribute__((mode(unwind_word))); ``` define the largest unsigned integer types which can be stored in a general purpose register, which may not be the pointer type. For x32, they aren't pointer nor unsigned long. We should 1. Make getUnwindWordWidth and getRegisterWidth virtual, 2. Override them for x32, similar to hasInt128Type. 3. Use getRegisterWidth for __attribute__((mode(word))); This fixes PR 24706. Reviewers: rnk Differential Revision: http://reviews.llvm.org/D16779 llvm-svn: 259383
Diffstat (limited to 'clang/test/Sema/attr-mode.c')
-rw-r--r--clang/test/Sema/attr-mode.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/test/Sema/attr-mode.c b/clang/test/Sema/attr-mode.c
index 179b1819b1f..405bfb76d1a 100644
--- a/clang/test/Sema/attr-mode.c
+++ b/clang/test/Sema/attr-mode.c
@@ -4,6 +4,8 @@
// RUN: -verify %s
// RUN: %clang_cc1 -triple powerpc64-pc-linux-gnu -DTEST_64BIT_PPC64 -fsyntax-only \
// RUN: -verify %s
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnux32 -DTEST_64BIT_X86 -fsyntax-only \
+// RUN: -verify %s
typedef int i16_1 __attribute((mode(HI)));
int i16_1_test[sizeof(i16_1) == 2 ? 1 : -1];
@@ -63,8 +65,17 @@ void test_int_to_ui32(unsigned int* y) { f_ui32_arg(y); }
void test_long_to_i64(long long* y) { f_i64_arg(y); }
void test_long_to_ui64(unsigned long long* y) { f_ui64_arg(y); }
#elif TEST_64BIT_X86
+#ifdef __ILP32__
+typedef unsigned int gcc_word __attribute__((mode(word)));
+int foo[sizeof(gcc_word) == 8 ? 1 : -1];
+typedef unsigned int gcc_unwind_word __attribute__((mode(unwind_word)));
+int foo[sizeof(gcc_unwind_word) == 8 ? 1 : -1];
+void test_long_to_i64(long long* y) { f_i64_arg(y); }
+void test_long_to_ui64(unsigned long long* y) { f_ui64_arg(y); }
+#else
void test_long_to_i64(long* y) { f_i64_arg(y); }
void test_long_to_ui64(unsigned long* y) { f_ui64_arg(y); }
+#endif
typedef float f128ibm __attribute__ ((mode (TF))); // expected-error{{unsupported machine mode 'TF'}}
#elif TEST_64BIT_PPC64
typedef float f128ibm __attribute__ ((mode (TF)));
OpenPOWER on IntegriCloud