switch (Instr->getOp()) {
default:
break;
- case InstArithmetic::Fadd:
- case InstArithmetic::Fsub:
- case InstArithmetic::Fmul:
- case InstArithmetic::Fdiv:
case InstArithmetic::Frem:
UnimplementedLoweringError(this, Instr);
return;
_mov(Dest, T);
return;
}
- case InstArithmetic::Fadd:
+ case InstArithmetic::Fadd: {
+ if (DestTy == IceType_f32) {
+ _add_s(T, Src0R, Src1R);
+ _mov(Dest, T);
+ return;
+ }
+ if (DestTy == IceType_f64) {
+ _add_d(T, Src0R, Src1R);
+ _mov(Dest, T);
+ return;
+ }
break;
+ }
case InstArithmetic::Fsub:
+ if (DestTy == IceType_f32) {
+ _sub_s(T, Src0R, Src1R);
+ _mov(Dest, T);
+ return;
+ }
+ if (DestTy == IceType_f64) {
+ _sub_d(T, Src0R, Src1R);
+ _mov(Dest, T);
+ return;
+ }
break;
case InstArithmetic::Fmul:
+ if (DestTy == IceType_f32) {
+ _mul_s(T, Src0R, Src1R);
+ _mov(Dest, T);
+ return;
+ }
+ if (DestTy == IceType_f64) {
+ _mul_d(T, Src0R, Src1R);
+ _mov(Dest, T);
+ return;
+ }
break;
case InstArithmetic::Fdiv:
+ if (DestTy == IceType_f32) {
+ _div_s(T, Src0R, Src1R);
+ _mov(Dest, T);
+ return;
+ }
+ if (DestTy == IceType_f64) {
+ _div_d(T, Src0R, Src1R);
+ _mov(Dest, T);
+ return;
+ }
break;
case InstArithmetic::Frem:
break;
Context.insert<InstFakeUse>(R1);
break;
}
-
default:
UnimplementedLoweringError(this, Instr);
}
Variable *Reg = makeReg(Ty, RegNum);
if (isVectorType(Ty)) {
UnimplementedError(getFlags());
- } else if (isFloatingType(Ty)) {
- (Ty == IceType_f32) ? _mov_s(Reg, llvm::dyn_cast<Variable>(Src))
- : _mov_d(Reg, llvm::dyn_cast<Variable>(Src));
} else {
// Mov's Src operand can really only be the flexible second operand type
// or a register. Users should guarantee that.
; RUN: | %if --need=target_ARM32 --need=allow_dump \
; RUN: --command FileCheck --check-prefix ARM32 %s
+; RUN: %if --need=target_MIPS32 --need=allow_dump \
+; RUN: --command %p2i --filetype=asm --assemble --disassemble --target \
+; RUN: mips32 -i %s --args -O2 --skip-unimplemented \
+; RUN: | %if --need=target_MIPS32 --need=allow_dump \
+; RUN: --command FileCheck --check-prefix MIPS32 %s
+; RUN: %if --need=target_MIPS32 --need=allow_dump \
+; RUN: --command %p2i --filetype=asm --assemble --disassemble --target \
+; RUN: mips32 -i %s --args -Om1 --skip-unimplemented \
+; RUN: | %if --need=target_MIPS32 --need=allow_dump \
+; RUN: --command FileCheck --check-prefix MIPS32 %s
+
define internal float @addFloat(float %a, float %b) {
entry:
%add = fadd float %a, %b
; CHECK: fld
; ARM32-LABEL: addFloat
; ARM32: vadd.f32 s{{[0-9]+}}, s
+; MIPS32-LABEL: addFloat
+; MIPS32: add.s
define internal double @addDouble(double %a, double %b) {
entry:
; CHECK: fld
; ARM32-LABEL: addDouble
; ARM32: vadd.f64 d{{[0-9]+}}, d
+; MIPS32-LABEL: addDouble
+; MIPS32: add.d
define internal float @subFloat(float %a, float %b) {
entry:
; CHECK: fld
; ARM32-LABEL: subFloat
; ARM32: vsub.f32 s{{[0-9]+}}, s
+; MIPS32-LABEL: subFloat
+; MIPS32: sub.s
define internal double @subDouble(double %a, double %b) {
entry:
; CHECK: fld
; ARM32-LABEL: subDouble
; ARM32: vsub.f64 d{{[0-9]+}}, d
+; MIPS32-LABEL: subDouble
+; MIPS32: sub.d
define internal float @mulFloat(float %a, float %b) {
entry:
; CHECK: fld
; ARM32-LABEL: mulFloat
; ARM32: vmul.f32 s{{[0-9]+}}, s
+; MIPS32-LABEL: mulFloat
+; MIPS32: mul.s
define internal double @mulDouble(double %a, double %b) {
entry:
; CHECK: fld
; ARM32-LABEL: mulDouble
; ARM32: vmul.f64 d{{[0-9]+}}, d
+; MIPS32-LABEL: mulDouble
+; MIPS32: mul.d
define internal float @divFloat(float %a, float %b) {
entry:
; CHECK: fld
; ARM32-LABEL: divFloat
; ARM32: vdiv.f32 s{{[0-9]+}}, s
+; MIPS32-LABEL: divFloat
+; MIPS32: div.s
define internal double @divDouble(double %a, double %b) {
entry:
; CHECK: fld
; ARM32-LABEL: divDouble
; ARM32: vdiv.f64 d{{[0-9]+}}, d
+; MIPS32-LABEL: divDouble
+; MIPS32: div.d
define internal float @remFloat(float %a, float %b) {
entry: