r185578 - Add support for TF/TC modes available on eg. PowerPC64.
Roman Divacky
rdivacky at freebsd.org
Wed Jul 3 13:48:06 PDT 2013
Author: rdivacky
Date: Wed Jul 3 15:48:06 2013
New Revision: 185578
URL: http://llvm.org/viewvc/llvm-project?rev=185578&view=rev
Log:
Add support for TF/TC modes available on eg. PowerPC64.
Modified:
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/Sema/attr-mode.c
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=185578&r1=185577&r2=185578&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Wed Jul 3 15:48:06 2013
@@ -3730,14 +3730,17 @@ static void handleModeAttr(Sema &S, Decl
NewTy = S.Context.LongDoubleTy;
break;
case 128:
- if (!IntegerMode) {
+ if (!IntegerMode && S.Context.getTargetInfo().getLongDoubleWidth() != 128) {
S.Diag(Attr.getLoc(), diag::err_unsupported_machine_mode) << Name;
return;
}
- if (OldTy->isSignedIntegerType())
- NewTy = S.Context.Int128Ty;
- else
- NewTy = S.Context.UnsignedInt128Ty;
+ if (IntegerMode) {
+ if (OldTy->isSignedIntegerType())
+ NewTy = S.Context.Int128Ty;
+ else
+ NewTy = S.Context.UnsignedInt128Ty;
+ } else
+ NewTy = S.Context.LongDoubleTy;
break;
}
Modified: cfe/trunk/test/Sema/attr-mode.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-mode.c?rev=185578&r1=185577&r2=185578&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-mode.c (original)
+++ cfe/trunk/test/Sema/attr-mode.c Wed Jul 3 15:48:06 2013
@@ -2,6 +2,8 @@
// RUN: -verify %s
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -DTEST_64BIT_X86 -fsyntax-only \
// RUN: -verify %s
+// RUN: %clang_cc1 -triple powerpc64-pc-linux-gnu -DTEST_64BIT_PPC64 -fsyntax-only \
+// RUN: -verify %s
typedef int i16_1 __attribute((mode(HI)));
int i16_1_test[sizeof(i16_1) == 2 ? 1 : -1];
@@ -56,6 +58,13 @@ void test_long_to_ui64(unsigned long lon
#elif TEST_64BIT_X86
void test_long_to_i64(long* y) { f_i64_arg(y); }
void test_long_to_ui64(unsigned long* y) { f_ui64_arg(y); }
+#elif TEST_64BIT_PPC64
+typedef float f128ibm __attribute__ ((mode (TF)));
+typedef _Complex float c128ibm __attribute__ ((mode (TC)));
+void f_ft128_arg(long double *x);
+void f_ft128_complex_arg(_Complex long double *x);
+void test_TFtype(f128ibm *a) { f_ft128_arg (a); }
+void test_TCtype(c128ibm *a) { f_ft128_complex_arg (a); }
#else
#error Unknown test architecture.
#endif
More information about the cfe-commits
mailing list