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