]> granicus.if.org Git - clang/commitdiff
Add getOpenMPSimdDefaultAlignment for PowerPC
authorHal Finkel <hfinkel@anl.gov>
Fri, 3 Oct 2014 17:45:20 +0000 (17:45 +0000)
committerHal Finkel <hfinkel@anl.gov>
Fri, 3 Oct 2014 17:45:20 +0000 (17:45 +0000)
When the aligned clause of an OpenMP simd pragma is not provided with an
explicit alignment, a target-dependent default must be used. This adds such a
default of PPC targets.

This will become slightly more complicated when BG/Q support is added (because
then it will depend on the type). For now, 16 is a correct value for all
systems, and covers Altivec and VSX vectors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218994 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/TargetInfo.cpp
test/OpenMP/simd_metadata.c

index 49c6626cf2eeb82624dfa68577e150ad45d45520..f78c2d04073191d645851c55c7aeb83d25e7657b 100644 (file)
@@ -2974,6 +2974,10 @@ public:
 
   bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
                                llvm::Value *Address) const override;
+
+  unsigned getOpenMPSimdDefaultAlignment(QualType) const override {
+    return 16; // Natural alignment for Altivec vectors.
+  }
 };
 
 }
@@ -3090,6 +3094,10 @@ public:
 
   bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
                                llvm::Value *Address) const override;
+
+  unsigned getOpenMPSimdDefaultAlignment(QualType) const override {
+    return 16; // Natural alignment for Altivec and VSX vectors.
+  }
 };
 
 class PPC64TargetCodeGenInfo : public DefaultTargetCodeGenInfo {
@@ -3103,6 +3111,10 @@ public:
 
   bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
                                llvm::Value *Address) const override;
+
+  unsigned getOpenMPSimdDefaultAlignment(QualType) const override {
+    return 16; // Natural alignment for Altivec vectors.
+  }
 };
 
 }
index cc2e19d5dd97220dea0338f7e03ea883a7dfb67d..9879d84e62a25d05da47c440beb12e8cc5925549 100644 (file)
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -fopenmp=libiomp5 -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -fopenmp=libiomp5 -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck %s
 
 void h1(float *c, float *a, double b[], int size)
 {