Re: [PATCH] D24481: make “#pragma STDC FP_CONTRACT” on by default

2016-09-20 Thread Abe Skolnik via cfe-commits
Abe updated this revision to Diff 71953.
Abe added a comment.

Removed some comments that I felt were good for clarity but at least 2 people 
disagreed.


https://reviews.llvm.org/D24481

Files:
  cfe/trunk/lib/Frontend/CompilerInvocation.cpp
  cfe/trunk/test/CodeGen/aarch64-neon-fma.c
  cfe/trunk/test/CodeGen/aarch64-scalar-fma.c
  cfe/trunk/test/CodeGen/fp-contract-pragma.cpp
  
cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O0___aarch64-backend.c
  
cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O1...3___aarch64-backend.h
  
cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O1___aarch64-backend.c
  
cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O2___aarch64-backend.c
  
cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O3___aarch64-backend.c
  cfe/trunk/test/Driver/clang_f_opts.c

Index: cfe/trunk/test/Driver/clang_f_opts.c
===
--- cfe/trunk/test/Driver/clang_f_opts.c
+++ cfe/trunk/test/Driver/clang_f_opts.c
@@ -34,10 +34,13 @@
 // DEPRECATED-OFF-CHECK-NOT: -fdeprecated-macro
 
 // RUN: %clang -### -S -ffp-contract=fast %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s
-// RUN: %clang -### -S -ffast-math %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s
-// RUN: %clang -### -S -ffp-contract=off %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-OFF-CHECK %s
+// RUN: %clang -### -S -ffast-math%s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s
+// RUN: %clang -### -S -ffp-contract=off  %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-OFF-CHECK  %s
+// RUN: %clang -### -S -ffp-contract=on   %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-ON-CHECK   %s
+
 // FP-CONTRACT-FAST-CHECK: -ffp-contract=fast
-// FP-CONTRACT-OFF-CHECK: -ffp-contract=off
+// FP-CONTRACT-OFF-CHECK:  -ffp-contract=off
+// FP-CONTRACT-ON-CHECK:   -ffp-contract=on
 
 // RUN: %clang -### -S -funroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-UNROLL-LOOPS %s
 // RUN: %clang -### -S -fno-unroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-NO-UNROLL-LOOPS %s
Index: cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O3___aarch64-backend.c
===
--- /dev/null
+++ cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O3___aarch64-backend.c
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -triple aarch64 -O3 -S -o - %s | FileCheck %S/fp-contract-pragma___on-by-default___-O1...3___aarch64-backend.h
+// REQUIRES: aarch64-registered-target
+
+#include "fp-contract-pragma___on-by-default___-O1...3___aarch64-backend.h"
Index: cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O2___aarch64-backend.c
===
--- /dev/null
+++ cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O2___aarch64-backend.c
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -triple aarch64 -O2 -S -o - %s | FileCheck %S/fp-contract-pragma___on-by-default___-O1...3___aarch64-backend.h
+// REQUIRES: aarch64-registered-target
+
+#include "fp-contract-pragma___on-by-default___-O1...3___aarch64-backend.h"
Index: cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O1___aarch64-backend.c
===
--- /dev/null
+++ cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O1___aarch64-backend.c
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -triple aarch64 -O1 -S -o - %s | FileCheck %S/fp-contract-pragma___on-by-default___-O1...3___aarch64-backend.h
+// REQUIRES: aarch64-registered-target
+
+#include "fp-contract-pragma___on-by-default___-O1...3___aarch64-backend.h"
Index: cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O1...3___aarch64-backend.h
===
--- /dev/null
+++ cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O1...3___aarch64-backend.h
@@ -0,0 +1,14 @@
+// CHECK-LABEL: fmadd_double:
+// CHECK: fmadd d0, d{{[0-7]}}, d{{[0-7]}}, d{{[0-7]}}
+// CHECK-NEXT: ret
+double fmadd_double(double a, double b, double c) {
+  return a*b+c;
+}
+
+// CHECK-LABEL: fmadd_single:
+// CHECK: fmadd s0, s{{[0-7]}}, s{{[0-7]}}, s{{[0-7]}}
+// CHECK-NEXT: ret
+float  fmadd_single(float  a, float  b, float  c) {
+  return a*b+c;
+}
+
Index: cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O0___aarch64-backend.c
===
--- /dev/null
+++ cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O0___aarch64-backend.c
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -triple aarch64 -O0 -S -o - %s | FileCheck %s
+// REQUIRES: aarch64-registered-target
+
+// CHECK-LABEL: fmadd_double:
+// CHECK: fmadd d0, d{{[0-7]}}, d{{[0-7]}}, d{{[0-7]}}
+double fmadd_double(double a, double b, double c) {
+  return a*b+c;
+}
+
+// CHECK-LABEL: fmadd_single:
+// CHECK: fmadd s0, s{{[0-7]}}, s{{[0-7]}}, s{{[0-7]}}
+float  fmadd_si

