[llvm] r343595 - [InstCombine] add tests with undef elements; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 2 08:00:57 PDT 2018


Author: spatel
Date: Tue Oct  2 08:00:56 2018
New Revision: 343595

URL: http://llvm.org/viewvc/llvm-project?rev=343595&view=rev
Log:
[InstCombine] add tests with undef elements; NFC

See discussion in D52747.

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=343595&r1=343594&r2=343595&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/vector-casts.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/vector-casts.ll Tue Oct  2 08:00:56 2018
@@ -2,6 +2,8 @@
 ; RUN: opt < %s -instcombine -S | FileCheck %s
 
 ; This turns into a&1 != 0
+; TODO: The bar for canonicalizing to something bigger than the minimal length IR is very high. 
+; This pattern does not appear to meet that standard.
 
 define <2 x i1> @trunc(<2 x i64> %a) {
 ; CHECK-LABEL: @trunc(
@@ -13,6 +15,8 @@ define <2 x i1> @trunc(<2 x i64> %a) {
   ret <2 x i1> %t
 }
 
+; TODO: This could be just 1 instruction (trunc). 
+
 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>
@@ -24,6 +28,32 @@ define <2 x i1> @and_cmp_is_trunc(<2 x i
   ret <2 x i1> %r
 }
 
+; TODO: This could be just 1 instruction (trunc). 
+
+define <2 x i1> @and_cmp_is_trunc_even_with_undef_elt(<2 x i64> %a) {
+; CHECK-LABEL: @and_cmp_is_trunc_even_with_undef_elt(
+; CHECK-NEXT:    [[T:%.*]] = and <2 x i64> [[A:%.*]], <i64 undef, 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 undef, i64 1>
+  %r = icmp ne <2 x i64> %t, zeroinitializer
+  ret <2 x i1> %r
+}
+
+; TODO: This could be just 1 instruction (trunc). 
+
+define <2 x i1> @and_cmp_is_trunc_even_with_undef_elts(<2 x i64> %a) {
+; CHECK-LABEL: @and_cmp_is_trunc_even_with_undef_elts(
+; CHECK-NEXT:    [[T:%.*]] = and <2 x i64> [[A:%.*]], <i64 undef, i64 1>
+; CHECK-NEXT:    [[R:%.*]] = icmp ne <2 x i64> [[T]], <i64 undef, i64 0>
+; CHECK-NEXT:    ret <2 x i1> [[R]]
+;
+  %t = and <2 x i64> %a, <i64 undef, i64 1>
+  %r = icmp ne <2 x i64> %t, <i64 undef, i64 0>
+  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