diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2018-04-05 23:21:15 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2018-04-05 23:21:15 +0000 |
| commit | 04683de82f5d6812555a5ddf6983ee4b67b76be3 (patch) | |
| tree | 85569746462ca8f625c2fdb8355cac2805cb541f /llvm/test/Transforms | |
| parent | b4e3129356f8f24ddcbbf30c09783581b1627a37 (diff) | |
| download | bcm5719-llvm-04683de82f5d6812555a5ddf6983ee4b67b76be3.tar.gz bcm5719-llvm-04683de82f5d6812555a5ddf6983ee4b67b76be3.zip | |
[InstCombine] FP: Z - (X - Y) --> Z + (Y - X)
This restores what was lost with rL73243 but without
re-introducing the bug that was present in the old code.
Note that we already have these transforms if the ops are
marked 'fast' (and I assume that's happening somewhere in
the code added with rL170471), but we clearly don't need
all of 'fast' for these transforms.
llvm-svn: 329362
Diffstat (limited to 'llvm/test/Transforms')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/fsub.ll | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/test/Transforms/InstCombine/fsub.ll b/llvm/test/Transforms/InstCombine/fsub.ll index 184d24f5bad..c9374fbbca9 100644 --- a/llvm/test/Transforms/InstCombine/fsub.ll +++ b/llvm/test/Transforms/InstCombine/fsub.ll @@ -27,12 +27,12 @@ define float @neg_sub_nsz(float %x, float %y) { ret float %t2 } -; FIXME: With nsz: Z - (X - Y) --> Z + (Y - X) +; With nsz: Z - (X - Y) --> Z + (Y - X) define float @sub_sub_nsz(float %x, float %y, float %z) { ; CHECK-LABEL: @sub_sub_nsz( -; CHECK-NEXT: [[T1:%.*]] = fsub float [[X:%.*]], [[Y:%.*]] -; CHECK-NEXT: [[T2:%.*]] = fsub nsz float [[Z:%.*]], [[T1]] +; CHECK-NEXT: [[TMP1:%.*]] = fsub nsz float [[Y:%.*]], [[X:%.*]] +; CHECK-NEXT: [[T2:%.*]] = fadd nsz float [[TMP1]], [[Z:%.*]] ; CHECK-NEXT: ret float [[T2]] ; %t1 = fsub float %x, %y @@ -40,12 +40,12 @@ define float @sub_sub_nsz(float %x, float %y, float %z) { ret float %t2 } -; FIXME: Same as above: if 'Z' is not -0.0, swap fsub operands and convert to fadd. +; Same as above: if 'Z' is not -0.0, swap fsub operands and convert to fadd. define float @sub_sub_known_not_negzero(float %x, float %y) { ; CHECK-LABEL: @sub_sub_known_not_negzero( -; CHECK-NEXT: [[T1:%.*]] = fsub float [[X:%.*]], [[Y:%.*]] -; CHECK-NEXT: [[T2:%.*]] = fsub float 4.200000e+01, [[T1]] +; CHECK-NEXT: [[TMP1:%.*]] = fsub float [[Y:%.*]], [[X:%.*]] +; CHECK-NEXT: [[T2:%.*]] = fadd float [[TMP1]], 4.200000e+01 ; CHECK-NEXT: ret float [[T2]] ; %t1 = fsub float %x, %y |

