1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instsimplify -S | FileCheck %s
3 ; RUN: opt < %s -passes=instsimplify -use-constant-fp-for-fixed-length-splat -use-constant-int-for-fixed-length-splat -S | FileCheck %s
7 define i129 @vec_extract_negidx(<3 x i129> %a) {
8 ; CHECK-LABEL: @vec_extract_negidx(
9 ; CHECK-NEXT: ret i129 poison
11 %E1 = extractelement <3 x i129> %a, i129 -1
15 define i129 @vec_extract_out_of_bounds(<3 x i129> %a) {
16 ; CHECK-LABEL: @vec_extract_out_of_bounds(
17 ; CHECK-NEXT: ret i129 poison
19 %E1 = extractelement <3 x i129> %a, i129 3
23 define i129 @vec_extract_out_of_bounds2(<3 x i129> %a) {
24 ; CHECK-LABEL: @vec_extract_out_of_bounds2(
25 ; CHECK-NEXT: ret i129 poison
27 %E1 = extractelement <3 x i129> %a, i129 999999999999999
31 define i129 @vec_extract_undef_index(<3 x i129> %a) {
32 ; CHECK-LABEL: @vec_extract_undef_index(
33 ; CHECK-NEXT: ret i129 poison
35 %E1 = extractelement <3 x i129> %a, i129 undef
39 define i129 @vec_extract_poison_index(<3 x i129> %a) {
40 ; CHECK-LABEL: @vec_extract_poison_index(
41 ; CHECK-NEXT: ret i129 poison
43 %E1 = extractelement <3 x i129> %a, i129 poison
47 define i129 @vec_extract_in_bounds(<3 x i129> %a) {
48 ; CHECK-LABEL: @vec_extract_in_bounds(
49 ; CHECK-NEXT: [[E1:%.*]] = extractelement <3 x i129> [[A:%.*]], i129 2
50 ; CHECK-NEXT: ret i129 [[E1]]
52 %E1 = extractelement <3 x i129> %a, i129 2
56 define float @extract_element_splat_constant_vector_variable_index(i32 %y) {
57 ; CHECK-LABEL: @extract_element_splat_constant_vector_variable_index(
58 ; CHECK-NEXT: ret float 2.000000e+00
60 %r = extractelement <4 x float> <float 2.0, float 2.0, float 2.0, float 2.0>, i32 %y
64 define i32 @extractelement_splat_variable_index(i32 %v, i32 %index) {
65 ; CHECK-LABEL: @extractelement_splat_variable_index(
66 ; CHECK-NEXT: ret i32 [[V:%.*]]
68 %in = insertelement <3 x i32> poison, i32 %v, i32 0
69 %splat = shufflevector <3 x i32> %in, <3 x i32> poison, <3 x i32> zeroinitializer
70 %r = extractelement <3 x i32> %splat, i32 %index