File tree 1 file changed +18
-0
lines changed
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -253,6 +253,8 @@ class IRBuilderSpec : XCTestCase {
253
253
module. dump ( )
254
254
} )
255
255
256
+ // MARK: Cast Instructions
257
+
256
258
XCTAssert ( fileCheckOutput ( of: . stderr, withPrefixes: [ " CAST " ] ) {
257
259
// CAST: ; ModuleID = '[[ModuleName:IRBuilderTest]]'
258
260
// CAST-NEXT: source_filename = "[[ModuleName]]"
@@ -285,12 +287,28 @@ class IRBuilderSpec : XCTestCase {
285
287
// CAST-NEXT: %4 = bitcast i64* %0 to i8*
286
288
_ = builder. buildBitCast ( alloca, type: PointerType . toVoid)
287
289
290
+ // CAST-NEXT: %5 = alloca double
291
+ let dblAlloca = builder. buildAlloca ( type: FloatType . double)
292
+
293
+ // CAST-NEXT: %6 = load double, double* %5
294
+ let dblVal = builder. buildLoad ( dblAlloca)
295
+
296
+ // CAST-NEXT: %7 = fptrunc double %6 to float
297
+ let fltVal = builder. buildFPCast ( dblVal, type: FloatType . float)
298
+
299
+ // CAST-NEXT: %8 = fpext float %7 to double
300
+ _ = builder. buildFPCast ( fltVal, type: FloatType . double)
301
+
288
302
// CAST-NEXT: ret i32 0
289
303
builder. buildRet ( IntType . int32. constant ( 0 ) )
290
304
291
305
// CAST-NEXT: }
292
306
module. dump ( )
307
+
308
+ print ( module)
293
309
} )
310
+
311
+ // MARK: C Standard Library Instructions
294
312
}
295
313
296
314
#if !os(macOS)
You can’t perform that action at this time.
0 commit comments