blob: 97e71570f7ff5e44720ebacdc4a63035ba073de4 [file] [log] [blame]
Reid Spencer81daddb2006-12-19 02:09:20 +00001; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
Tanya Lattnere9789ef2004-11-06 23:32:43 +00002; RUN: lli %t.bc > /dev/null
3
Chris Lattnera4c096d2002-12-15 07:55:43 +00004
Chris Lattner102f5332003-01-13 00:56:37 +00005int %foo() {
6 ret int 0
7}
8
Chris Lattnera4c096d2002-12-15 07:55:43 +00009int %main() {
Chris Lattner102f5332003-01-13 00:56:37 +000010 ; cast bool to ...
11 cast bool true to bool
Brian Gaeke2c9a94c2004-05-07 21:10:28 +000012 cast bool true to ubyte
13 cast bool true to sbyte
14 cast bool true to short
15 cast bool true to ushort
Chris Lattnera4c096d2002-12-15 07:55:43 +000016 cast bool true to int
Brian Gaeke2c9a94c2004-05-07 21:10:28 +000017 cast bool true to uint
Chris Lattner20c1b4d2003-01-16 19:43:11 +000018 cast bool true to long
19 cast bool true to ulong
20 cast bool true to float
21 cast bool true to double
Chris Lattner102f5332003-01-13 00:56:37 +000022
23 ; cast sbyte to ...
Brian Gaeke2c9a94c2004-05-07 21:10:28 +000024 cast sbyte 0 to bool
25 cast sbyte 1 to bool
Chris Lattner102f5332003-01-13 00:56:37 +000026 cast sbyte 0 to sbyte
Brian Gaeke2c9a94c2004-05-07 21:10:28 +000027 cast sbyte -1 to ubyte
Chris Lattner102f5332003-01-13 00:56:37 +000028 cast sbyte 4 to short
Brian Gaeke2c9a94c2004-05-07 21:10:28 +000029 cast sbyte 4 to ushort
Chris Lattner102f5332003-01-13 00:56:37 +000030 cast sbyte 4 to long
31 cast sbyte 4 to ulong
Brian Gaeke2c9a94c2004-05-07 21:10:28 +000032 cast sbyte 4 to float
Chris Lattner102f5332003-01-13 00:56:37 +000033 cast sbyte 4 to double
34
Chris Lattner4f912852003-05-12 20:35:29 +000035 ; cast ubyte to ...
Brian Gaeke2c9a94c2004-05-07 21:10:28 +000036 cast ubyte 0 to bool
37 cast ubyte 1 to bool
38 cast ubyte 0 to sbyte
39 cast ubyte 1 to ubyte
40 cast ubyte 4 to short
41 cast ubyte 4 to ushort
42 cast ubyte 4 to long
43 cast ubyte 4 to ulong
Chris Lattner4f912852003-05-12 20:35:29 +000044 cast ubyte 0 to float
45 cast ubyte 0 to double
46
Chris Lattner102f5332003-01-13 00:56:37 +000047 ; cast short to ...
Brian Gaeke2c9a94c2004-05-07 21:10:28 +000048 cast short 1 to bool
49 cast short -1 to sbyte
50 cast short 255 to ubyte
Chris Lattner102f5332003-01-13 00:56:37 +000051 cast short 0 to short
Brian Gaeke2c9a94c2004-05-07 21:10:28 +000052 cast short 0 to ushort
Chris Lattner102f5332003-01-13 00:56:37 +000053 cast short 0 to long
54 cast short 0 to ulong
Brian Gaeke2c9a94c2004-05-07 21:10:28 +000055 cast short 0 to float
Chris Lattner102f5332003-01-13 00:56:37 +000056 cast short 0 to double
57
Chris Lattner4f912852003-05-12 20:35:29 +000058 ; cast ushort to ...
Brian Gaeke2c9a94c2004-05-07 21:10:28 +000059 cast ushort 1 to bool
60 cast ushort 1 to sbyte
61 cast ushort 255 to ubyte
62 cast ushort 0 to short
63 cast ushort 0 to ushort
64 cast ushort 0 to long
65 cast ushort 0 to ulong
Chris Lattner8c191942003-05-12 20:39:30 +000066 cast ushort 0 to float
67 cast ushort 0 to double
Chris Lattner4f912852003-05-12 20:35:29 +000068
Chris Lattner102f5332003-01-13 00:56:37 +000069 ; cast int to ...
Chris Lattnera4c096d2002-12-15 07:55:43 +000070 cast int 6 to bool
Brian Gaeke2c9a94c2004-05-07 21:10:28 +000071 cast int -6 to sbyte
72 cast int 6 to ubyte
Chris Lattner102f5332003-01-13 00:56:37 +000073 cast int 6 to short
74 cast int 0 to int
75 cast int 0 to long
76 cast int 0 to ulong
Chris Lattner4f912852003-05-12 20:35:29 +000077 cast int 0 to float
Chris Lattner102f5332003-01-13 00:56:37 +000078 cast int 0 to double
79
80 ; cast uint to ...
Brian Gaeke2c9a94c2004-05-07 21:10:28 +000081 cast uint 6 to bool
82 cast uint 7 to sbyte
83 cast uint 8 to ubyte
84 cast uint 9 to short
85 cast uint 10 to int
Chris Lattner102f5332003-01-13 00:56:37 +000086 cast uint 0 to long
87 cast uint 0 to ulong
Chris Lattner8c191942003-05-12 20:39:30 +000088 cast uint 0 to float
89 cast uint 0 to double
Chris Lattner102f5332003-01-13 00:56:37 +000090
91 ; cast long to ...
Chris Lattneraf2f4382003-06-01 03:37:25 +000092 cast long 0 to bool
Chris Lattner102f5332003-01-13 00:56:37 +000093 cast long 0 to sbyte
94 cast long 0 to ubyte
95 cast long 0 to short
96 cast long 0 to ushort
97 cast long 0 to int
98 cast long 0 to uint
99 cast long 0 to long
100 cast long 0 to ulong
101 cast long 0 to float
102 cast long 0 to double
Chris Lattneraf2f4382003-06-01 03:37:25 +0000103
Brian Gaeke2c9a94c2004-05-07 21:10:28 +0000104 ; cast ulong to ...
105 cast ulong 1 to bool
106 cast ulong 1 to sbyte
107 cast ulong 1 to ubyte
108 cast ulong 1 to short
109 cast ulong 1 to ushort
110 cast ulong 1 to int
111 cast ulong 1 to uint
112 cast ulong 1 to long
113 cast ulong 1 to ulong
114 cast ulong 1 to float
115 cast ulong 0 to double
Chris Lattner102f5332003-01-13 00:56:37 +0000116
117 ; cast float to ...
Chris Lattner20c1b4d2003-01-16 19:43:11 +0000118 ;cast float 0.0 to bool
Chris Lattner102f5332003-01-13 00:56:37 +0000119 cast float 0.0 to float
120 cast float 0.0 to double
121
122 ; cast double to ...
Chris Lattner20c1b4d2003-01-16 19:43:11 +0000123 ;cast double 0.0 to bool
Chris Lattner102f5332003-01-13 00:56:37 +0000124 cast double 0.0 to sbyte
125 cast double 0.0 to ubyte
126 cast double 0.0 to short
127 cast double 0.0 to ushort
128 cast double 0.0 to int
129 cast double 0.0 to uint
130 cast double 0.0 to long
131 ;cast double 0.0 to ulong
132 cast double 0.0 to float
133 cast double 0.0 to double
Chris Lattnera4c096d2002-12-15 07:55:43 +0000134
135 ret int 0
136}