Re: [PATCH] D24481: make “#pragma STDC FP_CONTRACT” on by default

2016-09-20 Thread Abe Skolnik via cfe-commits
Abe added a comment.

In https://reviews.llvm.org/D24481#547694, @yaxunl wrote:

> Is it possible to merge 
> cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O[0-3]___aarch64-backend.c
>  as one and remove 
> cfe/trunk/test/CodeGen/fp-contract-pragma___on-by-default___-O1...3___aarch64-backend.h?
>  They look the same except the RUN commands. Why not using one file with 
> multiple RUn commands?


That seems like a good idea.  I didn`t write it that way yet b/c I was unsure 
of the semantics of multiple "RUN" command-comments in a single file.  If a 
single file has e.g.:

  // RUN: %clang_cc1 -triple aarch64 -O1 -S -o - %s | FileCheck %s
  // RUN: %clang_cc1 -triple aarch64 -O2 -S -o - %s | FileCheck %s
  // RUN: %clang_cc1 -triple aarch64 -O3 -S -o - %s | FileCheck %s

... then that will cause 3 compilations and 3 tests, right?


https://reviews.llvm.org/D24481



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


Re: [PATCH] D24481: make “#pragma STDC FP_CONTRACT” on by default

2016-09-20 Thread Abe Skolnik via cfe-commits
Abe updated this revision to Diff 71959.
Abe added a comment.

Collapsed 4 test-case files that didn`t really need to be separate into 1 file, 
as suggested by Yaxun Liu.


https://reviews.llvm.org/D24481

Files:
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/aarch64-neon-fma.c
  clang/test/CodeGen/aarch64-scalar-fma.c
  clang/test/CodeGen/fp-contract-pragma.cpp
  
clang/test/CodeGen/fp-contract-pragma___on-by-default___-O0___aarch64-backend.c
  
clang/test/CodeGen/fp-contract-pragma___on-by-default___-O1...3___aarch64-backend.c
  clang/test/Driver/clang_f_opts.c

Index: clang/test/Driver/clang_f_opts.c
===
--- clang/test/Driver/clang_f_opts.c
+++ clang/test/Driver/clang_f_opts.c
@@ -34,10 +34,13 @@
 // DEPRECATED-OFF-CHECK-NOT: -fdeprecated-macro
 
 // RUN: %clang -### -S -ffp-contract=fast %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s
-// RUN: %clang -### -S -ffast-math %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s
-// RUN: %clang -### -S -ffp-contract=off %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-OFF-CHECK %s
+// RUN: %clang -### -S -ffast-math%s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s
+// RUN: %clang -### -S -ffp-contract=off  %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-OFF-CHECK  %s
+// RUN: %clang -### -S -ffp-contract=on   %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-ON-CHECK   %s
+
 // FP-CONTRACT-FAST-CHECK: -ffp-contract=fast
-// FP-CONTRACT-OFF-CHECK: -ffp-contract=off
+// FP-CONTRACT-OFF-CHECK:  -ffp-contract=off
+// FP-CONTRACT-ON-CHECK:   -ffp-contract=on
 
 // RUN: %clang -### -S -funroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-UNROLL-LOOPS %s
 // RUN: %clang -### -S -fno-unroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-NO-UNROLL-LOOPS %s
