Re: r253269 - Make FP_CONTRACT ON the default.

2016-09-06 Thread Stephen Canon via cfe-commits
Yes, we should, I just haven’t had time to deal with it.  If someone else wants 
to pick it up, feel free.  Otherwise, I’ll be able to get to it in another 
couple weeks.

> On Sep 6, 2016, at 12:14 PM, Hal Finkel  wrote:
> 
> Hi Steve, et al.,
> 
> It looks like this crasher was fixed in r254573. Should we move forward with 
> recommitting this now?
> 
> Thanks again,
> Hal
> 
> - Original Message -
>> From: "Manuel Klimek" 
>> To: "Hal Finkel" , "Renato Golin" 
>> Cc: "Clang Commits" 
>> Sent: Tuesday, November 17, 2015 9:47:11 AM
>> Subject: Re: r253269 - Make FP_CONTRACT ON the default.
>> 
>> 
>> Reverted in r253337. Failing test case in commit message.
>> 
>> 
>> 
>> On Tue, Nov 17, 2015 at 4:39 PM Manuel Klimek < kli...@google.com >
>> wrote:
>> 
>> Repro:
>> float foo(float U, float base, float cell) { return (U = 2 * base) -
>> cell; }
>> Preparing rollback of the CL.
>> 
>> 
>> On Tue, Nov 17, 2015 at 2:46 PM Manuel Klimek < kli...@google.com >
>> wrote:
>> 
>> 
>> 
>> Note that due to this change we're hitting an assert at
>> lib/CodeGen/CGExprScalar.cpp:2570 in llvm::Value
>> *tryEmitFMulAdd(const (anonymous namespace)::BinOpInfo &, const
>> clang::CodeGen::CodeGenFunction &, clang::CodeGen::CGBuilderTy &,
>> bool): LHSBinOp->getNumUses(
>> ) == 0 && "Operations with multiple uses shouldn't be contracted."
>> 
>> 
>> Don't have a small repro yet :(
>> 
>> 
>> On Tue, Nov 17, 2015 at 1:39 PM Hal Finkel via cfe-commits <
>> cfe-commits@lists.llvm.org > wrote:
>> 
>> 
>> - Original Message -
>>> From: "Renato Golin via cfe-commits" < cfe-commits@lists.llvm.org >
>>> To: "Stephen Canon" < sca...@apple.com >
>>> Cc: "Clang Commits" < cfe-commits@lists.llvm.org >
>>> Sent: Tuesday, November 17, 2015 3:51:23 AM
>>> Subject: Re: r253269 - Make FP_CONTRACT ON the default.
>>> 
>>> On 16 November 2015 at 23:09, Stephen Canon via cfe-commits
>>> < cfe-commits@lists.llvm.org > wrote:
>>>> Author: scanon
>>>> Date: Mon Nov 16 17:09:11 2015
>>>> New Revision: 253269
>>>> 
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=253269&view=rev
>>>> Log:
>>>> Make FP_CONTRACT ON the default.
>>>> 
>>>> Differential Revision: D14200
>>> 
>>> Hi Stephen,
>>> 
>>> It seems your commit in the blame list is the only one that affects
>>> AArch64 directly:
>>> 
>>> http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/2388
>>> 
>>> I haven't bisected yet, but would be good if you could try those
>>> tests
>>> locally, just to make sure it wasn't your commit, and revert if it
>>> was, to fix offline.
>> 
>> The test suite already has logic to add -ffp-contract=off on PowerPC
>> so that we can compare to the binary outputs. We may need to do this
>> now for all targets, at least until be come up with a better
>> solution.
>> 
>> -Hal
>> 
>>> 
>>> cheers,
>>> --renato
>>> ___
>>> cfe-commits mailing list
>>> cfe-commits@lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>> 
>> 
>> --
>> Hal Finkel
>> Assistant Computational Scientist
>> Leadership Computing Facility
>> Argonne National Laboratory
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>> 
> 
> -- 
> Hal Finkel
> Assistant Computational Scientist
> Leadership Computing Facility
> Argonne National Laboratory

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r286815 - Improve handling of floating point literals in OpenCL to only use double precision if the target supports fp64.

2016-11-15 Thread Stephen Canon via cfe-commits
The reason these commits bring it up is that I don’t see it clearly documented 
whether:

float x = 340282356779733661637539395458142568447.0;

is interpreted as

float x = 340282356779733661637539395458142568447.0f; // x is FLT_MAX

