summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2017-08-04 20:38:33 +0000
committerSanjay Patel <spatel@rotateright.com>2017-08-04 20:38:33 +0000
commit73ab438c480299110c84cc2b5677312dc97b5431 (patch)
tree0a4a250c345dfba49fef0c399c795b71330a5d32
parentbbe96e50f3bec29588bb873842e2b438536d3efc (diff)
downloadbcm5719-llvm-73ab438c480299110c84cc2b5677312dc97b5431.tar.gz
bcm5719-llvm-73ab438c480299110c84cc2b5677312dc97b5431.zip
[InstCombine] add vector tests for truncated math; NFC
llvm-svn: 310122
-rw-r--r--llvm/test/Transforms/InstCombine/trunc.ll22
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/trunc.ll b/llvm/test/Transforms/InstCombine/trunc.ll
index 3ba0b866e47..d606815f9bb 100644
--- a/llvm/test/Transforms/InstCombine/trunc.ll
+++ b/llvm/test/Transforms/InstCombine/trunc.ll
@@ -533,3 +533,25 @@ define <8 x i8> @wide_lengthening_splat(<4 x i16> %v) {
ret <8 x i8> %tr
}
+define <2 x i8> @narrow_add_vec_constant(<2 x i32> %x) {
+; CHECK-LABEL: @narrow_add_vec_constant(
+; CHECK-NEXT: [[ADD:%.*]] = add <2 x i32> %x, <i32 256, i32 -129>
+; CHECK-NEXT: [[TR:%.*]] = trunc <2 x i32> [[ADD]] to <2 x i8>
+; CHECK-NEXT: ret <2 x i8> [[TR]]
+;
+ %add = add <2 x i32> %x, <i32 256, i32 -129>
+ %tr = trunc <2 x i32> %add to <2 x i8>
+ ret <2 x i8> %tr
+}
+
+define <2 x i8> @narrow_sub_vec_constant(<2 x i32> %x) {
+; CHECK-LABEL: @narrow_sub_vec_constant(
+; CHECK-NEXT: [[SUB:%.*]] = sub <2 x i32> <i32 256, i32 -129>, %x
+; CHECK-NEXT: [[TR:%.*]] = trunc <2 x i32> [[SUB]] to <2 x i8>
+; CHECK-NEXT: ret <2 x i8> [[TR]]
+;
+ %sub = sub <2 x i32> <i32 256, i32 -129>, %x
+ %tr = trunc <2 x i32> %sub to <2 x i8>
+ ret <2 x i8> %tr
+}
+
OpenPOWER on IntegriCloud