[llvm-commits] [llvm-gcc-4.2] r48471 - in /llvm-gcc-4.2/trunk/gcc/config/rs6000: llvm-rs6000.cpp rs6000.h
Dale Johannesen
dalej at apple.com
Mon Mar 17 15:22:06 PDT 2008
Author: johannes
Date: Mon Mar 17 17:22:06 2008
New Revision: 48471
URL: http://llvm.org/viewvc/llvm-project?rev=48471&view=rev
Log:
ppc32 structs containing a single generic vector are
passed using the sret mechanism.
Modified:
llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp
llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h
Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp?rev=48471&r1=48470&r2=48471&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp Mon Mar 17 17:22:06 2008
@@ -405,7 +405,8 @@
// Note this does not apply to long double.
// This is required for ABI correctness.
tree tType = isSingleElementStructOrArray(TreeType, true, false);
- if (tType && int_size_in_bytes(tType)==Bytes && TYPE_MODE(tType)!=TFmode)
+ if (tType && int_size_in_bytes(tType)==Bytes && TYPE_MODE(tType)!=TFmode &&
+ (TREE_CODE(tType)!=VECTOR_TYPE || Bytes==16))
return false;
return true;
@@ -430,14 +431,15 @@
const StructType *STy = dyn_cast<StructType>(Ty);
if (!STy || STy->isPacked()) return false;
- // A struct containing only a float, double or vector field, possibly with
+ // A struct containing only a float, double or Altivec field, possibly with
// some zero-length fields as well, must be passed as the field type.
- // Note this does not apply to long double.
+ // Note this does not apply to long double, nor generic vectors.
// Other single-element structs may be passed this way as well, but
// only if the type size matches the element's type size (structs that
// violate this can be created with __aligned__).
tree tType = isSingleElementStructOrArray(TreeType, true, false);
- if (tType && int_size_in_bytes(tType)==SrcSize && TYPE_MODE(tType)!=TFmode) {
+ if (tType && int_size_in_bytes(tType)==SrcSize && TYPE_MODE(tType)!=TFmode &&
+ (TREE_CODE(tType)!=VECTOR_TYPE || SrcSize==16)) {
Elts.push_back(ConvertType(tType));
return true;
}
Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h?rev=48471&r1=48470&r2=48471&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h Mon Mar 17 17:22:06 2008
@@ -3486,6 +3486,16 @@
#define LLVM_SHOULD_PASS_AGGREGATE_IN_MIXED_REGS(T, TY, E) \
llvm_rs6000_should_pass_aggregate_in_mixed_regs((T), (TY), (E))
+// Non-altivec vectors bigger than 4 bytes are returned by sret.
+#define LLVM_SHOULD_RETURN_VECTOR_AS_SHADOW(X,isBuiltin)\
+ ((!TARGET_64BIT && \
+ TREE_CODE(X) == VECTOR_TYPE && \
+ TYPE_SIZE(X) && \
+ TREE_CODE(TYPE_SIZE(X))==INTEGER_CST && \
+ TREE_INT_CST_LOW(TYPE_SIZE(X))>32 && \
+ TREE_INT_CST_LOW(TYPE_SIZE(X))!=128) \
+ ? true : false)
+
#endif /* LLVM_ABI_H */
/* LLVM LOCAL end */
More information about the llvm-commits
mailing list