1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -instsimplify -S | FileCheck %s
3
4; Weird Types
5
6define i129 @vec_extract_negidx(<3 x i129> %a) {
7; CHECK-LABEL: @vec_extract_negidx(
8; CHECK-NEXT:    ret i129 undef
9;
10  %E1 = extractelement <3 x i129> %a, i129 -1
11  ret i129 %E1
12}
13
14define i129 @vec_extract_out_of_bounds(<3 x i129> %a) {
15; CHECK-LABEL: @vec_extract_out_of_bounds(
16; CHECK-NEXT:    ret i129 undef
17;
18  %E1 = extractelement <3 x i129> %a, i129 3
19  ret i129 %E1
20}
21
22define i129 @vec_extract_out_of_bounds2(<3 x i129> %a) {
23; CHECK-LABEL: @vec_extract_out_of_bounds2(
24; CHECK-NEXT:    ret i129 undef
25;
26  %E1 = extractelement <3 x i129> %a, i129 999999999999999
27  ret i129 %E1
28}
29
30
31define i129 @vec_extract_undef_index(<3 x i129> %a) {
32; CHECK-LABEL: @vec_extract_undef_index(
33; CHECK-NEXT:    ret i129 undef
34;
35  %E1 = extractelement <3 x i129> %a, i129 undef
36  ret i129 %E1
37}
38
39
40define i129 @vec_extract_poison_index(<3 x i129> %a) {
41; CHECK-LABEL: @vec_extract_poison_index(
42; CHECK-NEXT:    ret i129 undef
43;
44  %E1 = extractelement <3 x i129> %a, i129 poison
45  ret i129 %E1
46}
47
48
49define i129 @vec_extract_in_bounds(<3 x i129> %a) {
50; CHECK-LABEL: @vec_extract_in_bounds(
51; CHECK-NEXT:    [[E1:%.*]] = extractelement <3 x i129> [[A:%.*]], i129 2
52; CHECK-NEXT:    ret i129 [[E1]]
53;
54  %E1 = extractelement <3 x i129> %a, i129 2
55  ret i129 %E1
56}
57
58define float @extract_element_splat_constant_vector_variable_index(i32 %y) {
59; CHECK-LABEL: @extract_element_splat_constant_vector_variable_index(
60; CHECK-NEXT:    ret float 2.000000e+00
61;
62  %r = extractelement <4 x float> <float 2.0, float 2.0, float 2.0, float 2.0>, i32 %y
63  ret float %r
64}
65
66