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 define void @TestIntegers() { |
| 9 ; CHECK: __0: |
| 10 |
| 11 ; Test various sized integers |
| 12 %v0 = or i1 true, false |
| 13 ; CHECK-NEXT: %__0 = or i1 true, false |
| 14 |
| 15 %v1 = add i8 0, 0 |
| 16 ; CHECK-NEXT: %__1 = add i8 0, 0 |
| 17 |
| 18 %v2 = add i8 5, 0 |
| 19 ; CHECK-NEXT: %__2 = add i8 5, 0 |
| 20 |
| 21 %v3 = add i8 -5, 0 |
| 22 ; CHECK-NEXT: %__3 = add i8 -5, 0 |
| 23 |
| 24 %v4 = and i16 10, 0 |
| 25 ; CHECK-NEXT: %__4 = and i16 10, 0 |
| 26 |
| 27 %v5 = add i16 -10, 0 |
| 28 ; CHECK-NEXT: %__5 = add i16 -10, 0 |
| 29 |
| 30 %v6 = add i32 20, 0 |
| 31 ; CHECK-NEXT: %__6 = add i32 20, 0 |
| 32 |
| 33 %v7 = add i32 -20, 0 |
| 34 ; CHECK-NEXT: %__7 = add i32 -20, 0 |
| 35 |
| 36 %v8 = add i64 30, 0 |
| 37 ; CHECK-NEXT: %__8 = add i64 30, 0 |
| 38 |
| 39 %v9 = add i64 -30, 0 |
| 40 ; CHECK-NEXT: %__9 = add i64 -30, 0 |
| 41 |
| 42 ; Test undefined integer values. |
| 43 %v10 = xor i1 undef, false |
| 44 ; CHECK-NEXT: %__10 = xor i1 undef, false |
| 45 |
| 46 %v11 = add i8 undef, 0 |
| 47 ; CHECK-NEXT: %__11 = add i8 undef, 0 |
| 48 |
| 49 %v12 = add i16 undef, 0 |
| 50 ; CHECK-NEXT: %__12 = add i16 undef, 0 |
| 51 |
| 52 %v13 = add i32 undef, 0 |
| 53 ; CHECK-NEXT: %__13 = add i32 undef, 0 |
| 54 |
| 55 %v14 = add i64 undef, 0 |
| 56 ; CHECK-NEXT: %__14 = add i64 undef, 0 |
| 57 |
| 58 ret void |
| 59 ; CHECK-NEXT: ret void |
| 60 |
| 61 } |
| 62 |
| 63 define void @TestFloats() { |
| 64 ; CHECK: __0: |
| 65 |
| 66 ; Test float and double constants |
| 67 %v0 = fadd float 1.0, 0.0 |
| 68 ; CHECK-NEXT: %__0 = fadd float 1.000000e+00, 0.000000e+00 |
| 69 |
| 70 %v1 = fadd double 1.0, 0.0 |
| 71 ; CHECK-NEXT: %__1 = fadd double 1.000000e+00, 0.000000e+00 |
| 72 |
| 73 %v2 = fsub float 7.000000e+00, 8.000000e+00 |
| 74 ; CHECK-NEXT: %__2 = fsub float 7.000000e+00, 8.000000e+00 |
| 75 |
| 76 %v3 = fsub double 5.000000e+00, 6.000000e+00 |
| 77 ; CHECK-NEXT: %__3 = fsub double 5.000000e+00, 6.000000e+00 |
| 78 |
| 79 ; Test undefined float and double. |
| 80 %v4 = fadd float undef, 0.0 |
| 81 ; CHECK-NEXT: %__4 = fadd float undef, 0.000000e+00 |
| 82 |
| 83 %v5 = fsub double undef, 6.000000e+00 |
| 84 ; CHECK-NEXT: %__5 = fsub double undef, 6.000000e+00 |
| 85 |
| 86 ; Test special floating point constants. Note: LLVM assembly appears |
| 87 ; to use 64-bit integer constants for both float and double. |
| 88 |
| 89 ; Generated from NAN in <math.h> |
| 90 %v6 = fadd float 0x7FF8000000000000, 0.0 |
| 91 ; CHECK-NEXT: %__6 = fadd float nan, 0.000000e+00 |
| 92 |
| 93 ; Generated from -NAN in <math.h> |
| 94 %v7 = fadd float 0xFFF8000000000000, 0.0 |
| 95 ; CHECK-NEXT: %__7 = fadd float -nan, 0.000000e+00 |
| 96 |
| 97 ; Generated from INFINITY in <math.h> |
| 98 %v8 = fadd float 0x7FF0000000000000, 0.0 |
| 99 ; CHECK-NEXT: %__8 = fadd float inf, 0.000000e+00 |
| 100 |
| 101 ; Generated from -INFINITY in <math.h> |
| 102 %v9 = fadd float 0xFFF0000000000000, 0.0 |
| 103 ; CHECK-NEXT: %__9 = fadd float -inf, 0.000000e+00 |
| 104 |
| 105 ; Generated from FLT_MIN in <float.h> |
| 106 %v10 = fadd float 0x381000000000000000, 0.0 |
| 107 ; CHECK-NEXT: %__10 = fadd float 0.000000e+00, 0.000000e+00 |
| 108 |
| 109 ; Generated from -FLT_MIN in <float.h> |
| 110 %v11 = fadd float 0xb81000000000000000, 0.0 |
| 111 ; CHECK-NEXT: %__11 = fadd float 0.000000e+00, 0.000000e+00 |
| 112 |
| 113 ; Generated from FLT_MAX in <float.h> |
| 114 %v12 = fadd float 340282346638528859811704183484516925440.000000, 0.0 |
| 115 ; CHECK-NEXT: %__12 = fadd float 3.402823e+38, 0.000000e+00 |
| 116 |
| 117 ; Generated from -FLT_MAX in <float.h> |
| 118 %v13 = fadd float -340282346638528859811704183484516925440.000000, 0.0 |
| 119 ; CHECK-NEXT: %__13 = fadd float -3.402823e+38, 0.000000e+00 |
| 120 |
| 121 ; Generated from NAN in <math.h> |
| 122 %v14 = fadd double 0x7FF8000000000000, 0.0 |
| 123 ; CHECK-NEXT: %__14 = fadd double nan, 0.000000e+00 |
| 124 |
| 125 ; Generated from -NAN in <math.h> |
| 126 %v15 = fadd double 0xFFF8000000000000, 0.0 |
| 127 ; CHECK-NEXT: %__15 = fadd double -nan, 0.000000e+00 |
| 128 |
| 129 ; Generated from INFINITY in <math.h> |
| 130 %v16 = fadd double 0x7FF0000000000000, 0.0 |
| 131 ; CHECK-NEXT: %__16 = fadd double inf, 0.000000e+00 |
| 132 |
| 133 ; Generated from -INFINITY in <math.h> |
| 134 %v17 = fadd double 0xFFF0000000000000, 0.0 |
| 135 ; CHECK-NEXT: %__17 = fadd double -inf, 0.000000e+00 |
| 136 |
| 137 ; Generated from DBL_MIN in <float.h> |
| 138 %v18 = fadd double 0x0010000000000000, 0.0 |
| 139 ; CHECK-NEXT: %__18 = fadd double 2.225074e-308, 0.000000e+00 |
| 140 |
| 141 ; Generated from -DBL_MIN in <float.h> |
| 142 %v19 = fadd double 0x8010000000000000, 0.0 |
| 143 ; CHECK-NEXT: %__19 = fadd double -2.225074e-308, 0.000000e+00 |
| 144 |
| 145 ; Generated from DBL_MAX in <float.h> |
| 146 %v20 = fadd double 17976931348623157081452742373170435679807056752584499659891
74768031572607800285387605895586327668781715404589535143824642343213268894641827
68467546703537516986049910576551282076245490090389328944075868508455133942304583
23690322294816580855933212334827479782620414472316873817718091929988125040402618
4124858368.000000, 0.0 |
| 147 ; CHECK-NEXT: %__20 = fadd double 1.797693e+308, 0.000000e+00 |
| 148 |
| 149 ; Generated from -DBL_MAX in <float.h> |
| 150 %v21 = fadd double -1797693134862315708145274237317043567980705675258449965989
17476803157260780028538760589558632766878171540458953514382464234321326889464182
76846754670353751698604991057655128207624549009038932894407586850845513394230458
32369032229481658085593321233482747978262041447231687381771809192998812504040261
84124858368.000000, 0.0 |
| 151 ; CHECK-NEXT: %__21 = fadd double -1.797693e+308, 0.000000e+00 |
| 152 |
| 153 ret void |
| 154 ; CHECK-NEXT: ret void |
| 155 } |
OLD | NEW |