diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2018-08-29 18:27:49 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2018-08-29 18:27:49 +0000 |
| commit | 0f29e953b74f6526ef8f283bfe0f372196780b8a (patch) | |
| tree | 4798e1031e9cc6c5560b384d0c3a2e619a51bac7 /llvm/test | |
| parent | f5403d83e79a608d02d89ccd829dd6b2ca7248af (diff) | |
| download | bcm5719-llvm-0f29e953b74f6526ef8f283bfe0f372196780b8a.tar.gz bcm5719-llvm-0f29e953b74f6526ef8f283bfe0f372196780b8a.zip | |
[InstCombine] canonicalize fneg with llvm.sin
This is a follow-up to rL339604 which did the same transform
for a sin libcall. The handling of intrinsics vs. libcalls
is unfortunately scattered, so I'm just adding this next to
the existing transform for llvm.cos for now.
This should resolve PR38458:
https://bugs.llvm.org/show_bug.cgi?id=38458
If the call was already negated, the negates will cancel
each other out.
llvm-svn: 340952
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/cos-sin-intrinsic.ll | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/test/Transforms/InstCombine/cos-sin-intrinsic.ll b/llvm/test/Transforms/InstCombine/cos-sin-intrinsic.ll index 98c2434bb14..ef5513d086e 100644 --- a/llvm/test/Transforms/InstCombine/cos-sin-intrinsic.ll +++ b/llvm/test/Transforms/InstCombine/cos-sin-intrinsic.ll @@ -92,14 +92,14 @@ define <2 x float> @fabs_fneg_v2f32(<2 x float> %x) { ret <2 x float> %cos } -; TODO: Negate is canonicalized after sin. +; Negate is canonicalized after sin. declare <2 x float> @llvm.sin.v2f32(<2 x float>) define <2 x float> @fneg_sin(<2 x float> %x){ ; CHECK-LABEL: @fneg_sin( -; CHECK-NEXT: [[NEGX:%.*]] = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[X:%.*]] -; CHECK-NEXT: [[R:%.*]] = call <2 x float> @llvm.sin.v2f32(<2 x float> [[NEGX]]) +; CHECK-NEXT: [[TMP1:%.*]] = call <2 x float> @llvm.sin.v2f32(<2 x float> [[X:%.*]]) +; CHECK-NEXT: [[R:%.*]] = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[TMP1]] ; CHECK-NEXT: ret <2 x float> [[R]] ; %negx = fsub <2 x float> <float -0.0, float -0.0>, %x @@ -107,12 +107,12 @@ define <2 x float> @fneg_sin(<2 x float> %x){ ret <2 x float> %r } -; TODO: FMF are not required, but they should propagate. +; FMF are not required, but they should propagate. define <2 x float> @fneg_sin_fmf(<2 x float> %x){ ; CHECK-LABEL: @fneg_sin_fmf( -; CHECK-NEXT: [[NEGX:%.*]] = fsub fast <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[X:%.*]] -; CHECK-NEXT: [[R:%.*]] = call nnan arcp afn <2 x float> @llvm.sin.v2f32(<2 x float> [[NEGX]]) +; CHECK-NEXT: [[TMP1:%.*]] = call nnan arcp afn <2 x float> @llvm.sin.v2f32(<2 x float> [[X:%.*]]) +; CHECK-NEXT: [[R:%.*]] = fsub nnan arcp afn <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[TMP1]] ; CHECK-NEXT: ret <2 x float> [[R]] ; %negx = fsub fast <2 x float> <float -0.0, float -0.0>, %x |

