_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: {
; 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
; 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:
; 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: