1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2 ; RUN: opt < %s -instsimplify -S | FileCheck %s 3 4 ; If computeKnownBits can do a simple look-through for extractelement 5 ; then instsimplify will know that %elt1 is non-negative at icmp. 6 define i1 @computeKnownBits_look_through_extractelt(<2 x i8> %vecin) { 7 ; CHECK-LABEL: @computeKnownBits_look_through_extractelt( 8 ; CHECK-NEXT: ret i1 false 9 ; 10 %vec = zext <2 x i8> %vecin to <2 x i32> 11 %elt1 = extractelement <2 x i32> %vec, i32 1 12 %bool = icmp slt i32 %elt1, 0 13 ret i1 %bool 14 } 15 16 ; If computeNumSignBits can do a simple look-through for extractelement 17 ; then instsimplify will remove the ashr. 18 define i32 @computeNumSignBits_look_through_extractelt(<2 x i1> %vecin) { 19 ; CHECK-LABEL: @computeNumSignBits_look_through_extractelt( 20 ; CHECK-NEXT: [[VEC:%.*]] = sext <2 x i1> [[VEC:%.*]]in to <2 x i32> 21 ; CHECK-NEXT: [[ELT0:%.*]] = extractelement <2 x i32> [[VEC]], i32 0 22 ; CHECK-NEXT: ret i32 [[ELT0]] 23 ; 24 %vec = sext <2 x i1> %vecin to <2 x i32> 25 %elt0 = extractelement <2 x i32> %vec, i32 0 26 %ashr = ashr i32 %elt0, 5 27 ret i32 %ashr 28 } 29