1 ; RUN: llc < %s -asm-verbose=false | FileCheck %s 2 3 ; Test that basic immediates assemble as expected. 4 5 target datalayout = "e-p:32:32-i64:64-n32:64-S128" 6 target triple = "wasm32-unknown-unknown" 7 8 ; CHECK-LABEL: zero_i32: 9 ; CHECK-NEXT: .result i32{{$}} 10 ; CHECK-NEXT: i32.const $push[[NUM:[0-9]+]]=, 0{{$}} 11 ; CHECK-NEXT: return $pop[[NUM]]{{$}} 12 define i32 @zero_i32() { 13 ret i32 0 14 } 15 16 ; CHECK-LABEL: one_i32: 17 ; CHECK-NEXT: .result i32{{$}} 18 ; CHECK-NEXT: i32.const $push[[NUM:[0-9]+]]=, 1{{$}} 19 ; CHECK-NEXT: return $pop[[NUM]]{{$}} 20 define i32 @one_i32() { 21 ret i32 1 22 } 23 24 ; CHECK-LABEL: max_i32: 25 ; CHECK-NEXT: .result i32{{$}} 26 ; CHECK-NEXT: i32.const $push[[NUM:[0-9]+]]=, 2147483647{{$}} 27 ; CHECK-NEXT: return $pop[[NUM]]{{$}} 28 define i32 @max_i32() { 29 ret i32 2147483647 30 } 31 32 ; CHECK-LABEL: min_i32: 33 ; CHECK-NEXT: .result i32{{$}} 34 ; CHECK-NEXT: i32.const $push[[NUM:[0-9]+]]=, -2147483648{{$}} 35 ; CHECK-NEXT: return $pop[[NUM]]{{$}} 36 define i32 @min_i32() { 37 ret i32 -2147483648 38 } 39 40 ; CHECK-LABEL: zero_i64: 41 ; CHECK-NEXT: .result i64{{$}} 42 ; CHECK-NEXT: i64.const $push[[NUM:[0-9]+]]=, 0{{$}} 43 ; CHECK-NEXT: return $pop[[NUM]]{{$}} 44 define i64 @zero_i64() { 45 ret i64 0 46 } 47 48 ; CHECK-LABEL: one_i64: 49 ; CHECK-NEXT: .result i64{{$}} 50 ; CHECK-NEXT: i64.const $push[[NUM:[0-9]+]]=, 1{{$}} 51 ; CHECK-NEXT: return $pop[[NUM]]{{$}} 52 define i64 @one_i64() { 53 ret i64 1 54 } 55 56 ; CHECK-LABEL: max_i64: 57 ; CHECK-NEXT: .result i64{{$}} 58 ; CHECK-NEXT: i64.const $push[[NUM:[0-9]+]]=, 9223372036854775807{{$}} 59 ; CHECK-NEXT: return $pop[[NUM]]{{$}} 60 define i64 @max_i64() { 61 ret i64 9223372036854775807 62 } 63 64 ; CHECK-LABEL: min_i64: 65 ; CHECK-NEXT: .result i64{{$}} 66 ; CHECK-NEXT: i64.const $push[[NUM:[0-9]+]]=, -9223372036854775808{{$}} 67 ; CHECK-NEXT: return $pop[[NUM]]{{$}} 68 define i64 @min_i64() { 69 ret i64 -9223372036854775808 70 } 71 72 ; CHECK-LABEL: negzero_f32: 73 ; CHECK-NEXT: .result f32{{$}} 74 ; CHECK-NEXT: f32.const $push[[NUM:[0-9]+]]=, -0x0p0{{$}} 75 ; CHECK-NEXT: return $pop[[NUM]]{{$}} 76 define float @negzero_f32() { 77 ret float -0.0 78 } 79 80 ; CHECK-LABEL: zero_f32: 81 ; CHECK-NEXT: .result f32{{$}} 82 ; CHECK-NEXT: f32.const $push[[NUM:[0-9]+]]=, 0x0p0{{$}} 83 ; CHECK-NEXT: return $pop[[NUM]]{{$}} 84 define float @zero_f32() { 85 ret float 0.0 86 } 87 88 ; CHECK-LABEL: one_f32: 89 ; CHECK-NEXT: .result f32{{$}} 90 ; CHECK-NEXT: f32.const $push[[NUM:[0-9]+]]=, 0x1p0{{$}} 91 ; CHECK-NEXT: return $pop[[NUM]]{{$}} 92 define float @one_f32() { 93 ret float 1.0 94 } 95 96 ; CHECK-LABEL: two_f32: 97 ; CHECK-NEXT: .result f32{{$}} 98 ; CHECK-NEXT: f32.const $push[[NUM:[0-9]+]]=, 0x1p1{{$}} 99 ; CHECK-NEXT: return $pop[[NUM]]{{$}} 100 define float @two_f32() { 101 ret float 2.0 102 } 103 104 ; CHECK-LABEL: nan_f32: 105 ; CHECK-NEXT: .result f32{{$}} 106 ; CHECK-NEXT: f32.const $push[[NUM:[0-9]+]]=, nan{{$}} 107 ; CHECK-NEXT: return $pop[[NUM]]{{$}} 108 define float @nan_f32() { 109 ret float 0x7FF8000000000000 110 } 111 112 ; CHECK-LABEL: negnan_f32: 113 ; CHECK-NEXT: .result f32{{$}} 114 ; CHECK-NEXT: f32.const $push[[NUM:[0-9]+]]=, -nan{{$}} 115 ; CHECK-NEXT: return $pop[[NUM]]{{$}} 116 define float @negnan_f32() { 117 ret float 0xFFF8000000000000 118 } 119 120 ; CHECK-LABEL: inf_f32: 121 ; CHECK-NEXT: .result f32{{$}} 122 ; CHECK-NEXT: f32.const $push[[NUM:[0-9]+]]=, infinity{{$}} 123 ; CHECK-NEXT: return $pop[[NUM]]{{$}} 124 define float @inf_f32() { 125 ret float 0x7FF0000000000000 126 } 127 128 ; CHECK-LABEL: neginf_f32: 129 ; CHECK-NEXT: .result f32{{$}} 130 ; CHECK-NEXT: f32.const $push[[NUM:[0-9]+]]=, -infinity{{$}} 131 ; CHECK-NEXT: return $pop[[NUM]]{{$}} 132 define float @neginf_f32() { 133 ret float 0xFFF0000000000000 134 } 135 136 ; CHECK-LABEL: negzero_f64: 137 ; CHECK-NEXT: .result f64{{$}} 138 ; CHECK-NEXT: f64.const $push[[NUM:[0-9]+]]=, -0x0p0{{$}} 139 ; CHECK-NEXT: return $pop[[NUM]]{{$}} 140 define double @negzero_f64() { 141 ret double -0.0 142 } 143 144 ; CHECK-LABEL: zero_f64: 145 ; CHECK-NEXT: .result f64{{$}} 146 ; CHECK-NEXT: f64.const $push[[NUM:[0-9]+]]=, 0x0p0{{$}} 147 ; CHECK-NEXT: return $pop[[NUM]]{{$}} 148 define double @zero_f64() { 149 ret double 0.0 150 } 151 152 ; CHECK-LABEL: one_f64: 153 ; CHECK-NEXT: .result f64{{$}} 154 ; CHECK-NEXT: f64.const $push[[NUM:[0-9]+]]=, 0x1p0{{$}} 155 ; CHECK-NEXT: return $pop[[NUM]]{{$}} 156 define double @one_f64() { 157 ret double 1.0 158 } 159 160 ; CHECK-LABEL: two_f64: 161 ; CHECK-NEXT: .result f64{{$}} 162 ; CHECK-NEXT: f64.const $push[[NUM:[0-9]+]]=, 0x1p1{{$}} 163 ; CHECK-NEXT: return $pop[[NUM]]{{$}} 164 define double @two_f64() { 165 ret double 2.0 166 } 167 168 ; CHECK-LABEL: nan_f64: 169 ; CHECK-NEXT: .result f64{{$}} 170 ; CHECK-NEXT: f64.const $push[[NUM:[0-9]+]]=, nan{{$}} 171 ; CHECK-NEXT: return $pop[[NUM]]{{$}} 172 define double @nan_f64() { 173 ret double 0x7FF8000000000000 174 } 175 176 ; CHECK-LABEL: negnan_f64: 177 ; CHECK-NEXT: .result f64{{$}} 178 ; CHECK-NEXT: f64.const $push[[NUM:[0-9]+]]=, -nan{{$}} 179 ; CHECK-NEXT: return $pop[[NUM]]{{$}} 180 define double @negnan_f64() { 181 ret double 0xFFF8000000000000 182 } 183 184 ; CHECK-LABEL: inf_f64: 185 ; CHECK-NEXT: .result f64{{$}} 186 ; CHECK-NEXT: f64.const $push[[NUM:[0-9]+]]=, infinity{{$}} 187 ; CHECK-NEXT: return $pop[[NUM]]{{$}} 188 define double @inf_f64() { 189 ret double 0x7FF0000000000000 190 } 191 192 ; CHECK-LABEL: neginf_f64: 193 ; CHECK-NEXT: .result f64{{$}} 194 ; CHECK-NEXT: f64.const $push[[NUM:[0-9]+]]=, -infinity{{$}} 195 ; CHECK-NEXT: return $pop[[NUM]]{{$}} 196 define double @neginf_f64() { 197 ret double 0xFFF0000000000000 198 } 199