blob: 2f5521fba87254e5ec374642aac83992aba5adcb [file] [log] [blame]
Dan Gohman6e68f592008-06-03 00:15:20 +00001; RUN: llvm-as < %s | llvm-dis > %t
2; RUN: grep insertvalue %t | count 1
3; RUN: grep extractvalue %t | count 1
Dan Gohmane4977cf2008-05-23 01:55:30 +00004
Dan Gohman6d986112008-06-03 01:21:11 +00005define float @foo({{i32},{float, double}}* %p) nounwind {
Dan Gohman81a0c0b2008-05-31 00:58:22 +00006 %t = load {{i32},{float, double}}* %p
7 %s = extractvalue {{i32},{float, double}} %t, 1, 0
8 %r = insertvalue {{i32},{float, double}} %t, double 2.0, 1, 1
9 store {{i32},{float, double}} %r, {{i32},{float, double}}* %p
10 ret float %s
11}
Dan Gohman6d986112008-06-03 01:21:11 +000012define float @bar({{i32},{float, double}}* %p) nounwind {
Dan Gohman81a0c0b2008-05-31 00:58:22 +000013 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
14 ret float extractvalue ({{i32},{float, double}}{{i32}{i32 3},{float, double}{float 7.0, double 9.0}}, 1, 0)
Dan Gohmane4977cf2008-05-23 01:55:30 +000015}
Dan Gohman6d986112008-06-03 01:21:11 +000016define float @car({{i32},{float, double}}* %p) nounwind {
Dan Gohman6e68f592008-06-03 00:15:20 +000017 store {{i32},{float, double}} insertvalue ({{i32},{float, double}} undef, double 20.0, 1, 1), {{i32},{float, double}}* %p
18 ret float extractvalue ({{i32},{float, double}} undef, 1, 0)
19}
Dan Gohman6d986112008-06-03 01:21:11 +000020define float @dar({{i32},{float, double}}* %p) nounwind {
Dan Gohman6e68f592008-06-03 00:15:20 +000021 store {{i32},{float, double}} insertvalue ({{i32},{float, double}} zeroinitializer, double 20.0, 1, 1), {{i32},{float, double}}* %p
22 ret float extractvalue ({{i32},{float, double}} zeroinitializer, 1, 0)
23}
Chris Lattnerdd4238e2009-09-15 06:28:12 +000024
25
26; PR4963
27define <{ i32, i32 }> @test57() {
28 ret <{ i32, i32 }> insertvalue (<{ i32, i32 }> zeroinitializer, i32 4, 1)
29}