[llvm] r310122 - [InstCombine] add vector tests for truncated math; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 4 13:38:33 PDT 2017


Author: spatel
Date: Fri Aug  4 13:38:33 2017
New Revision: 310122

URL: http://llvm.org/viewvc/llvm-project?rev=310122&view=rev
Log:
[InstCombine] add vector tests for truncated math; NFC

Modified:
    llvm/trunk/test/Transforms/InstCombine/trunc.ll

Modified: llvm/trunk/test/Transforms/InstCombine/trunc.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/trunc.ll?rev=310122&r1=310121&r2=310122&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/trunc.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/trunc.ll Fri Aug  4 13:38:33 2017
@@ -533,3 +533,25 @@ define <8 x i8> @wide_lengthening_splat(
   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
+}
+




More information about the llvm-commits mailing list