aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/Transforms/InstSimplify/vector-inseltextelt.ll
blob: f7162965185b365c9c5d6cfdcdcd77d10d0f5010 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=instsimplify -S | FileCheck %s

; extracting a just-inserted element should yield the original value
define float @constant_index(<4 x float> %x, float %val) {
; CHECK-LABEL: @constant_index(
; CHECK-NEXT:    ret float [[VAL:%.*]]
;
  %ins = insertelement <4 x float> %x, float %val, i32 1
  %ext = extractelement <4 x float> %ins, i32 1
  ret float %ext
}

; extracting a just-inserted element should yield the original value even if
; the index is dynamic
define float @dynamic_index(<4 x float> %x, float %val, i32 %idx) {
; CHECK-LABEL: @dynamic_index(
; CHECK-NEXT:    ret float [[VAL:%.*]]
;
  %ins = insertelement <4 x float> %x, float %val, i32 %idx
  %ext = extractelement <4 x float> %ins, i32 %idx
  ret float %ext
}