Index: clang/test/CodeGen/fp-contract-pragma___on-by-default___-O1...3___aarch64-backend.c
===
--- /dev/null
+++ clang/test/CodeGen/fp-contract-pragma___on-by-default___-O1...3___aarch64-backend.c
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -triple aarch64 -O1 -S -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple aarch64 -O2 -S -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple aarch64 -O3 -S -o - %s | FileCheck %s
+// REQUIRES: aarch64-registered-target
+
+// CHECK-LABEL: fmadd_double:
+// CHECK: fmadd d0, d{{[0-7]}}, d{{[0-7]}}, d{{[0-7]}}
+// CHECK-NEXT: ret
+double fmadd_double(double a, double b, double c) {
+  return a*b+c;
+}
+
+// CHECK-LABEL: fmadd_single:
+// CHECK: fmadd s0, s{{[0-7]}}, s{{[0-7]}}, s{{[0-7]}}
+// CHECK-NEXT: ret
+float  fmadd_single(float  a, float  b, float  c) {
+  return a*b+c;
+}
+
Index: clang/test/CodeGen/fp-contract-pragma___on-by-default___-O0___aarch64-backend.c
===
--- /dev/null
+++ clang/test/CodeGen/fp-contract-pragma___on-by-default___-O0___aarch64-backend.c
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -triple aarch64 -O0 -S -o - %s | FileCheck %s
+// REQUIRES: aarch64-registered-target
+
+// CHECK-LABEL: fmadd_double:
+// CHECK: fmadd d0, d{{[0-7]}}, d{{[0-7]}}, d{{[0-7]}}
+double fmadd_double(double a, double b, double c) {
+  return a*b+c;
+}
+
+// CHECK-LABEL: fmadd_single:
+// CHECK: fmadd s0, s{{[0-7]}}, s{{[0-7]}}, s{{[0-7]}}
+float  fmadd_single(float  a, float  b, float  c) {
+  return a*b+c;
+}
+
Index: clang/test/CodeGen/fp-contract-pragma.cpp
===
--- clang/test/CodeGen/fp-contract-pragma.cpp
+++ clang/test/CodeGen/fp-contract-pragma.cpp
@@ -1,27 +1,25 @@
 // RUN: %clang_cc1 -O3 -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s
 
