File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -253,6 +253,8 @@ class IRBuilderSpec : XCTestCase {
253253 module. dump ( )
254254 } )
255255
256+ // MARK: Cast Instructions
257+
256258 XCTAssert ( fileCheckOutput ( of: . stderr, withPrefixes: [ " CAST " ] ) {
257259 // CAST: ; ModuleID = '[[ModuleName:IRBuilderTest]]'
258260 // CAST-NEXT: source_filename = "[[ModuleName]]"
@@ -285,12 +287,28 @@ class IRBuilderSpec : XCTestCase {
285287 // CAST-NEXT: %4 = bitcast i64* %0 to i8*
286288 _ = builder. buildBitCast ( alloca, type: PointerType . toVoid)
287289
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+
288302 // CAST-NEXT: ret i32 0
289303 builder. buildRet ( IntType . int32. constant ( 0 ) )
290304
291305 // CAST-NEXT: }
292306 module. dump ( )
307+
308+ print ( module)
293309 } )
310+
311+ // MARK: C Standard Library Instructions
294312 }
295313
296314 #if !os(macOS)
You can’t perform that action at this time.
0 commit comments