pirama created this revision.
pirama added a reviewer: kristof.beyls.
pirama added subscribers: srhines, cfe-commits.
Herald added subscribers: rengolin, aemerson.

Set alignment and width of long datatype to be 64-bits if the ARM
subtarget feature +long64 is set.

http://reviews.llvm.org/D20709

Files:
  lib/Basic/Targets.cpp
  test/CodeGen/arm-types.c

Index: test/CodeGen/arm-types.c
===================================================================
--- /dev/null
+++ test/CodeGen/arm-types.c
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -triple arm -DLONG_SIZE_AND_ALIGN=4
+// RUN: %clang_cc1 -triple arm -target-feature +long64 -DLONG_SIZE_AND_ALIGN=8
+
+_Static_assert(sizeof(long) == LONG_SIZE_AND_ALIGN, "sizeof long is wrong");
+_Static_assert(_Alignof(long) == LONG_SIZE_AND_ALIGN, "alignof long is wrong");
Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -4955,6 +4955,8 @@
         Unaligned = 0;
       } else if (Feature == "+fp16") {
         HW_FP |= HW_FP_HP;
+      } else if (Feature == "+long64") {
+        LongWidth = LongAlign = 64;
       }
     }
     HW_FP &= ~HW_FP_remove;


Index: test/CodeGen/arm-types.c
===================================================================
--- /dev/null
+++ test/CodeGen/arm-types.c
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -triple arm -DLONG_SIZE_AND_ALIGN=4
+// RUN: %clang_cc1 -triple arm -target-feature +long64 -DLONG_SIZE_AND_ALIGN=8
+
+_Static_assert(sizeof(long) == LONG_SIZE_AND_ALIGN, "sizeof long is wrong");
+_Static_assert(_Alignof(long) == LONG_SIZE_AND_ALIGN, "alignof long is wrong");
Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -4955,6 +4955,8 @@
         Unaligned = 0;
       } else if (Feature == "+fp16") {
         HW_FP |= HW_FP_HP;
+      } else if (Feature == "+long64") {
+        LongWidth = LongAlign = 64;
       }
     }
     HW_FP &= ~HW_FP_remove;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to