1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instsimplify -S | FileCheck %s
6 define i129 @vec_extract_negidx(<3 x i129> %a) {
7 ; CHECK-LABEL: @vec_extract_negidx(
8 ; CHECK-NEXT: ret i129 poison
10 %E1 = extractelement <3 x i129> %a, i129 -1
14 define i129 @vec_extract_out_of_bounds(<3 x i129> %a) {
15 ; CHECK-LABEL: @vec_extract_out_of_bounds(
16 ; CHECK-NEXT: ret i129 poison
18 %E1 = extractelement <3 x i129> %a, i129 3
22 define i129 @vec_extract_out_of_bounds2(<3 x i129> %a) {
23 ; CHECK-LABEL: @vec_extract_out_of_bounds2(
24 ; CHECK-NEXT: ret i129 poison
26 %E1 = extractelement <3 x i129> %a, i129 999999999999999
30 define i129 @vec_extract_undef_index(<3 x i129> %a) {
31 ; CHECK-LABEL: @vec_extract_undef_index(
32 ; CHECK-NEXT: ret i129 poison
34 %E1 = extractelement <3 x i129> %a, i129 undef
38 define i129 @vec_extract_poison_index(<3 x i129> %a) {
39 ; CHECK-LABEL: @vec_extract_poison_index(
40 ; CHECK-NEXT: ret i129 poison
42 %E1 = extractelement <3 x i129> %a, i129 poison
46 define i129 @vec_extract_in_bounds(<3 x i129> %a) {
47 ; CHECK-LABEL: @vec_extract_in_bounds(
48 ; CHECK-NEXT: [[E1:%.*]] = extractelement <3 x i129> [[A:%.*]], i129 2
49 ; CHECK-NEXT: ret i129 [[E1]]
51 %E1 = extractelement <3 x i129> %a, i129 2
55 define float @extract_element_splat_constant_vector_variable_index(i32 %y) {
56 ; CHECK-LABEL: @extract_element_splat_constant_vector_variable_index(
57 ; CHECK-NEXT: ret float 2.000000e+00
59 %r = extractelement <4 x float> <float 2.0, float 2.0, float 2.0, float 2.0>, i32 %y
63 define i32 @extractelement_splat_variable_index(i32 %v, i32 %index) {
64 ; CHECK-LABEL: @extractelement_splat_variable_index(
65 ; CHECK-NEXT: ret i32 [[V:%.*]]
67 %in = insertelement <3 x i32> poison, i32 %v, i32 0
68 %splat = shufflevector <3 x i32> %in, <3 x i32> poison, <3 x i32> zeroinitializer
69 %r = extractelement <3 x i32> %splat, i32 %index