-// Is FP_CONTRACT honored in a simple case?
-float fp_contract_1(float a, float b, float c) {
-// CHECK: _Z13fp_contract_1fff
+// Is FP_CONTRACT on by default, at least at -O3?
+float fp_contract_8(float a, float b, float c) {
+// CHECK: _Z13fp_contract_8fff
 // CHECK: tail call float @llvm.fmuladd
-  #pragma STDC FP_CONTRACT ON
   return a * b + c;
 }
 
 // Is FP_CONTRACT state cleared on exiting compound statements?
 float fp_contract_2(float a, float b, float c) {
 // CHECK: _Z13fp_contract_2fff
 // CHECK: %[[M:.+]] = fmul float %a, %b
 // CHECK-NEXT: fadd float %[[M]], %c
+  #pragma STDC FP_CONTRACT OFF
   {
 #pragma STDC FP_CONTRACT ON
   }
   return a * b + c;  
 }
 
 // Does FP_CONTRACT survive template instantiation?
-class Foo {};
-Foo operator+(Foo, Foo);
 
 template 
 T template_muladd(T a, T b, T c) {
@@ -62,15 +60,23 @@
   return a * b + c;
 }
 
+// Does FP_CONTRACT inside a function override the same in the file scope?
+float fp_contract_1(float a, float b, float c) {
+// CHECK: _Z13fp_contract_1fff
+// CHECK: tail call float @llvm.fmuladd
+  #pragma STDC FP_CONTRACT ON
+  return a * b + c;
+}
+
+
 // If the multiply has multiple uses, don't produce fmuladd.
 // This used to assert (PR25719):
 // https://llvm.org/bugs/show_bug.

Re: [PATCH] D24481: make “#pragma STDC FP_CONTRACT” on by default

2016-09-21 Thread Abe Skolnik via cfe-commits
Abe updated this revision to Diff 72103.
Abe added a comment.

Combined "fp-contract-pragma___on-by-default___-O0___aarch64-backend.c" and 
"fp-contract-pragma___on-by-default___-O1...3___aarch64-backend.c" into a 
single file ["fp-contract-pragma___on-by-default.c"].


https://reviews.llvm.org/D24481

Files:
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/aarch64-neon-fma.c
  clang/test/CodeGen/aarch64-scalar-fma.c
  clang/test/CodeGen/fp-contract-pragma.cpp
  clang/test/CodeGen/fp-contract-pragma___on-by-default.c
  clang/test/Driver/clang_f_opts.c

Index: clang/test/Driver/clang_f_opts.c
===
--- clang/test/Driver/clang_f_opts.c
+++ clang/test/Driver/clang_f_opts.c
@@ -34,10 +34,13 @@
 // DEPRECATED-OFF-CHECK-NOT: -fdeprecated-macro
 
 // RUN: %clang -### -S -ffp-contract=fast %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s
-// RUN: %clang -### -S -ffast-math %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s
-// RUN: %clang -### -S -ffp-contract=off %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-OFF-CHECK %s
+// RUN: %clang -### -S -ffast-math%s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s
+// RUN: %clang -### -S -ffp-contract=off  %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-OFF-CHECK  %s
+// RUN: %clang -### -S -ffp-contract=on   %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-ON-CHECK   %s
+
 // FP-CONTRACT-FAST-CHECK: -ffp-contract=fast
-// FP-CONTRACT-OFF-CHECK: -ffp-contract=off
+// FP-CONTRACT-OFF-CHECK:  -ffp-contract=off
+// FP-CONTRACT-ON-CHECK:   -ffp-contract=on
 
 // RUN: %clang -### -S -funroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-UNROLL-LOOPS %s
 // RUN: %clang -### -S -fno-unroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-NO-UNROLL-LOOPS %s
Index: clang/test/CodeGen/fp-contract-pragma___on-by-default.c
===
--- /dev/null
+++ clang/test/CodeGen/fp-contract-pragma___on-by-default.c
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -triple aarch64 -O0 -S -o - %s | FileCheck %s --check-prefix   ALL_BUILDS
+// RUN: %clang_cc1 -triple aarch64 -O1 -S -o - %s | FileCheck %s --check-prefixes ALL_BUILDS,NON_O0
+// RUN: %clang_cc1 -triple aarch64 -O2 -S -o - %s | FileCheck %s --check-prefixes ALL_BUILDS,NON_O0
+// RUN: %clang_cc1 -triple aarch64 -O3 -S -o - %s | FileCheck %s --check-prefixes ALL_BUILDS,NON_O0
+
+// REQUIRES: aarch64-registered-target
+
+// ALL_BUILDS-LABEL: fmadd_double:
+// ALL_BUILDS: fmadd d0, d{{[0-7]}}, d{{[0-7]}}, d{{[0-7]}}
+// NON_O0-NEXT: ret
+double fmadd_double(double a, double b, double c) {
+  return a*b+c;
+}
+
+// ALL_BUILDS: fmadd_single:
+// ALL_BUILDS: fmadd s0, s{{[0-7]}}, s{{[0-7]}}, s{{[0-7]}}
+// NON_O0-NEXT: ret
+float  fmadd_single(float  a, float  b, float  c) {
+  return a*b+c;
+}
+
Index: clang/test/CodeGen/fp-contract-pragma.cpp
===
--- clang/test/CodeGen/fp-contract-pragma.cpp
+++ clang/test/CodeGen/fp-contract-pragma.cpp
@@ -1,27 +1,25 @@
 // RUN: %clang_cc1 -O3 -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s
 
-// Is FP_CONTRACT honored in a simple case?
-float fp_contract_1(float a, float b, float c) {
-// CHECK: _Z13fp_contract_1fff
+// Is FP_CONTRACT on by default, at least at -O3?
+float fp_contract_8(float a, float b, float c) {
+// CHECK: _Z13fp_contract_8fff
 // CHECK: tail call float @llvm.fmuladd
-  #pragma STDC FP_CONTRACT ON
   return a * b + c;
 }
 
 // Is FP_CONTRACT state cleared on exiting compound statements?
 float fp_contract_2(float a, float b, float c) {
 // CHECK: _Z13fp_contract_2fff
 // CHECK: %[[M:.+]] = fmul float %a, %b
 // CHECK-NEXT: fadd float %[[M]], %c
+  #pragma STDC FP_CONTRACT OFF
   {
 #pragma STDC FP_CONTRACT ON
   }
   return a * b + c;  
 }
 
 // Does FP_CONTRACT survive template instantiation?
-class Foo {};
-Foo operator+(Foo, Foo);
 
 template 
 T template_muladd(T a, T b, T c) {
@@ -62,15 +60,23 @@
   return a * b + c;
 }
 
+// Does FP_CONTRACT inside a function override the same in the file scope?
+float fp_contract_1(float a, float b, float c) {
+// CHECK: _Z13fp_contract_1fff
+// CHECK: tail call float @llvm.fmuladd
+  #pragma STDC FP_CONTRACT ON
+  return a * b + c;
+}
+
+
 // If the multiply has multiple uses, don't produce fmuladd.
 // This used to assert (PR25719):
 // https://llvm.org/bugs/show_bug.cgi?id=25719
 
-float fp_contract_7(float a, float b, float c) {
+float fp_contract_7(float a, float b, float c, float& d_passed_by_ref) {
 // CHECK: _Z13fp_contract_7fff
 // CHECK:  %[[M:.+]] = fmul float %b, 2.00e+00
-// CHECK-NEXT: fsub float %[[M]], %c
   #pragma STDC FP_CONTRACT ON
-  return (a = 2 * b) - c;
+  return (d_passed_by_ref = 2 * b) - c;
 }
 
Index: clang/test/CodeGen/aarch64-scalar-fma.c
===
--- /dev/null
+++ clang/test/CodeGen/aarch64-scalar-fma.c
@@ -0,0 +1,177 @@

Re: [PATCH] D24481: make “#pragma STDC FP_CONTRACT” on by default

2016-09-22 Thread Abe Skolnik via cfe-commits
Abe updated this revision to Diff 72186.
Abe added a comment.

Minor edits for style-guidelines conformance.


https://reviews.llvm.org/D24481

Files:
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/aarch64-neon-fma.c
  clang/test/CodeGen/aarch64-scalar-fma.c
  clang/test/CodeGen/fp-contract-pragma.cpp
  clang/test/CodeGen/fp-contract-pragma___on-by-default.c
  clang/test/Driver/clang_f_opts.c

Index: clang/test/Driver/clang_f_opts.c
===
--- clang/test/Driver/clang_f_opts.c
+++ clang/test/Driver/clang_f_opts.c
@@ -34,10 +34,13 @@
 // DEPRECATED-OFF-CHECK-NOT: -fdeprecated-macro
 
 // RUN: %clang -### -S -ffp-contract=fast %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s
-// RUN: %clang -### -S -ffast-math %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s
-// RUN: %clang -### -S -ffp-contract=off %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-OFF-CHECK %s
+// RUN: %clang -### -S -ffast-math%s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s
+// RUN: %clang -### -S -ffp-contract=off  %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-OFF-CHECK  %s
+// RUN: %clang -### -S -ffp-contract=on   %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-ON-CHECK   %s
+
 // FP-CONTRACT-FAST-CHECK: -ffp-contract=fast
-// FP-CONTRACT-OFF-CHECK: -ffp-contract=off
+// FP-CONTRACT-OFF-CHECK:  -ffp-contract=off
+// FP-CONTRACT-ON-CHECK:   -ffp-contract=on
 
 // RUN: %clang -### -S -funroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-UNROLL-LOOPS %s
 // RUN: %clang -### -S -fno-unroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-NO-UNROLL-LOOPS %s
Index: clang/test/CodeGen/fp-contract-pragma___on-by-default.c
===
--- /dev/null
+++ clang/test/CodeGen/fp-contract-pragma___on-by-default.c
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -triple aarch64 -O0 -S -o - %s | FileCheck %s --check-prefix   ALL_BUILDS
+// RUN: %clang_cc1 -triple aarch64 -O1 -S -o - %s | FileCheck %s --check-prefixes ALL_BUILDS,NON_O0
+// RUN: %clang_cc1 -triple aarch64 -O2 -S -o - %s | FileCheck %s --check-prefixes ALL_BUILDS,NON_O0
+// RUN: %clang_cc1 -triple aarch64 -O3 -S -o - %s | FileCheck %s --check-prefixes ALL_BUILDS,NON_O0
+
+// REQUIRES: aarch64-registered-target
+
+// ALL_BUILDS-LABEL: fmadd_double:
+// ALL_BUILDS: fmadd d0, d{{[0-7]}}, d{{[0-7]}}, d{{[0-7]}}
+// NON_O0-NEXT: ret
+double fmadd_double(double a, double b, double c) {
+  return a*b+c;
+}
+
+// ALL_BUILDS: fmadd_single:
+// ALL_BUILDS: fmadd s0, s{{[0-7]}}, s{{[0-7]}}, s{{[0-7]}}
+// NON_O0-NEXT: ret
+float  fmadd_single(float  a, float  b, float  c) {
+  return a*b+c;
+}
+
Index: clang/test/CodeGen/fp-contract-pragma.cpp
===
--- clang/test/CodeGen/fp-contract-pragma.cpp
+++ clang/test/CodeGen/fp-contract-pragma.cpp
@@ -1,27 +1,25 @@
 // RUN: %clang_cc1 -O3 -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s
 
-// Is FP_CONTRACT honored in a simple case?
-float fp_contract_1(float a, float b, float c) {
-// CHECK: _Z13fp_contract_1fff
+// Is FP_CONTRACT on by default, at least at -O3?
+float fp_contract_8(float a, float b, float c) {
+// CHECK: _Z13fp_contract_8fff
 // CHECK: tail call float @llvm.fmuladd
-  #pragma STDC FP_CONTRACT ON
   return a * b + c;
 }
 
 // Is FP_CONTRACT state cleared on exiting compound statements?
 float fp_contract_2(float a, float b, float c) {
 // CHECK: _Z13fp_contract_2fff
 // CHECK: %[[M:.+]] = fmul float %a, %b
 // CHECK-NEXT: fadd float %[[M]], %c
+  #pragma STDC FP_CONTRACT OFF
   {
 #pragma STDC FP_CONTRACT ON
   }
   return a * b + c;  
 }
 
 // Does FP_CONTRACT survive template instantiation?
-class Foo {};
-Foo operator+(Foo, Foo);
 
 template 
 T template_muladd(T a, T b, T c) {
@@ -62,15 +60,23 @@
   return a * b + c;
 }
 
+// Does FP_CONTRACT inside a function override the same in the file scope?
+float fp_contract_1(float a, float b, float c) {
+// CHECK: _Z13fp_contract_1fff
+// CHECK: tail call float @llvm.fmuladd
+  #pragma STDC FP_CONTRACT ON
+  return a * b + c;
+}
+
+
 // If the multiply has multiple uses, don't produce fmuladd.
 // This used to assert (PR25719):
 // https://llvm.org/bugs/show_bug.cgi?id=25719
 
-float fp_contract_7(float a, float b, float c) {
+float fp_contract_7(float a, float b, float c, float& d_passed_by_ref) {
 // CHECK: _Z13fp_contract_7fff
 // CHECK:  %[[M:.+]] = fmul float %b, 2.00e+00
-// CHECK-NEXT: fsub float %[[M]], %c
   #pragma STDC FP_CONTRACT ON
-  return (a = 2 * b) - c;
+  return (d_passed_by_ref = 2 * b) - c;
 }
 
Index: clang/test/CodeGen/aarch64-scalar-fma.c
===
--- /dev/null
+++ clang/test/CodeGen/aarch64-scalar-fma.c
@@ -0,0 +1,177 @@
+// RUN: %clang_cc1 -triple=aarch64-unknown -Os -ffp-contract=fast -S -o - %s | FileCheck -check-prefix=CHECK-FAST -check-prefix=CHECK-ALL %s
+// RUN: %clang_c

Re: [PATCH] D25254: test-suite: Change extension used for reference outputs by Makefile-based harness so we can start improving how the CMake-based harness works without breaking the old system or the

2016-10-05 Thread Abe Skolnik via cfe-commits

Can you expand on how you plan to add the second set of reference outputs?


I plan to {either re-target or replace with normal files} the new symlinks in upcoming patches. 
 The patch proposal to which you referred in the above is just "stage 1" of a large clean-up. 
We [Sebastian and I] have CMake code in progress that will significantly improve the harness 
WRT reference outputs.




We already have multiple reference outputs, for example big endian vs. little 
endian.


Yes.  I have noticed that, and made appropriate use of it in the WIP CMake code.  That CMake 
code is not yet ready for general inspection, but if anybody reading this wants to read what`s 
new in the WIP then please send me an e-mail about that.




I was expecting you to have done a similar thing, which doesn't involve 
changing every single reference file. :)


1: I _am_ doing a "similar thing", but it is not yet ready for general inspection.  In my WIP 
check-out of "test-suite" much is currently broken, waiting for me to fix it as part of my work 
[e.g. half-done fixes and improvements].  I`m reasonably sure the already-proposed patch is 
free of new breakage.


2: I didn`t change _any_ reference files in the patch proposal to which you referred in the 
above; I simply changed what the Makefile harness demands in terms of its reference-output 
pathnames, and added symlinks to the then-current reference output pathnames so that the 
Makefile harness won`t break.


The objective of the preceding, as I mentioned earlier, is to enable us all to fix/improve the 
CMake harness without breaking the Makefile harness.




One way this could be simpler is to change the Makefile on each affected 
directories to duplicate the tests & check differently
 against the reference file. It can be the same reference, but with different thresholds for 

different fp-contract options.

A key motivation in the relevant proposed patch is to change the Makefile harness as _little_ 
as _possible_.  We [SP & I] are not planning to improve the Makefile harness except in such a 
way as to make it "get out of the way" of the modern harness [as in the proposed patch 
currently under discussion].


If the Makefile harness is going to be completely-unneeded extremely soon, then a valid 
alternative is to just delete all files in the repo that are only there for the benefit of the 
Makefile harness and to cease assuming that we need to preserve backwards compatibility.  That 
would make the relevant proposed patch obsolete.


Regards,

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