OLD | NEW |
---|---|
1 // | 1 // |
2 // The Subzero Code Generator | 2 // The Subzero Code Generator |
3 // | 3 // |
4 // This file is distributed under the University of Illinois Open Source | 4 // This file is distributed under the University of Illinois Open Source |
5 // License. See LICENSE.TXT for details. | 5 // License. See LICENSE.TXT for details. |
6 // | 6 // |
7 //===----------------------------------------------------------------------===// | 7 //===----------------------------------------------------------------------===// |
8 /// | 8 /// |
9 /// \file | 9 /// \file |
10 /// \brief Implements the TargetLoweringMIPS32 class, which consists almost | 10 /// \brief Implements the TargetLoweringMIPS32 class, which consists almost |
(...skipping 2034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2045 break; | 2045 break; |
2046 } | 2046 } |
2047 } | 2047 } |
2048 } | 2048 } |
2049 | 2049 |
2050 void TargetMIPS32::lowerExtractElement(const InstExtractElement *Instr) { | 2050 void TargetMIPS32::lowerExtractElement(const InstExtractElement *Instr) { |
2051 UnimplementedLoweringError(this, Instr); | 2051 UnimplementedLoweringError(this, Instr); |
2052 } | 2052 } |
2053 | 2053 |
2054 void TargetMIPS32::lowerFcmp(const InstFcmp *Instr) { | 2054 void TargetMIPS32::lowerFcmp(const InstFcmp *Instr) { |
2055 UnimplementedLoweringError(this, Instr); | 2055 |
Jim Stichnoth
2016/09/12 14:14:41
delete this blank line?
obucinac
2016/09/12 19:16:16
Done.
| |
2056 Variable *Dest = Instr->getDest(); | |
2057 if (isVectorType(Dest->getType())) { | |
2058 UnimplementedLoweringError(this, Instr); | |
2059 return; | |
2060 } | |
2061 | |
2062 auto *Src0 = Instr->getSrc(0); | |
2063 auto *Src1 = Instr->getSrc(1); | |
2064 auto *Zero = getZero(); | |
2065 | |
2066 InstFcmp::FCond Cond = Instr->getCondition(); | |
2067 auto *DestR = legalizeToReg(Dest); | |
2068 auto *Src0R = legalizeToReg(Src0); | |
2069 auto *Src1R = legalizeToReg(Src1); | |
2070 const Type Src0Ty = Src0->getType(); | |
2071 | |
2072 Operand *FCC0 = OperandMIPS32FCC::create(getContext().getNode()->getCfg(), | |
Jim Stichnoth
2016/09/12 14:14:41
You can just use TargetLowering::getFunc() here.
obucinac
2016/09/12 19:16:16
Done.
| |
2073 IceType_i32, OperandMIPS32FCC::FCC0); | |
2074 | |
2075 switch (Cond) { | |
2076 default: { | |
2077 UnimplementedLoweringError(this, Instr); | |
2078 return; | |
2079 } | |
2080 case InstFcmp::False: { | |
2081 Context.insert<InstFakeUse>(Src0R); | |
2082 Context.insert<InstFakeUse>(Src1R); | |
2083 _addiu(DestR, Zero, 0); | |
2084 _mov(Dest, DestR); | |
2085 break; | |
2086 } | |
2087 case InstFcmp::Oeq: { | |
Jim Stichnoth
2016/09/12 14:14:41
Does the MIPS instruction set really provide a 1:1
obucinac
2016/09/12 19:16:16
This is related link:
https://imagination-technol
| |
2088 if (Src0Ty == IceType_f32) { | |
2089 _c_eq_s(Src0R, Src1R); | |
2090 } else { | |
2091 _c_eq_d(Src0R, Src1R); | |
2092 } | |
2093 _movf(DestR, Zero, FCC0); | |
2094 _mov(Dest, DestR); | |
2095 break; | |
2096 } | |
2097 case InstFcmp::Ogt: { | |
2098 if (Src0Ty == IceType_f32) { | |
2099 _c_ule_s(Src0R, Src1R); | |
2100 } else { | |
2101 _c_ule_d(Src0R, Src1R); | |
2102 } | |
2103 _movt(DestR, Zero, FCC0); | |
2104 _mov(Dest, DestR); | |
2105 break; | |
2106 } | |
2107 case InstFcmp::Oge: { | |
2108 if (Src0Ty == IceType_f32) { | |
2109 _c_ult_s(Src0R, Src1R); | |
2110 } else { | |
2111 _c_ult_d(Src0R, Src1R); | |
2112 } | |
2113 _movt(DestR, Zero, FCC0); | |
2114 _mov(Dest, DestR); | |
2115 break; | |
2116 } | |
2117 case InstFcmp::Olt: { | |
2118 if (Src0Ty == IceType_f32) { | |
2119 _c_olt_s(Src0R, Src1R); | |
2120 } else { | |
2121 _c_olt_d(Src0R, Src1R); | |
2122 } | |
2123 _movf(DestR, Zero, FCC0); | |
2124 _mov(Dest, DestR); | |
2125 break; | |
2126 } | |
2127 case InstFcmp::Ole: { | |
2128 if (Src0Ty == IceType_f32) { | |
2129 _c_ole_s(Src0R, Src1R); | |
2130 } else { | |
2131 _c_ole_d(Src0R, Src1R); | |
2132 } | |
2133 _movf(DestR, Zero, FCC0); | |
2134 _mov(Dest, DestR); | |
2135 break; | |
2136 } | |
2137 case InstFcmp::One: { | |
2138 if (Src0Ty == IceType_f32) { | |
2139 _c_ueq_s(Src0R, Src1R); | |
2140 } else { | |
2141 _c_ueq_d(Src0R, Src1R); | |
2142 } | |
2143 _movt(DestR, Zero, FCC0); | |
2144 _mov(Dest, DestR); | |
2145 break; | |
2146 } | |
2147 case InstFcmp::Ord: { | |
2148 if (Src0Ty == IceType_f32) { | |
2149 _c_un_s(Src0R, Src1R); | |
2150 } else { | |
2151 _c_un_d(Src0R, Src1R); | |
2152 } | |
2153 _movt(DestR, Zero, FCC0); | |
2154 _mov(Dest, DestR); | |
2155 break; | |
2156 } | |
2157 case InstFcmp::Ueq: { | |
2158 if (Src0Ty == IceType_f32) { | |
2159 _c_ueq_s(Src0R, Src1R); | |
2160 } else { | |
2161 _c_ueq_d(Src0R, Src1R); | |
2162 } | |
2163 _movf(DestR, Zero, FCC0); | |
2164 _mov(Dest, DestR); | |
2165 break; | |
2166 } | |
2167 case InstFcmp::Ugt: { | |
2168 if (Src0Ty == IceType_f32) { | |
2169 _c_ole_s(Src0R, Src1R); | |
2170 } else { | |
2171 _c_ole_d(Src0R, Src1R); | |
2172 } | |
2173 _movt(DestR, Zero, FCC0); | |
2174 _mov(Dest, DestR); | |
2175 break; | |
2176 } | |
2177 case InstFcmp::Uge: { | |
2178 if (Src0Ty == IceType_f32) { | |
2179 _c_olt_s(Src0R, Src1R); | |
2180 } else { | |
2181 _c_olt_d(Src0R, Src1R); | |
2182 } | |
2183 _movt(DestR, Zero, FCC0); | |
2184 _mov(Dest, DestR); | |
2185 break; | |
2186 } | |
2187 case InstFcmp::Ult: { | |
2188 if (Src0Ty == IceType_f32) { | |
2189 _c_ult_s(Src0R, Src1R); | |
2190 } else { | |
2191 _c_ult_d(Src0R, Src1R); | |
2192 } | |
2193 _movf(DestR, Zero, FCC0); | |
2194 _mov(Dest, DestR); | |
2195 break; | |
2196 } | |
2197 case InstFcmp::Ule: { | |
2198 if (Src0Ty == IceType_f32) { | |
2199 _c_ule_s(Src0R, Src1R); | |
2200 } else { | |
2201 _c_ule_d(Src0R, Src1R); | |
2202 } | |
2203 _movf(DestR, Zero, FCC0); | |
2204 _mov(Dest, DestR); | |
2205 break; | |
2206 } | |
2207 case InstFcmp::Une: { | |
2208 if (Src0Ty == IceType_f32) { | |
2209 _c_eq_s(Src0R, Src1R); | |
2210 } else { | |
2211 _c_eq_d(Src0R, Src1R); | |
2212 } | |
2213 _movt(DestR, Zero, FCC0); | |
2214 _mov(Dest, DestR); | |
2215 break; | |
2216 } | |
2217 case InstFcmp::Uno: { | |
2218 if (Src0Ty == IceType_f32) { | |
2219 _c_un_s(Src0R, Src1R); | |
2220 } else { | |
2221 _c_un_d(Src0R, Src1R); | |
2222 } | |
2223 _movf(DestR, Zero, FCC0); | |
2224 _mov(Dest, DestR); | |
2225 break; | |
2226 } | |
2227 case InstFcmp::True: { | |
2228 Context.insert<InstFakeUse>(Src0R); | |
2229 Context.insert<InstFakeUse>(Src1R); | |
2230 _addiu(DestR, Zero, 1); | |
2231 _mov(Dest, DestR); | |
2232 break; | |
2233 } | |
2234 } | |
2056 } | 2235 } |
2057 | 2236 |
2058 void TargetMIPS32::lower64Icmp(const InstIcmp *Instr) { | 2237 void TargetMIPS32::lower64Icmp(const InstIcmp *Instr) { |
2059 UnimplementedLoweringError(this, Instr); | 2238 UnimplementedLoweringError(this, Instr); |
2060 return; | 2239 return; |
2061 } | 2240 } |
2062 | 2241 |
2063 void TargetMIPS32::lowerIcmp(const InstIcmp *Instr) { | 2242 void TargetMIPS32::lowerIcmp(const InstIcmp *Instr) { |
2064 auto *Src0 = Instr->getSrc(0); | 2243 auto *Src0 = Instr->getSrc(0); |
2065 auto *Src1 = Instr->getSrc(1); | 2244 auto *Src1 = Instr->getSrc(1); |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2729 Str << "\t.set\t" | 2908 Str << "\t.set\t" |
2730 << "nomips16\n"; | 2909 << "nomips16\n"; |
2731 } | 2910 } |
2732 | 2911 |
2733 SmallBitVector TargetMIPS32::TypeToRegisterSet[RCMIPS32_NUM]; | 2912 SmallBitVector TargetMIPS32::TypeToRegisterSet[RCMIPS32_NUM]; |
2734 SmallBitVector TargetMIPS32::TypeToRegisterSetUnfiltered[RCMIPS32_NUM]; | 2913 SmallBitVector TargetMIPS32::TypeToRegisterSetUnfiltered[RCMIPS32_NUM]; |
2735 SmallBitVector TargetMIPS32::RegisterAliases[RegMIPS32::Reg_NUM]; | 2914 SmallBitVector TargetMIPS32::RegisterAliases[RegMIPS32::Reg_NUM]; |
2736 | 2915 |
2737 } // end of namespace MIPS32 | 2916 } // end of namespace MIPS32 |
2738 } // end of namespace Ice | 2917 } // end of namespace Ice |
OLD | NEW |