]> granicus.if.org Git - clang/commitdiff
Add support for TF/TC modes available on eg. PowerPC64.
authorRoman Divacky <rdivacky@freebsd.org>
Wed, 3 Jul 2013 20:48:06 +0000 (20:48 +0000)
committerRoman Divacky <rdivacky@freebsd.org>
Wed, 3 Jul 2013 20:48:06 +0000 (20:48 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185578 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclAttr.cpp
test/Sema/attr-mode.c

index a254caeff75195ced4f009e533c3cd587a65d436..e1fead3d4c2fd5a23dcfab140e2ab555638f0903 100644 (file)
@@ -3730,14 +3730,17 @@ static void handleModeAttr(Sema &S, Decl *D, const AttributeList &Attr) {
     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;
   }
 
index a89c8397e0a04d173d8272d9888e34135beed19a..0b28532eeee65c61f352b7e3ae7ab7e5e31f2170 100644 (file)
@@ -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 long* y) { f_ui64_arg(y); }
 #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