1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instsimplify -S | FileCheck %s
4 ; extracting a just-inserted element should yield the original value
5 define float @constant_index(<4 x float> %x, float %val) {
6 ; CHECK-LABEL: @constant_index(
7 ; CHECK-NEXT: ret float [[VAL:%.*]]
9 %ins = insertelement <4 x float> %x, float %val, i32 1
10 %ext = extractelement <4 x float> %ins, i32 1
14 ; extracting a just-inserted element should yield the original value even if
15 ; the index is dynamic
16 define float @dynamic_index(<4 x float> %x, float %val, i32 %idx) {
17 ; CHECK-LABEL: @dynamic_index(
18 ; CHECK-NEXT: ret float [[VAL:%.*]]
20 %ins = insertelement <4 x float> %x, float %val, i32 %idx
21 %ext = extractelement <4 x float> %ins, i32 %idx