Commit 5a9f714f by Srdjan Obucina Committed by Jim Stichnoth

Subzero, MIPS32: Handling fptrunc and fpext casting

Patch implements truncation and extension of FP values. R=stichnot@chromium.org Review URL: https://codereview.chromium.org/2324903002 . Patch from Srdjan Obucina <Srdjan.Obucina@imgtec.com>.
parent 53d05686
......@@ -2393,22 +2393,31 @@ void TargetMIPS32::lowerCast(const InstCast *Instr) {
_mov(Dest, T);
break;
}
case InstCast::Fptrunc:
// Use _cvt_d_s
UnimplementedLoweringError(this, Instr);
case InstCast::Fptrunc: {
assert(Dest->getType() == IceType_f32);
assert(Src0->getType() == IceType_f64);
auto *DestR = legalizeToReg(Dest);
auto *Src0R = legalizeToReg(Src0);
_cvt_s_d(DestR, Src0R);
_mov(Dest, DestR);
break;
}
case InstCast::Fpext: {
// Use _cvt_s_d
UnimplementedLoweringError(this, Instr);
assert(Dest->getType() == IceType_f64);
assert(Src0->getType() == IceType_f32);
auto *DestR = legalizeToReg(Dest);
auto *Src0R = legalizeToReg(Src0);
_cvt_d_s(DestR, Src0R);
_mov(Dest, DestR);
break;
}
case InstCast::Fptosi:
case InstCast::Fptosi: //
UnimplementedLoweringError(this, Instr);
break;
case InstCast::Fptoui:
UnimplementedLoweringError(this, Instr);
break;
case InstCast::Sitofp:
case InstCast::Sitofp: //
UnimplementedLoweringError(this, Instr);
break;
case InstCast::Uitofp: {
......
......@@ -16,6 +16,11 @@
; RUN: | %if --need=allow_dump --need=target_ARM32 --command FileCheck %s \
; RUN: --check-prefix=ARM32
; RUN: %if --need=allow_dump --need=target_MIPS32 --command %p2i \
; RUN: --filetype=asm --target mips32 -i %s --args -Om1 --skip-unimplemented \
; RUN: | %if --need=allow_dump --need=target_MIPS32 --command FileCheck %s \
; RUN: --check-prefix=MIPS32
define internal float @fptrunc(double %a) {
entry:
%conv = fptrunc double %a to float
......@@ -26,6 +31,8 @@ entry:
; CHECK: fld
; ARM32-LABEL: fptrunc
; ARM32: vcvt.f32.f64 {{s[0-9]+}}, {{d[0-9]+}}
; MIPS32-LABEL: fptrunc
; MIPS32: cvt.s.d
define internal double @fpext(float %a) {
entry:
......@@ -37,6 +44,8 @@ entry:
; CHECK: fld
; ARM32-LABEL: fpext
; ARM32: vcvt.f64.f32 {{d[0-9]+}}, {{s[0-9]+}}
; MIPS32-LABEL: fpext
; MIPS32: cvt.d.s
define internal i64 @doubleToSigned64(double %a) {
entry:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment