[llvm-branch-commits] [cfe-branch] r168313 - in /cfe/branches/release_32: lib/Basic/Targets.cpp lib/CodeGen/CGExpr.cpp test/CodeGen/ppc-atomics.c
Benjamin Kramer
benny.kra at googlemail.com
Mon Nov 19 09:32:14 PST 2012
Author: d0k
Date: Mon Nov 19 11:32:14 2012
New Revision: 168313
URL: http://llvm.org/viewvc/llvm-project?rev=168313&view=rev
Log:
Merge r168260 from trunk:
Enable inlining of 4 byte atomic ops on ppc32, 8 byte atomic ops on ppc64.
Also fixes a bit/byte mismatch when checking if a target supports atomic ops
of a certain size.
Added:
cfe/branches/release_32/test/CodeGen/ppc-atomics.c
- copied unchanged from r168260, cfe/trunk/test/CodeGen/ppc-atomics.c
Modified:
cfe/branches/release_32/lib/Basic/Targets.cpp
cfe/branches/release_32/lib/CodeGen/CGExpr.cpp
Modified: cfe/branches/release_32/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_32/lib/Basic/Targets.cpp?rev=168313&r1=168312&r2=168313&view=diff
==============================================================================
--- cfe/branches/release_32/lib/Basic/Targets.cpp (original)
+++ cfe/branches/release_32/lib/Basic/Targets.cpp Mon Nov 19 11:32:14 2012
@@ -1037,6 +1037,9 @@
LongDoubleWidth = LongDoubleAlign = 64;
LongDoubleFormat = &llvm::APFloat::IEEEdouble;
}
+
+ // PPC32 supports atomics up to 4 bytes.
+ MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32;
}
virtual BuiltinVaListKind getBuiltinVaListKind() const {
@@ -1065,7 +1068,9 @@
DescriptionString = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-"
"i64:64:64-f32:32:32-f64:64:64-f128:128:128-"
"v128:128:128-n32:64";
-
+
+ // PPC64 supports atomics up to 8 bytes.
+ MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
}
virtual BuiltinVaListKind getBuiltinVaListKind() const {
return TargetInfo::CharPtrBuiltinVaList;
Modified: cfe/branches/release_32/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_32/lib/CodeGen/CGExpr.cpp?rev=168313&r1=168312&r2=168313&view=diff
==============================================================================
--- cfe/branches/release_32/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/branches/release_32/lib/CodeGen/CGExpr.cpp Mon Nov 19 11:32:14 2012
@@ -3164,11 +3164,10 @@
uint64_t Size = sizeChars.getQuantity();
CharUnits alignChars = getContext().getTypeAlignInChars(AtomicTy);
unsigned Align = alignChars.getQuantity();
- unsigned MaxInlineWidth =
- getContext().getTargetInfo().getMaxAtomicInlineWidth();
- bool UseLibcall = (Size != Align || Size > MaxInlineWidth);
-
-
+ unsigned MaxInlineWidthInBits =
+ getContext().getTargetInfo().getMaxAtomicInlineWidth();
+ bool UseLibcall = (Size != Align ||
+ getContext().toBits(sizeChars) > MaxInlineWidthInBits);
llvm::Value *Ptr, *Order, *OrderFail = 0, *Val1 = 0, *Val2 = 0;
Ptr = EmitScalarExpr(E->getPtr());
More information about the llvm-branch-commits
mailing list