blob: 9155ed5926f5eb2de7d9fe4a7623145630b3d654 [file] [log] [blame]
Stephen Lin552c9152013-07-13 22:08:55 +00001; RUN: llc < %s
2
3; This test formerly failed because of wrong custom lowering for
4; fptosi of ppc_fp128.
5
6target datalayout = "E-p:32:32:32-S0-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f16:16:16-f32:32:32-f64:64:64-f128:64:128-v64:64:64-v128:128:128-a0:0:64-n32"
7target triple = "powerpc-unknown-linux-gnu"
8
9%core.time.TickDuration = type { i64 }
10
11@_D4core4time12TickDuration11ticksPerSecyl = global i64 0
12@.str5 = internal unnamed_addr constant [40 x i8] c"..\5Cldc\5Cruntime\5Cdruntime\5Csrc\5Ccore\5Ctime.d\00"
13@.str83 = internal constant [10 x i8] c"null this\00"
David Blaikief72d05b2015-03-13 18:20:45 +000014@.modulefilename = internal constant { i32, i8* } { i32 39, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str5, i32 0, i32 0) }
Stephen Lin552c9152013-07-13 22:08:55 +000015
16declare i8* @_d_assert_msg({ i32, i8* }, { i32, i8* }, i32)
17
18
19define weak_odr fastcc i64 @_D4core4time12TickDuration30__T2toVAyaa7_7365636f6e6473TlZ2toMxFNaNbNfZl(%core.time.TickDuration* %.this_arg) {
20entry:
21 %unitsPerSec = alloca i64, align 8
22 %tmp = icmp ne %core.time.TickDuration* %.this_arg, null
23 br i1 %tmp, label %noassert, label %assert
24
25assert: ; preds = %entry
David Blaikiea79ac142015-02-27 21:17:42 +000026 %tmp1 = load { i32, i8* }, { i32, i8* }* @.modulefilename
David Blaikief72d05b2015-03-13 18:20:45 +000027 %0 = call i8* @_d_assert_msg({ i32, i8* } { i32 9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str83, i32 0, i32 0) }, { i32, i8* } %tmp1, i32 1586)
Stephen Lin552c9152013-07-13 22:08:55 +000028 unreachable
29
30noassert: ; preds = %entry
David Blaikie79e6c742015-02-27 19:29:02 +000031 %tmp2 = getelementptr %core.time.TickDuration, %core.time.TickDuration* %.this_arg, i32 0, i32 0
David Blaikiea79ac142015-02-27 21:17:42 +000032 %tmp3 = load i64, i64* %tmp2
Stephen Lin552c9152013-07-13 22:08:55 +000033 %tmp4 = sitofp i64 %tmp3 to ppc_fp128
David Blaikiea79ac142015-02-27 21:17:42 +000034 %tmp5 = load i64, i64* @_D4core4time12TickDuration11ticksPerSecyl
Stephen Lin552c9152013-07-13 22:08:55 +000035 %tmp6 = sitofp i64 %tmp5 to ppc_fp128
36 %tmp7 = fdiv ppc_fp128 %tmp6, 0xM80000000000000000000000000000000
37 %tmp8 = fdiv ppc_fp128 %tmp4, %tmp7
38 %tmp9 = fptosi ppc_fp128 %tmp8 to i64
39 ret i64 %tmp9
40}
41