diff --git a/include/IRInstruction.h b/include/IRInstruction.h
index 4fca49dad6d96f3de3ad1f56723d760d06351716..a41d1d434210e9d79e082353a67cb495fcef27c3 100644
--- a/include/IRInstruction.h
+++ b/include/IRInstruction.h
@@ -565,6 +565,11 @@ public:
 
     FNegInstruction(ValueRef* dst, ValueRef* src);
 
+    void codegen(AsmBuilder *pBuilder,
+                 std::map<std::string, int> &offset_table,
+                 std::map<std::string, int> &size_table,
+                 int frameSize) override;
+
     void outPut(std::ostream &os) override;
 };
 
diff --git a/include/codegen/MachineInstruction.hpp b/include/codegen/MachineInstruction.hpp
index 2f5a258c42a53557cd31feacbe0bccd86fc2a8ae..1fb4e767b2806b88920be5b59b0e7d2b36b3595f 100644
--- a/include/codegen/MachineInstruction.hpp
+++ b/include/codegen/MachineInstruction.hpp
@@ -110,6 +110,20 @@ public:
     void output(std::ostream &os) const override;
 };
 
+class FnegMInstruction : public MachineInstruction {
+public:
+    enum OpType {
+        FNEG = 25
+    };
+
+    FnegMInstruction(MachineBlock *mBlock,
+                       int type,
+                       MachineOperand *dst,
+                       MachineOperand *src);
+
+    void output(std::ostream &os) const override;
+};
+
 
 class LoadMInstruction : public MachineInstruction {
 public:
diff --git a/src/IRInstruction.cpp b/src/IRInstruction.cpp
index fa970cfb8e418fe4cb8f8c62f1012db1313f9b25..eeb26ebcfd75eb40945ffbf737a642950e895b5e 100644
--- a/src/IRInstruction.cpp
+++ b/src/IRInstruction.cpp
@@ -167,7 +167,7 @@ void LoadInstruction::codegen(AsmBuilder *pBuilder, std::map<std::string, int> &
                                                 new MachineOperand(MachineOperand::IMM, 0),
                                                 new MachineOperand(MachineOperand::VREG, this->src->get_Ref()));
                 pBuilder->getBlock()->insertInst(flw);
-                
+
             } else {
                 auto lw1 = new LoadMInstruction(pBuilder->getBlock(),
                                             LoadMInstruction::LW,
@@ -537,8 +537,6 @@ CmpInstruction::codegen(AsmBuilder *pBuilder, map<std::string, int> &offset_tabl
         }
         if(cmpType(this->opTy) == EQ && (RefType(this->src1->type) == IntVar || RefType(this->src1->type) == IntConst)){
             xoriReg(pBuilder,new MachineOperand(MachineOperand::VREG, this->result->get_Ref()));
-        } else if(cmpType(this->opTy) == NE && (RefType(this->src1->type) == FloatVar || RefType(this->src1->type) == FloatConst)){
-            xoriReg(pBuilder,new MachineOperand(MachineOperand::VREG, this->result->get_Ref()));
         }
     }
     else if(cmpType(this->opTy) == LT || cmpType(this->opTy) == GE){
@@ -1195,6 +1193,16 @@ void FNegInstruction::outPut(std::ostream &os) {
     os << dst->name + " = fneg float " + src->get_Ref();
 }
 
+void
+FNegInstruction::codegen(AsmBuilder *pBuilder, map<std::string, int> &offset_table, map<std::string, int> &size_table,
+                         int frameSize) {
+    auto fneg = new FnegMInstruction(pBuilder->getBlock(),
+                                     FnegMInstruction::FNEG,
+                                     new MachineOperand(MachineOperand::FVREG, this->dst->get_Ref()),
+                                     new MachineOperand(MachineOperand::FVREG, this->src->get_Ref()));
+    pBuilder->getBlock()->insertInst(fneg);
+}
+
 
 //BitCastInstruction::BitCastInstruction(BasicBlock *block) : IRInstruction(BITCAST){}
 //
diff --git a/src/codegen/MachineInstruction.cpp b/src/codegen/MachineInstruction.cpp
index 9ebc51d92ca75740b1c617e308d9eded25864df8..bf0ba1faff3adeade48026765c0232cc7e5574f1 100644
--- a/src/codegen/MachineInstruction.cpp
+++ b/src/codegen/MachineInstruction.cpp
@@ -240,3 +240,16 @@ void ConvertMInstruction::output(std::ostream &os) const {
     def_list[0]->output(os), os << ", ";
     use_list[0]->output(os), os << ", rtz";
 }
+
+FnegMInstruction::FnegMInstruction(MachineBlock *mBlock, int type, MachineOperand *dst, MachineOperand *src)
+        :MachineInstruction(mBlock, MachineInstruction::BINARY, type){
+    use_list.push_back(src);
+    def_list.push_back(dst);
+    dst->parent = src->parent = this;
+}
+
+void FnegMInstruction::output(std::ostream &os) const {
+    os << "\tfneg.s ";
+    def_list[0]->output(os), os << ", ";
+    use_list[0]->output(os);
+}