1 ; RUN: llc < %s -mtriple=x86_64-pc-win32 | FileCheck %s
3 declare i32 @ret32(i32 returned)
4 declare i64 @ret64(i64 returned)
6 define i64 @test1(i64 %val) {
10 %in = trunc i64 %val to i32
11 tail call i32 @ret32(i32 returned %in)
15 define i32 @test2(i64 %val) {
19 %in = trunc i64 %val to i32
20 tail call i64 @ret64(i64 returned %val)
24 define i32 @test3(i64 %in) {
28 %small = trunc i64 %in to i32
29 tail call i32 @ret32(i32 returned %small)
33 declare {i32, i8} @take_i32_i8({i32, i8} returned)
34 define { i8, i8 } @test_nocommon_value({i32, i32} %in) {
35 ; CHECK-LABEL: test_nocommon_value
38 %first = extractvalue {i32, i32} %in, 0
39 %first.trunc = trunc i32 %first to i8
41 %second = extractvalue {i32, i32} %in, 1
42 %second.trunc = trunc i32 %second to i8
44 %tmp = insertvalue {i32, i8} undef, i32 %first, 0
45 %callval = insertvalue {i32, i8} %tmp, i8 %second.trunc, 1
46 tail call {i32, i8} @take_i32_i8({i32, i8} returned %callval)
48 %restmp = insertvalue {i8, i8} undef, i8 %first.trunc, 0
49 %res = insertvalue {i8, i8} %restmp, i8 %second.trunc, 1
53 declare {i32, {i32, i32}} @give_i32_i32_i32()
54 define {{i32, i32}, i32} @test_structs_different_shape() {
55 ; CHECK-LABEL: test_structs_different_shape
57 %val = tail call {i32, {i32, i32}} @give_i32_i32_i32()
59 %first = extractvalue {i32, {i32, i32}} %val, 0
60 %second = extractvalue {i32, {i32, i32}} %val, 1, 0
61 %third = extractvalue {i32, {i32, i32}} %val, 1, 1
63 %restmp = insertvalue {{i32, i32}, i32} undef, i32 %first, 0, 0
64 %reseventmper = insertvalue {{i32, i32}, i32} %restmp, i32 %second, 0, 1
65 %res = insertvalue {{i32, i32}, i32} %reseventmper, i32 %third, 1
67 ret {{i32, i32}, i32} %res
70 define i64 @test_undef_asymmetry() {
71 ; CHECK: test_undef_asymmetry
73 tail call i64 @ret64(i64 returned undef)
77 define {{}, {{}, i32, {}}, [1 x i32]} @evil_empty_aggregates() {
78 ; CHECK-LABEL: evil_empty_aggregates
80 %agg = tail call {i32, {i32, i32}} @give_i32_i32_i32()
82 %first = extractvalue {i32, {i32, i32}} %agg, 0
83 %second = extractvalue {i32, {i32, i32}} %agg, 1, 0
85 %restmp = insertvalue {{}, {{}, i32, {}}, [1 x i32]} undef, i32 %first, 1, 1
86 %res = insertvalue {{}, {{}, i32, {}}, [1 x i32]} %restmp, i32 %second, 2, 0
87 ret {{}, {{}, i32, {}}, [1 x i32]} %res
90 define i32 @structure_is_unimportant() {
91 ; CHECK-LABEL: structure_is_unimportant
93 %val = tail call {i32, {i32, i32}} @give_i32_i32_i32()
95 %res = extractvalue {i32, {i32, i32}} %val, 0