[llvm] r343529 - [InstCombine] add inverse test for vector trunc canonical form; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 1 13:25:49 PDT 2018


Author: spatel
Date: Mon Oct  1 13:25:49 2018
New Revision: 343529

URL: http://llvm.org/viewvc/llvm-project?rev=343529&view=rev
Log:
[InstCombine] add inverse test for vector trunc canonical form; NFC

Modified:
    llvm/trunk/test/Transforms/InstCombine/vector-casts.ll

Modified: llvm/trunk/test/Transforms/InstCombine/vector-casts.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/vector-casts.ll?rev=343529&r1=343528&r2=343529&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/vector-casts.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/vector-casts.ll Mon Oct  1 13:25:49 2018
@@ -2,8 +2,9 @@
 ; RUN: opt < %s -instcombine -S | FileCheck %s
 
 ; This turns into a&1 != 0
-define <2 x i1> @test1(<2 x i64> %a) {
-; CHECK-LABEL: @test1(
+
+define <2 x i1> @trunc(<2 x i64> %a) {
+; CHECK-LABEL: @trunc(
 ; CHECK-NEXT:    [[TMP1:%.*]] = and <2 x i64> [[A:%.*]], <i64 1, i64 1>
 ; CHECK-NEXT:    [[T:%.*]] = icmp ne <2 x i64> [[TMP1]], zeroinitializer
 ; CHECK-NEXT:    ret <2 x i1> [[T]]
@@ -12,6 +13,17 @@ define <2 x i1> @test1(<2 x i64> %a) {
   ret <2 x i1> %t
 }
 
+define <2 x i1> @and_cmp_is_trunc(<2 x i64> %a) {
+; CHECK-LABEL: @and_cmp_is_trunc(
+; CHECK-NEXT:    [[T:%.*]] = and <2 x i64> [[A:%.*]], <i64 1, i64 1>
+; CHECK-NEXT:    [[R:%.*]] = icmp ne <2 x i64> [[T]], zeroinitializer
+; CHECK-NEXT:    ret <2 x i1> [[R]]
+;
+  %t = and <2 x i64> %a, <i64 1, i64 1>
+  %r = icmp ne <2 x i64> %t, zeroinitializer
+  ret <2 x i1> %r
+}
+
 ; The ashr turns into an lshr.
 define <2 x i64> @test2(<2 x i64> %a) {
 ; CHECK-LABEL: @test2(




More information about the llvm-commits mailing list