blob: 3fe52a00916d619c903ba310bafaba245d9eba65 [file] [log] [blame]
Tanya Lattner2acf9b02004-11-06 23:32:43 +00001; RUN: llvm-as -f %s -o %t.bc
2; RUN: lli %t.bc > /dev/null
3
Chris Lattner97c6c742002-12-15 07:55:43 +00004
Chris Lattner7014a112003-06-01 03:37:25 +00005
Chris Lattner35b32192003-01-13 00:56:37 +00006int %foo() {
7 ret int 0
8}
9
Chris Lattner97c6c742002-12-15 07:55:43 +000010int %main() {
Chris Lattner35b32192003-01-13 00:56:37 +000011 ; cast bool to ...
12 cast bool true to bool
Brian Gaeke1edc9632004-05-07 21:10:28 +000013 cast bool true to ubyte
14 cast bool true to sbyte
15 cast bool true to short
16 cast bool true to ushort
Chris Lattner97c6c742002-12-15 07:55:43 +000017 cast bool true to int
Brian Gaeke1edc9632004-05-07 21:10:28 +000018 cast bool true to uint
Chris Lattnerddfc3fb2003-01-16 19:43:11 +000019 cast bool true to long
20 cast bool true to ulong
21 cast bool true to float
22 cast bool true to double
Chris Lattner35b32192003-01-13 00:56:37 +000023
24 ; cast sbyte to ...
Brian Gaeke1edc9632004-05-07 21:10:28 +000025 cast sbyte 0 to bool
26 cast sbyte 1 to bool
Chris Lattner35b32192003-01-13 00:56:37 +000027 cast sbyte 0 to sbyte
Brian Gaeke1edc9632004-05-07 21:10:28 +000028 cast sbyte -1 to ubyte
Chris Lattner35b32192003-01-13 00:56:37 +000029 cast sbyte 4 to short
Brian Gaeke1edc9632004-05-07 21:10:28 +000030 cast sbyte 4 to ushort
Chris Lattner35b32192003-01-13 00:56:37 +000031 cast sbyte 4 to long
32 cast sbyte 4 to ulong
Brian Gaeke1edc9632004-05-07 21:10:28 +000033 cast sbyte 4 to float
Chris Lattner35b32192003-01-13 00:56:37 +000034 cast sbyte 4 to double
35
Chris Lattner5baf6532003-05-12 20:35:29 +000036 ; cast ubyte to ...
Brian Gaeke1edc9632004-05-07 21:10:28 +000037 cast ubyte 0 to bool
38 cast ubyte 1 to bool
39 cast ubyte 0 to sbyte
40 cast ubyte 1 to ubyte
41 cast ubyte 4 to short
42 cast ubyte 4 to ushort
43 cast ubyte 4 to long
44 cast ubyte 4 to ulong
Chris Lattner5baf6532003-05-12 20:35:29 +000045 cast ubyte 0 to float
46 cast ubyte 0 to double
47
Chris Lattner35b32192003-01-13 00:56:37 +000048 ; cast short to ...
Brian Gaeke1edc9632004-05-07 21:10:28 +000049 cast short 1 to bool
50 cast short -1 to sbyte
51 cast short 255 to ubyte
Chris Lattner35b32192003-01-13 00:56:37 +000052 cast short 0 to short
Brian Gaeke1edc9632004-05-07 21:10:28 +000053 cast short 0 to ushort
Chris Lattner35b32192003-01-13 00:56:37 +000054 cast short 0 to long
55 cast short 0 to ulong
Brian Gaeke1edc9632004-05-07 21:10:28 +000056 cast short 0 to float
Chris Lattner35b32192003-01-13 00:56:37 +000057 cast short 0 to double
58
Chris Lattner5baf6532003-05-12 20:35:29 +000059 ; cast ushort to ...
Brian Gaeke1edc9632004-05-07 21:10:28 +000060 cast ushort 1 to bool
61 cast ushort 1 to sbyte
62 cast ushort 255 to ubyte
63 cast ushort 0 to short
64 cast ushort 0 to ushort
65 cast ushort 0 to long
66 cast ushort 0 to ulong
Chris Lattner7ae106b2003-05-12 20:39:30 +000067 cast ushort 0 to float
68 cast ushort 0 to double
Chris Lattner5baf6532003-05-12 20:35:29 +000069
Chris Lattner35b32192003-01-13 00:56:37 +000070 ; cast int to ...
Chris Lattner97c6c742002-12-15 07:55:43 +000071 cast int 6 to bool
Brian Gaeke1edc9632004-05-07 21:10:28 +000072 cast int -6 to sbyte
73 cast int 6 to ubyte
Chris Lattner35b32192003-01-13 00:56:37 +000074 cast int 6 to short
75 cast int 0 to int
76 cast int 0 to long
77 cast int 0 to ulong
Chris Lattner5baf6532003-05-12 20:35:29 +000078 cast int 0 to float
Chris Lattner35b32192003-01-13 00:56:37 +000079 cast int 0 to double
80
81 ; cast uint to ...
Brian Gaeke1edc9632004-05-07 21:10:28 +000082 cast uint 6 to bool
83 cast uint 7 to sbyte
84 cast uint 8 to ubyte
85 cast uint 9 to short
86 cast uint 10 to int
Chris Lattner35b32192003-01-13 00:56:37 +000087 cast uint 0 to long
88 cast uint 0 to ulong
Chris Lattner7ae106b2003-05-12 20:39:30 +000089 cast uint 0 to float
90 cast uint 0 to double
Chris Lattner35b32192003-01-13 00:56:37 +000091
92 ; cast long to ...
Chris Lattner7014a112003-06-01 03:37:25 +000093 cast long 0 to bool
Chris Lattner35b32192003-01-13 00:56:37 +000094 cast long 0 to sbyte
95 cast long 0 to ubyte
96 cast long 0 to short
97 cast long 0 to ushort
98 cast long 0 to int
99 cast long 0 to uint
100 cast long 0 to long
101 cast long 0 to ulong
102 cast long 0 to float
103 cast long 0 to double
Chris Lattner7014a112003-06-01 03:37:25 +0000104
Brian Gaeke1edc9632004-05-07 21:10:28 +0000105 ; cast ulong to ...
106 cast ulong 1 to bool
107 cast ulong 1 to sbyte
108 cast ulong 1 to ubyte
109 cast ulong 1 to short
110 cast ulong 1 to ushort
111 cast ulong 1 to int
112 cast ulong 1 to uint
113 cast ulong 1 to long
114 cast ulong 1 to ulong
115 cast ulong 1 to float
116 cast ulong 0 to double
Chris Lattner35b32192003-01-13 00:56:37 +0000117
118 ; cast float to ...
Chris Lattnerddfc3fb2003-01-16 19:43:11 +0000119 ;cast float 0.0 to bool
Chris Lattner35b32192003-01-13 00:56:37 +0000120 cast float 0.0 to float
121 cast float 0.0 to double
122
123 ; cast double to ...
Chris Lattnerddfc3fb2003-01-16 19:43:11 +0000124 ;cast double 0.0 to bool
Chris Lattner35b32192003-01-13 00:56:37 +0000125 cast double 0.0 to sbyte
126 cast double 0.0 to ubyte
127 cast double 0.0 to short
128 cast double 0.0 to ushort
129 cast double 0.0 to int
130 cast double 0.0 to uint
131 cast double 0.0 to long
132 ;cast double 0.0 to ulong
133 cast double 0.0 to float
134 cast double 0.0 to double
Chris Lattner97c6c742002-12-15 07:55:43 +0000135
136 ret int 0
137}