Commit Graph

18 Commits

Author SHA1 Message Date
Bob Wilson
487f9decd4 Add some comments to test/IRGen/builtin_math.swift
This test calls sqrt for both Double and Float values, and those calls get
compiled very differently. Add an explanation of the difference.
2017-12-07 12:50:48 -08:00
Bob Wilson
1946d9dc9a master-next: update builtin_math test to work after Clang r319593
This test used to check that sqrt() did not use the LLVM intrinsic because
its behavior did not match IEEE 754 for negative inputs. That has now
changed in recent versions of LLVM. There are still some differences in
how the LLVM intrinsic handles errno, but that should not affect Swift.
With Clang r319593, the test began to fail because __builtin_sqrtf gets
translated to the LLVM intrinsic. Change the test to match.
2017-12-07 12:36:12 -08:00
Stephen Canon
e6c84d7a63 Mark libc math shims with always_inline attribute (#6956)
* Mark libc math shims with always_inline attribute

We want these to always be inlined, so mark them with ... always_inline.
The compiler happened to do the right thing with them previously, but we
shouldn't depend on that.

<rdar://problem/30043258> master-next: IRGen/builtin_math.swift failing because sqrt(4) is not constant folded
2017-01-20 18:09:30 -05:00
Bob Wilson
6118cd92fa Temporarily disable failing test for master-next.
Tracking the problem in rdar://problem/30043258. This check fails:

// CHECK-LABEL: define {{.*}}test5
// CHECK: ret float 2

public func test5( ) -> Float {
  return sqrt(4)
}

The IR that we’re generating is:

define float @_TF12builtin_math5test5FT_Sf() #4 {
entry:
  %0 = tail call fastcc float @_swift_stdlib_squareRootf(float 4.000000e+00)
  ret float %0
}

Note that the Double version in test6 works as expected.
2017-01-16 13:22:51 -08:00
Stephen Canon
d89f8f423e Go back to using static inline stubs for sqrt and remainder (#6769)
* Go back to using static inline implementations of sqrt and remainder now that SR-2089 is resolved.

* Fix typo: sqrt -> squareRoot.

* Added test for constant-folding sqrt with -O.

* Added test case requested by jrose.
2017-01-13 13:26:46 -05:00
Michael Gottesman
20dd563efb [semantic-arc] Update tests for qualified/unqualified ownership and SILGen emission of copy_value, destroy_value. 2016-10-29 20:11:09 -07:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -07:00
Stephen Canon
5564f94867 Intrinsics instead of shims (#3530)
* Use intrinsics instead of Libc stubs where we can.

This replaces most of the stubs used for basic operations on these
types with intrinsics, eliminating a level of indirection for fma,
ceil, floor, round, trunc.

square root and remainder still require stubs because there is no
remainder intrinsic and we can't use the square root intrinsic because
its behavior is undefined for negative inputs.  A previous commit
apparently either the compiler annotates static inline stubs wrong
or the SIL verifier can't handle them, so that change was backed out.

* Explicitly CHECK-NOT @llvm.sqrt instead of looking for @sqrt.
2016-07-15 12:08:25 -05:00
Graham Batty
83b4384fac Update test flags for linux failures and support.
Also removed the sdk 'feature' in favour of the more specific
objc_interop.

Swift SVN r24856
2015-01-30 21:31:48 +00:00
Graham Batty
83f27a8af7 Revert "Mark tests that don't pass on linux as XFAIL."
This reverts commit 2711ca86de7bf6a7885ccea24219a48a590b1e95.

Swift SVN r23577
2014-11-24 17:42:13 +00:00
Graham Batty
198402dcfe Mark tests that don't pass on linux as XFAIL.
Swift SVN r23573
2014-11-24 17:40:37 +00:00
Arnold Schwaighofer
f88190ab8b Reapply "stdlib: libm's sqrt and llvm.sqrt are not semantically equivalent""
This reapplies commit r22864 - it is not changing the public api as we initially
thought. sqrt() was never available without importing Darwin.

This change only changes where sqrt() gets "forwarded" to. Before 'sqrt' called
the builtin '_sqrt' defined in BuiltinMath now it just calls the math library's
'sqrt' function.

I also added a stdlib test.

rdar://18371371

Swift SVN r22870
2014-10-21 23:52:37 +00:00
Arnold Schwaighofer
d95b9c9ab8 Revert "stdlib: libm's sqrt and llvm.sqrt are not semantically equivalent"
This reverts commit 22864. The change is under discussion.

Swift SVN r22865
2014-10-21 17:46:24 +00:00
Arnold Schwaighofer
b0e5358624 stdlib: libm's sqrt and llvm.sqrt are not semantically equivalent
llvm.sqrt(-1.0) is undefined, while sqrt(-1.0) is defined as nan.

rdar://18371371

Swift SVN r22864
2014-10-21 17:26:59 +00:00
Erik Eckstein
43f68b6974 Enable dead function removal for internal function in whole-module compilation.
This is controlled by a new isWholeModule() attribute in SILModule.

It gives about 9% code size reduction on the benchmark executables.
For test-suite reasons it is currently not done for the stdlib.



Swift SVN r22491
2014-10-03 14:14:23 +00:00
Pete Cooper
6a29ca7f6e This test shouldn't have had a target as it'll break on iOS. Thanks Jordan for the feedback
Swift SVN r18981
2014-06-18 17:20:40 +00:00
Pete Cooper
c05a94622a Fix test to import Darwin and use correct check lines
Swift SVN r18973
2014-06-18 03:26:08 +00:00
Pete Cooper
653a9d2d99 Create builtin's for math functions exposed as LLVM intrinsics. Use these builtin's in the wrappers for functions such as sqrt(Float) and cos(Double). rdar://problem/16709244
Swift SVN r18968
2014-06-18 00:27:13 +00:00