1; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
2
3; CHECK:      @foo
4; CHECK-NEXT: load
5; CHECK-NEXT: extractvalue
6; CHECK-NEXT: insertvalue
7; CHECK-NEXT: store
8; CHECK-NEXT: ret
9define float @foo({{i32},{float, double}}* %p) nounwind {
10  %t = load {{i32},{float, double}}* %p
11  %s = extractvalue {{i32},{float, double}} %t, 1, 0
12  %r = insertvalue {{i32},{float, double}} %t, double 2.0, 1, 1
13  store {{i32},{float, double}} %r, {{i32},{float, double}}* %p
14  ret float %s
15}
16
17; CHECK:      @bar
18; CHECK-NEXT: store { { i32 }, { float, double } } { { i32 } { i32 4 }, { float, double } { float 4.000000e+00, double 2.000000e+01 } }, { { i32 }, { float, double } }* %p
19; CHECK-NEXT: ret float 7.000000e+00
20define float @bar({{i32},{float, double}}* %p) nounwind {
21  store {{i32},{float, double}} insertvalue ({{i32},{float, double}}{{i32}{i32 4},{float, double}{float 4.0, double 5.0}}, double 20.0, 1, 1), {{i32},{float, double}}* %p
22  ret float extractvalue ({{i32},{float, double}}{{i32}{i32 3},{float, double}{float 7.0, double 9.0}}, 1, 0)
23}
24
25; CHECK:      @car
26; CHECK-NEXT: store { { i32 }, { float, double } } { { i32 } undef, { float, double } { float undef, double 2.000000e+01 } }, { { i32 }, { float, double } }* %p
27; CHECK-NEXT: ret float undef
28define float @car({{i32},{float, double}}* %p) nounwind {
29  store {{i32},{float, double}} insertvalue ({{i32},{float, double}} undef, double 20.0, 1, 1), {{i32},{float, double}}* %p
30  ret float extractvalue ({{i32},{float, double}} undef, 1, 0)
31}
32
33; CHECK:      @dar
34; CHECK-NEXT: store { { i32 }, { float, double } } { { i32 } zeroinitializer, { float, double } { float 0.000000e+00, double 2.000000e+01 } }, { { i32 }, { float, double } }* %p
35; CHECK-NEXT: ret float 0.000000e+00
36define float @dar({{i32},{float, double}}* %p) nounwind {
37  store {{i32},{float, double}} insertvalue ({{i32},{float, double}} zeroinitializer, double 20.0, 1, 1), {{i32},{float, double}}* %p
38  ret float extractvalue ({{i32},{float, double}} zeroinitializer, 1, 0)
39}
40
41; PR4963
42; CHECK:      @test57
43; CHECK-NEXT: ret <{ i32, i32 }> <{ i32 0, i32 4 }>
44define <{ i32, i32 }> @test57() {
45  ret <{ i32, i32 }> insertvalue (<{ i32, i32 }> zeroinitializer, i32 4, 1)
46}
47