OLD | NEW |
---|---|
(Empty) | |
1 ; Test handling of constants in function blocks. | |
2 | |
3 ; RUN: llvm-as < %s | pnacl-freeze \ | |
4 ; RUN: | %llvm2ice -notranslate -verbose=inst -build-on-read \ | |
5 ; RUN: -allow-pnacl-reader-error-recovery \ | |
6 ; RUN: | FileCheck %s | |
7 | |
8 | |
Jim Stichnoth
2014/09/05 23:34:29
A lot of blank lines here...
Karl
2014/09/08 20:41:39
Removed.
| |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 define void @TestIntegers() { | |
Jim Stichnoth
2014/09/05 23:34:29
I should point out that Subzero is not checking th
Karl
2014/09/08 20:41:39
Note that we are already using APInt and APFloat (
| |
16 ; CHECK: __0: | |
17 | |
18 ; Test various sized integers | |
19 %v0 = or i1 true, false | |
20 ; CHECK-NEXT: %__0 = or i1 true, false | |
21 | |
22 %v1 = add i8 0, 0 | |
23 ; CHECK-NEXT: %__1 = add i8 0, 0 | |
24 | |
25 %v2 = add i8 5, 0 | |
26 ; CHECK-NEXT: %__2 = add i8 5, 0 | |
27 | |
28 %v3 = add i8 -5, 0 | |
29 ; CHECK-NEXT: %__3 = add i8 -5, 0 | |
30 | |
31 %v4 = and i16 10, 0 | |
32 ; CHECK-NEXT: %__4 = and i16 10, 0 | |
33 | |
34 %v5 = add i16 -10, 0 | |
35 ; CHECK-NEXT: %__5 = add i16 -10, 0 | |
36 | |
37 %v6 = add i32 20, 0 | |
38 ; CHECK-NEXT: %__6 = add i32 20, 0 | |
39 | |
40 %v7 = add i32 -20, 0 | |
41 ; CHECK-NEXT: %__7 = add i32 -20, 0 | |
42 | |
43 %v8 = add i64 30, 0 | |
44 ; CHECK-NEXT: %__8 = add i64 30, 0 | |
45 | |
46 %v9 = add i64 -30, 0 | |
47 ; CHECK-NEXT: %__9 = add i64 -30, 0 | |
48 | |
49 ; Test undefined integer values. | |
50 %v10 = xor i1 undef, false | |
51 ; CHECK-NEXT: %__10 = xor i1 undef, false | |
52 | |
53 %v11 = add i8 undef, 0 | |
54 ; CHECK-NEXT: %__11 = add i8 undef, 0 | |
55 | |
56 %v12 = add i16 undef, 0 | |
57 ; CHECK-NEXT: %__12 = add i16 undef, 0 | |
58 | |
59 %v13 = add i32 undef, 0 | |
60 ; CHECK-NEXT: %__13 = add i32 undef, 0 | |
61 | |
62 %v14 = add i64 undef, 0 | |
63 ; CHECK-NEXT: %__14 = add i64 undef, 0 | |
64 | |
65 ret void | |
66 ; CHECK-NEXT: ret void | |
67 | |
68 } | |
69 | |
70 define void @TestFloats() { | |
71 ; CHECK: __0: | |
72 | |
73 ; Test float and double constants | |
74 %v0 = fadd float 1.0, 0.0 | |
75 ; CHECK-NEXT: %__0 = fadd float 1.000000e+00, 0.000000e+00 | |
Jim Stichnoth
2014/09/05 23:34:29
Subzero's FP dump routines don't try to be precise
Karl
2014/09/08 20:41:39
Agreed. Not changing since this test is for parsin
| |
76 | |
77 %v1 = fadd double 1.0, 0.0 | |
78 ; CHECK-NEXT: %__1 = fadd double 1.000000e+00, 0.000000e+00 | |
79 | |
80 %v2 = fsub float 7.000000e+00, 8.000000e+00 | |
81 ; CHECK-NEXT: %__2 = fsub float 7.000000e+00, 8.000000e+00 | |
82 | |
83 %v3 = fsub double 5.000000e+00, 6.000000e+00 | |
84 ; CHECK-NEXT: %__3 = fsub double 5.000000e+00, 6.000000e+00 | |
85 | |
86 ; Test undefined float and double. | |
87 %v4 = fadd float undef, 0.0 | |
88 ; CHECK-NEXT: %__4 = fadd float undef, 0.000000e+00 | |
89 | |
90 %v5 = fsub double undef, 6.000000e+00 | |
91 ; CHECK-NEXT: %__5 = fsub double undef, 6.000000e+00 | |
92 | |
93 ; Test special floating point constants. Note: LLVM assembly appears | |
94 ; to use 64-bit integer constants for both float and double. | |
95 | |
96 ; Generated from NAN in <math.h> | |
97 %v6 = fadd float 0x7FF8000000000000, 0.0 | |
98 ; CHECK-NEXT: %__6 = fadd float nan, 0.000000e+00 | |
99 | |
100 ; Generated from INFINITY in <math.h> | |
101 %v7 = fadd float 0x7FF0000000000000, 0.0 | |
102 ; CHECK-NEXT: %__7 = fadd float inf, 0.000000e+00 | |
103 | |
104 ; Generated from -INFINITY in <math.h> | |
105 %v8 = fadd float 0xFFF0000000000000, 0.0 | |
106 ; CHECK-NEXT: %__8 = fadd float -inf, 0.000000e+00 | |
107 | |
108 ; Generated from NAN in <math.h> | |
109 %v9 = fadd double 0x7FF8000000000000, 0.0 | |
110 ; CHECK-NEXT: %__9 = fadd double nan, 0.000000e+00 | |
111 | |
112 ; Generated from INFINITY in <math.h> | |
113 %v10 = fadd double 0x7FF0000000000000, 0.0 | |
114 ; CHECK-NEXT: %__10 = fadd double inf, 0.000000e+00 | |
115 | |
116 ; Generated from -INFINITY in <math.h> | |
117 %v11 = fadd double 0xFFF0000000000000, 0.0 | |
118 ; CHECK-NEXT: %__11 = fadd double -inf, 0.000000e+00 | |
Jim Stichnoth
2014/09/05 23:34:29
Other interesting FP constants include negative Na
Karl
2014/09/08 20:41:39
Done.
| |
119 | |
120 ret void | |
121 ; CHECK-NEXT: ret void | |
122 } | |
123 | |
OLD | NEW |