Pattern for f32 to i64 conversion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148869 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Akira Hatanaka 2012-01-24 22:05:25 +00:00
parent c389af94b6
commit e6e4b3a002
2 changed files with 8 additions and 0 deletions

View File

@ -337,6 +337,7 @@ let Predicates = [IsFP64bit] in {
(CVT_D64_L (DMTC1 CPU64Regs:$src))>; (CVT_D64_L (DMTC1 CPU64Regs:$src))>;
def : Pat<(i32 (fp_to_sint FGR64:$src)), (MFC1 (TRUNC_W_D64 FGR64:$src))>; def : Pat<(i32 (fp_to_sint FGR64:$src)), (MFC1 (TRUNC_W_D64 FGR64:$src))>;
def : Pat<(i64 (fp_to_sint FGR32:$src)), (DMFC1 (TRUNC_L_S FGR32:$src))>;
def : Pat<(i64 (fp_to_sint FGR64:$src)), (DMFC1 (TRUNC_L_D64 FGR64:$src))>; def : Pat<(i64 (fp_to_sint FGR64:$src)), (DMFC1 (TRUNC_L_D64 FGR64:$src))>;
def : Pat<(f32 (fround FGR64:$src)), (CVT_S_D64 FGR64:$src)>; def : Pat<(f32 (fround FGR64:$src)), (CVT_S_D64 FGR64:$src)>;

View File

@ -17,3 +17,10 @@ entry:
ret i64 %conv ret i64 %conv
} }
define i64 @i64_float(float %f) nounwind readnone {
entry:
; CHECK: trunc.l.s
%conv = fptosi float %f to i64
ret i64 %conv
}