or as

float x = (float)(340282356779733661637539395458142568447.0); // x is 
INFINITY

when the no-fp64 mode is active.  I assume that only one of these is the 
correct behavior, and we should have a regression test that will flag the error 
if it changes.

– Steve

> On Nov 15, 2016, at 4:51 AM, Neil Hickey  wrote:
> 
> It would be valuable to perform that test, if clang tests don't already do 
> this, though I'm not sure it should be part of this particular commit as all 
> this commit should do is change the casts if the target doesn't support 
> double.
> 
> Neil
> 
>> -Original Message-
>> From: sca...@apple.com [mailto:sca...@apple.com]
>> Sent: 14 November 2016 16:01
>> To: Neil Hickey
>> Cc: cfe-commits@lists.llvm.org
>> Subject: Re: r286815 - Improve handling of floating point literals in OpenCL 
>> to
>> only use double precision if the target supports fp64.
>> 
>> Can you add some non-trivial test cases that exercise double-rounding,
>> especially near the overflow boundary?
>> 
>> e.g. What is the expected value of x if the target does not support fp64?:
>> 
>>  float x = 340282356779733661637539395458142568447.0;
>> 
>> – Steve
>> 
>>> On Nov 14, 2016, at 6:15 AM, Neil Hickey via cfe-commits > comm...@lists.llvm.org> wrote:
>>> 
>>> Author: neil.hickey
>>> Date: Mon Nov 14 05:15:51 2016
>>> New Revision: 286815
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=286815&view=rev
>>> Log:
>>> Improve handling of floating point literals in OpenCL to only use double
>> precision if the target supports fp64.
>>> 
>>> This change makes sure single-precision floating point types are used
>>> if the
>>> cl_fp64 extension is not supported by the target.
>>> 
>>> Also removed the check to see whether the OpenCL version is >= 1.2, as
>>> this has been incorporated into the extension setting code.
>>> 
>>> Differential Revision: https://reviews.llvm.org/D24235
>>> 
>>> 
>>> Modified:
>>>  cfe/trunk/lib/Sema/SemaExpr.cpp
>>>  cfe/trunk/lib/Sema/SemaType.cpp
>>>  cfe/trunk/test/CodeGenOpenCL/fpmath.cl
>>>  cfe/trunk/test/SemaOpenCL/extensions.cl
>>> 
>>> Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?re
>>> v=286815&r1=286814&r2=286815&view=diff
>>> 
>> ==
>> 
>>> 
>>> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
>>> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Nov 14 05:15:51 2016
>>> @@ -705,9 +705,13 @@ ExprResult Sema::DefaultLvalueConversion  if
>>> (getLangOpts().ObjCAutoRefCount &&
>>> E->getType().getObjCLifetime() == Qualifiers::OCL_Weak)
>>>   Cleanup.setExprNeedsCleanups(true);
>>> +
>>> +  ExprResult Res = E;
>>> 
>>> -  ExprResult Res = ImplicitCastExpr::Create(Context, T,
>> CK_LValueToRValue, E,
>>> -nullptr, VK_RValue);
>>> +  if ( T != E->getType()) {
>>> +Res = ImplicitCastExpr::Create(Context, T, CK_LValueToRValue, E,
>>> +   nullptr, VK_RValue);  }
>>> 
>>> // C11 6.3.2.1p2:
>>> //   ... if the lvalue has atomic type, the value has the non-atomic version
>>> @@ -817,8 +821,16 @@ ExprResult Sema::DefaultArgumentPromotio  //
>>> double.
>>> const BuiltinType *BTy = Ty->getAs();  if (BTy &&
>>> (BTy->getKind() == BuiltinType::Half ||
>>> -  BTy->getKind() == BuiltinType::Float))
>>> -E = ImpCastExprToType(E, Context.DoubleTy, CK_FloatingCast).get();
>>> +  BTy->getKind() == BuiltinType::Float)) {
>>> +if (getLangOpts().OpenCL &&
>>> +!(getOpenCLOptions().cl_khr_fp64)) {
>>> +if (BTy->getKind() == BuiltinType::Half) {
>>> +E = ImpCastExprToType(E, Context.FloatTy, 
>>> CK_FloatingCast).get();
>>> +}
>>> +} else {
>>> +  E = ImpCastExprToType(E, Context.DoubleTy, CK_FloatingCast).get();
>>> +}
>>> +  }
>>> 
>>> // C++ performs lvalue-to-rvalue conversion as a default argument  //
>>> promotion, even on class types, but note:
>>> @@ -3397,10 +3409,13 @@ ExprResult Sema::ActOnNumericConstant(co
>>> 
>>>   if (Ty == Context.DoubleTy) {
>>> if (getLangOpts().SinglePrecisionConstants) {
>>> -Res = ImpCastExprToType(Res, Context.FloatTy,
>> CK_FloatingCast).get();
>>> +const BuiltinType *BTy = Ty->getAs();
>>> +if (BTy->getKind() != BuiltinType::Float) {
>>> +  Res = ImpCastExprToType(Res, Context.FloatTy,
>> CK_FloatingCast).get();
>>> +}
>>> } else if (getLangOpts().OpenCL &&
>>> - !((getLangOpts().OpenCLVersion >= 120) ||
>>> -   getOpenCLOptions().cl_khr_fp64)) {
>>> + !(getOpenCLOptions().cl_khr_fp64)) {
>>> +// Impo

Re: r286815 - Improve handling of floating point literals in OpenCL to only use double precision if the target supports fp64.

2016-11-14 Thread Stephen Canon via cfe-commits
Can you add some non-trivial test cases that exercise double-rounding, 
especially near the overflow boundary?

e.g. What is the expected value of x if the target does not support fp64?:

float x = 340282356779733661637539395458142568447.0;

– Steve

> On Nov 14, 2016, at 6:15 AM, Neil Hickey via cfe-commits 
>  wrote:
> 
> Author: neil.hickey
> Date: Mon Nov 14 05:15:51 2016
> New Revision: 286815
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=286815&view=rev
> Log:
> Improve handling of floating point literals in OpenCL to only use double 
> precision if the target supports fp64.
> 
> This change makes sure single-precision floating point types are used if the 
> cl_fp64 extension is not supported by the target.
> 
> Also removed the check to see whether the OpenCL version is >= 1.2, as this 
> has
> been incorporated into the extension setting code.
> 
> Differential Revision: https://reviews.llvm.org/D24235
> 
> 
> Modified:
>   cfe/trunk/lib/Sema/SemaExpr.cpp
>   cfe/trunk/lib/Sema/SemaType.cpp
>   cfe/trunk/test/CodeGenOpenCL/fpmath.cl
>   cfe/trunk/test/SemaOpenCL/extensions.cl
> 
> Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=286815&r1=286814&r2=286815&view=diff
> ==
> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Nov 14 05:15:51 2016
> @@ -705,9 +705,13 @@ ExprResult Sema::DefaultLvalueConversion
>  if (getLangOpts().ObjCAutoRefCount &&
>  E->getType().getObjCLifetime() == Qualifiers::OCL_Weak)
>Cleanup.setExprNeedsCleanups(true);
> +  
> +  ExprResult Res = E;
> 
> -  ExprResult Res = ImplicitCastExpr::Create(Context, T, CK_LValueToRValue, E,
> -nullptr, VK_RValue);
> +  if ( T != E->getType()) {
> +Res = ImplicitCastExpr::Create(Context, T, CK_LValueToRValue, E,
> +   nullptr, VK_RValue);
> +  }
> 
>  // C11 6.3.2.1p2:
>  //   ... if the lvalue has atomic type, the value has the non-atomic version 
> @@ -817,8 +821,16 @@ ExprResult Sema::DefaultArgumentPromotio
>  // double.
>  const BuiltinType *BTy = Ty->getAs();
>  if (BTy && (BTy->getKind() == BuiltinType::Half ||
> -  BTy->getKind() == BuiltinType::Float))
> -E = ImpCastExprToType(E, Context.DoubleTy, CK_FloatingCast).get();
> +  BTy->getKind() == BuiltinType::Float)) {
> +if (getLangOpts().OpenCL &&
> +!(getOpenCLOptions().cl_khr_fp64)) {
> +if (BTy->getKind() == BuiltinType::Half) {
> +E = ImpCastExprToType(E, Context.FloatTy, CK_FloatingCast).get();
> +}
> +} else {
> +  E = ImpCastExprToType(E, Context.DoubleTy, CK_FloatingCast).get();
> +}
> +  }
> 
>  // C++ performs lvalue-to-rvalue conversion as a default argument
>  // promotion, even on class types, but note:
> @@ -3397,10 +3409,13 @@ ExprResult Sema::ActOnNumericConstant(co
> 
>if (Ty == Context.DoubleTy) {
>  if (getLangOpts().SinglePrecisionConstants) {
> -Res = ImpCastExprToType(Res, Context.FloatTy, CK_FloatingCast).get();
> +const BuiltinType *BTy = Ty->getAs();
> +if (BTy->getKind() != BuiltinType::Float) {
> +  Res = ImpCastExprToType(Res, Context.FloatTy, 
> CK_FloatingCast).get();
> +}
>  } else if (getLangOpts().OpenCL &&
> - !((getLangOpts().OpenCLVersion >= 120) ||
> -   getOpenCLOptions().cl_khr_fp64)) {
> + !(getOpenCLOptions().cl_khr_fp64)) {
> +// Impose single-precision float type when cl_khr_fp64 is not 
> enabled.
>Diag(Tok.getLocation(), diag::warn_double_const_requires_fp64);
>Res = ImpCastExprToType(Res, Context.FloatTy, CK_FloatingCast).get();
>  }
> 
> Modified: cfe/trunk/lib/Sema/SemaType.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=286815&r1=286814&r2=286815&view=diff
> ==
> --- cfe/trunk/lib/Sema/SemaType.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaType.cpp Mon Nov 14 05:15:51 2016
> @@ -1402,8 +1402,7 @@ static QualType ConvertDeclSpecToType(Ty
>  Result = Context.DoubleTy;
> 
>if (S.getLangOpts().OpenCL &&
> -!((S.getLangOpts().OpenCLVersion >= 120) ||
> -  S.getOpenCLOptions().cl_khr_fp64)) {
> +!(S.getOpenCLOptions().cl_khr_fp64)) {
>  S.Diag(DS.getTypeSpecTypeLoc(), diag::err_type_requires_extension)
>  << Result << "cl_khr_fp64";
>  declarator.setInvalidType(true);
> 
> Modified: cfe/trunk/test/CodeGenOpenCL/fpmath.cl
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/fpmath.cl?rev=286815&r1=286814&r2=286815&view=diff
> ==
> --- cfe/trunk/test/CodeGenOpenCL/fpmath.cl (original)
> +++ cfe/trun

r247643 - Prevent implicit re-interpret casts between ExtVector and Scalar types.

2015-09-14 Thread Stephen Canon via cfe-commits
Author: scanon
Date: Mon Sep 14 19:21:56 2015
New Revision: 247643

URL: http://llvm.org/viewvc/llvm-project?rev=247643&view=rev
Log:
Prevent implicit re-interpret casts between ExtVector and Scalar types.

Previously, in certain cases lax vector conversions could occur between scalar 
floating-point values and ExtVector types; these conversions would be simple 
bitcasts.  We need to allow them with other vector types to support some common 
headers, but we don't need them for ExtVector.  Preventing them here makes them 
behave like other operations involving scalars and ExtVectors.

Added:
cfe/trunk/test/Sema/ext_vector_conversions.c
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=247643&r1=247642&r2=247643&view=diff
==
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Sep 14 19:21:56 2015
@@ -5562,6 +5562,14 @@ static bool breakDownVectorType(QualType
 /// vector nor a real type.
 bool Sema::areLaxCompatibleVectorTypes(QualType srcTy, QualType destTy) {
   assert(destTy->isVectorType() || srcTy->isVectorType());
+  
+  // Disallow lax conversions between scalars and ExtVectors (these
+  // conversions are allowed for other vector types because common headers
+  // depend on them).  Most scalar OP ExtVector cases are handled by the
+  // splat path anyway, which does what we want (convert, not bitcast).
+  // What this rules out for ExtVectors is crazy things like char4*float.
+  if (srcTy->isScalarType() && destTy->isExtVectorType()) return false;
+  if (destTy->isScalarType() && srcTy->isExtVectorType()) return false;
 
   uint64_t srcLen, destLen;
   QualType srcElt, destElt;

Added: cfe/trunk/test/Sema/ext_vector_conversions.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/ext_vector_conversions.c?rev=247643&view=auto
==
--- cfe/trunk/test/Sema/ext_vector_conversions.c (added)
+++ cfe/trunk/test/Sema/ext_vector_conversions.c Mon Sep 14 19:21:56 2015
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -fsyntax-only -verify 
-Wconversion %s
+
+typedef __attribute__((ext_vector_type(4))) char char4;
+typedef __attribute__((ext_vector_type(4))) short short4;
+typedef __attribute__((ext_vector_type(1))) float float1;
+
+static void test() {
+  char4 vc4;
+  float f;
+  // Not allowed.  There's no splatting conversion between float and int 
vector,
+  // and we don't want to bitcast f to vector-of-char (as would happen with the
+  // old-style vector types).
+  vc4 += f; // expected-error {{cannot convert between vector values of 
different size}}
+  short4 vs4;
+  long long ll;
+  // This one is OK; we don't re-interpret ll as short4, rather we splat its
+  // value, which should produce a warning about clamping.
+  vs4 += ll; // expected-warning {{implicit conversion loses integer 
precision}}
+}


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r252050 - Allow compound assignment expressions to be contracted when licensed by the language or pragma.

2015-11-04 Thread Stephen Canon via cfe-commits
Author: scanon
Date: Wed Nov  4 09:25:38 2015
New Revision: 252050

URL: http://llvm.org/viewvc/llvm-project?rev=252050&view=rev
Log:
Allow compound assignment expressions to be contracted when licensed by the 
language or pragma.

Modified:
cfe/trunk/lib/CodeGen/CGExprScalar.cpp

Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=252050&r1=252049&r2=252050&view=diff
==
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Wed Nov  4 09:25:38 2015
@@ -2116,7 +2116,7 @@ LValue ScalarExprEmitter::EmitCompoundAs
   OpInfo.RHS = Visit(E->getRHS());
   OpInfo.Ty = E->getComputationResultType();
   OpInfo.Opcode = E->getOpcode();
-  OpInfo.FPContractable = false;
+  OpInfo.FPContractable = E->isFPContractable();
   OpInfo.E = E;
   // Load/convert the LHS.
   LValue LHSLV = EmitCheckedLValue(E->getLHS(), CodeGenFunction::TCK_Store);


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r253269 - Make FP_CONTRACT ON the default.

2015-11-16 Thread Stephen Canon via cfe-commits
Author: scanon
Date: Mon Nov 16 17:09:11 2015
New Revision: 253269

URL: http://llvm.org/viewvc/llvm-project?rev=253269&view=rev
Log:
Make FP_CONTRACT ON the default.

Differential Revision: D14200

Added:
cfe/trunk/test/CodeGen/aarch64-scalar-fma.c
Modified:
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/CodeGen/aarch64-neon-fma.c
cfe/trunk/test/CodeGen/fp-contract-pragma.cpp
cfe/trunk/test/Driver/clang_f_opts.c

Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=253269&r1=253268&r2=253269&view=diff
==
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Mon Nov 16 17:09:11 2015
@@ -187,7 +187,7 @@ BENIGN_LANGOPT(DebuggerObjCLiteral , 1,
 BENIGN_LANGOPT(SpellChecking , 1, 1, "spell-checking")
 LANGOPT(SinglePrecisionConstants , 1, 0, "treating double-precision floating 
point constants as single precision constants")
 LANGOPT(FastRelaxedMath , 1, 0, "OpenCL fast relaxed math")
-LANGOPT(DefaultFPContract , 1, 0, "FP_CONTRACT")
+LANGOPT(DefaultFPContract , 1, 1, "FP_CONTRACT")
 LANGOPT(NoBitFieldTypeAlign , 1, 0, "bit-field type alignment")
 LANGOPT(HexagonQdsp6Compat , 1, 0, "hexagon-qdsp6 backward compatibility")
 LANGOPT(ObjCAutoRefCount , 1, 0, "Objective-C automated reference counting")

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=253269&r1=253268&r2=253269&view=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon Nov 16 17:09:11 2015
@@ -1336,7 +1336,6 @@ void CompilerInvocation::setLangDefaults
 Opts.ZVector = 0;
 Opts.CXXOperatorNames = 1;
 Opts.LaxVectorConversions = 0;
-Opts.DefaultFPContract = 1;
 Opts.NativeHalfType = 1;
   }
 

Modified: cfe/trunk/test/CodeGen/aarch64-neon-fma.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/aarch64-neon-fma.c?rev=253269&r1=253268&r2=253269&view=diff
==
--- cfe/trunk/test/CodeGen/aarch64-neon-fma.c (original)
+++ cfe/trunk/test/CodeGen/aarch64-neon-fma.c Mon Nov 16 17:09:11 2015
@@ -1,5 +1,8 @@
 // REQUIRES: aarch64-registered-target
-// RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon -S -O3 
-o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon -S -O3 \
+// RUN:   -ffp-contract=off -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon -S -O3 \
+// RUN:   -o - %s | FileCheck -check-prefix=CHECK-FMA %s
 
 // Test new aarch64 intrinsics and types
 
@@ -10,8 +13,7 @@ float32x2_t test_vmla_n_f32(float32x2_t
   return vmla_n_f32(a, b, c);
   // CHECK: fmul {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.s[0]
   // CHECK: fadd {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.2s
-  // CHECK-FMA: dup {{v[0-9]+}}.2s, {{v[0-9]+}}.s[0]
-  // CHECK-FMA: fmla {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.2s
+  // CHECK-FMA: fmla {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.s[0]
 }
 
 float32x4_t test_vmlaq_n_f32(float32x4_t a, float32x4_t b, float32_t c) {
@@ -19,8 +21,7 @@ float32x4_t test_vmlaq_n_f32(float32x4_t
   return vmlaq_n_f32(a, b, c);
   // CHECK: fmul {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.s[0]
   // CHECK: fadd {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.4s
-  // CHECK-FMA: dup {{v[0-9]+}}.4s, {{v[0-9]+}}.s[0]
-  // CHECK-FMA: fmla {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.4s
+  // CHECK-FMA: fmla {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.s[0]
 }
 
 float64x2_t test_vmlaq_n_f64(float64x2_t a, float64x2_t b, float64_t c) {
@@ -28,8 +29,7 @@ float64x2_t test_vmlaq_n_f64(float64x2_t
   return vmlaq_n_f64(a, b, c);
   // CHECK: fmul {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.d[0]
   // CHECK: fadd {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
-  // CHECK-FMA: dup {{v[0-9]+}}.2d, {{v[0-9]+}}.d[0]
-  // CHECK-FMA: fmla {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
+  // CHECK-FMA: fmla {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.d[0]
 }
 
 float32x4_t test_vmlsq_n_f32(float32x4_t a, float32x4_t b, float32_t c) {
@@ -37,8 +37,7 @@ float32x4_t test_vmlsq_n_f32(float32x4_t
   return vmlsq_n_f32(a, b, c);
   // CHECK: fmul {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.s[0]
   // CHECK: fsub {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.4s
-  // CHECK-FMA: dup {{v[0-9]+}}.4s, {{v[0-9]+}}.s[0]
-  // CHECK-FMA: fmls {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.4s
+  // CHECK-FMA: fmls {{v[0-9]+}}.4s, {{v[0-9]+}}.4s, {{v[0-9]+}}.s[0]
 }
 
 float32x2_t test_vmls_n_f32(float32x2_t a, float32x2_t b, float32_t c) {
@@ -4

Re: r253269 - Make FP_CONTRACT ON the default.

2015-11-17 Thread Stephen Canon via cfe-commits
> On Nov 17, 2015, at 4:51 AM, Renato Golin  wrote:
> 
> On 16 November 2015 at 23:09, Stephen Canon via cfe-commits
>  wrote:
>> Author: scanon
>> Date: Mon Nov 16 17:09:11 2015
>> New Revision: 253269
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=253269&view=rev
>> Log:
>> Make FP_CONTRACT ON the default.
>> 
>> Differential Revision: D14200
> 
> Hi Stephen,
> 
> It seems your commit in the blame list is the only one that affects
> AArch64 directly:
> 
> http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/2388
> 
> I haven't bisected yet, but would be good if you could try those tests
> locally, just to make sure it wasn't your commit, and revert if it
> was, to fix offline.

From a quick glance at the log, most of these appear to be cases where the test 
is incorrectly comparing floating-point results without any tolerance*.  That’s 
a bug in the tests, because the standard allows the expressions to be 
contracted or not by default, which will necessarily cause (usually small, but 
sometimes not) perturbations in the results.

These checks should either have a tolerance or the sources should specify 
#pragma STDC FP_CONTRACT OFF or they should be compiled with -ffp-contract=off.

If we just want things to be green, then I would recommend that these tests use 
-ffp-contract=off until someone has time and inclination to fix them.

– Steve

*linpack-pc has a tolerance, but fpcmp blindly applies it to everything in the 
output file; the error occurs in norm resid which is a normalized error term 
already scaled to the magnitude of the expected error, so the apparently large 
change from 1.6 to 2 is actually utterly inconsequential.

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits