Files
swift-mirror/test/IRGen/int_to_fp.sil
Joe Groff 8cb1175e49 IRGen: Emit public definitions with protected visibility on ELF.
This prevents the linker from trying to emit relative relocations to locally-defined public symbols into dynamic libraries, which gives ld.so heartache.
2016-02-08 13:09:27 -08:00

31 lines
952 B
Plaintext

// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s
// Test if llvm can generate code for it
// RUN: %target-swift-frontend -c %s
sil_stage canonical
import Builtin
// CHECK-LABEL: define{{( protected)?}} float @test_large
// CHECK: %1 = trunc i2048 %0 to i64
// CHECK: %2 = sitofp i64 %1 to float
// CHECK: ret float %2
sil @test_large : $@convention(thin) (Builtin.Int2048) -> Builtin.FPIEEE32 {
bb0(%0 : $Builtin.Int2048):
%2 = builtin "itofp_with_overflow_Int2048_FPIEEE32"(%0 : $Builtin.Int2048) : $Builtin.FPIEEE32
return %2 : $Builtin.FPIEEE32
}
// CHECK-LABEL: define{{( protected)?}} float @test_small
// CHECK: %1 = sext i32 %0 to i64
// CHECK: %2 = sitofp i64 %1 to float
// CHECK: ret float %2
sil @test_small : $@convention(thin) (Builtin.Int32) -> Builtin.FPIEEE32 {
bb0(%0 : $Builtin.Int32):
%2 = builtin "itofp_with_overflow_Int32_FPIEEE32"(%0 : $Builtin.Int32) : $Builtin.FPIEEE32
return %2 : $Builtin.FPIEEE32
}