diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2018-10-19 17:26:22 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2018-10-19 17:26:22 +0000 |
| commit | ce3f1915f38f329a867dfb10ed1e82b49d4b52dc (patch) | |
| tree | 50bfece3136aa6e68deac4e5726dd64b7d77c816 /llvm/test/Transforms/InstSimplify | |
| parent | 749c1b597a8f2f544d285e9cf5fe18552a3a0137 (diff) | |
| download | bcm5719-llvm-ce3f1915f38f329a867dfb10ed1e82b49d4b52dc.tar.gz bcm5719-llvm-ce3f1915f38f329a867dfb10ed1e82b49d4b52dc.zip | |
[InstCombine] move/add tests for sub/neg; NFC
These should all be handled using "dyn_castNegVal",
but that misses vectors with undef elements.
llvm-svn: 344790
Diffstat (limited to 'llvm/test/Transforms/InstSimplify')
| -rw-r--r-- | llvm/test/Transforms/InstSimplify/sub.ll | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstSimplify/sub.ll b/llvm/test/Transforms/InstSimplify/sub.ll new file mode 100644 index 00000000000..4e2064527c4 --- /dev/null +++ b/llvm/test/Transforms/InstSimplify/sub.ll @@ -0,0 +1,53 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt < %s -instsimplify -S | FileCheck %s + +define i32 @sub_self(i32 %A) { +; CHECK-LABEL: @sub_self( +; CHECK-NEXT: ret i32 0 +; + %B = sub i32 %A, %A + ret i32 %B +} + +define <2 x i32> @sub_self_vec(<2 x i32> %A) { +; CHECK-LABEL: @sub_self_vec( +; CHECK-NEXT: ret <2 x i32> zeroinitializer +; + %B = sub <2 x i32> %A, %A + ret <2 x i32> %B +} + +define i32 @sub_zero(i32 %A) { +; CHECK-LABEL: @sub_zero( +; CHECK-NEXT: ret i32 [[A:%.*]] +; + %B = sub i32 %A, 0 + ret i32 %B +} + +define <2 x i32> @sub_zero_vec(<2 x i32> %A) { +; CHECK-LABEL: @sub_zero_vec( +; CHECK-NEXT: ret <2 x i32> [[A:%.*]] +; + %B = sub <2 x i32> %A, <i32 0, i32 undef> + ret <2 x i32> %B +} + +define i32 @neg_neg(i32 %A) { +; CHECK-LABEL: @neg_neg( +; CHECK-NEXT: ret i32 [[A:%.*]] +; + %B = sub i32 0, %A + %C = sub i32 0, %B + ret i32 %C +} + +define <2 x i32> @neg_neg_vec(<2 x i32> %A) { +; CHECK-LABEL: @neg_neg_vec( +; CHECK-NEXT: ret <2 x i32> [[A:%.*]] +; + %B = sub <2 x i32> <i32 0, i32 undef>, %A + %C = sub <2 x i32> <i32 0, i32 undef>, %B + ret <2 x i32> %C +} + |

