@@ -151,10 +151,12 @@ AVRTargetLowering::AVRTargetLowering(const AVRTargetMachine &TM,
151
151
setOperationAction (ISD::SREM, MVT::i16 , Expand);
152
152
153
153
// Make division and modulus custom
154
- for (MVT VT : MVT::integer_valuetypes ()) {
155
- setOperationAction (ISD::UDIVREM, VT, Custom);
156
- setOperationAction (ISD::SDIVREM, VT, Custom);
157
- }
154
+ setOperationAction (ISD::UDIVREM, MVT::i8 , Custom);
155
+ setOperationAction (ISD::UDIVREM, MVT::i16 , Custom);
156
+ setOperationAction (ISD::UDIVREM, MVT::i32 , Custom);
157
+ setOperationAction (ISD::SDIVREM, MVT::i8 , Custom);
158
+ setOperationAction (ISD::SDIVREM, MVT::i16 , Custom);
159
+ setOperationAction (ISD::SDIVREM, MVT::i32 , Custom);
158
160
159
161
// Do not use MUL. The AVR instructions are closer to SMUL_LOHI &co.
160
162
setOperationAction (ISD::MUL, MVT::i8 , Expand);
@@ -190,41 +192,29 @@ AVRTargetLowering::AVRTargetLowering(const AVRTargetMachine &TM,
190
192
// improvements in how we treat 16-bit "registers" to be feasible.
191
193
}
192
194
193
- // Division rtlib functions (not supported)
195
+ // Division rtlib functions (not supported), use divmod functions instead
194
196
setLibcallName (RTLIB::SDIV_I8, nullptr );
195
197
setLibcallName (RTLIB::SDIV_I16, nullptr );
196
198
setLibcallName (RTLIB::SDIV_I32, nullptr );
197
- setLibcallName (RTLIB::SDIV_I64, nullptr );
198
- setLibcallName (RTLIB::SDIV_I128, nullptr );
199
199
setLibcallName (RTLIB::UDIV_I8, nullptr );
200
200
setLibcallName (RTLIB::UDIV_I16, nullptr );
201
201
setLibcallName (RTLIB::UDIV_I32, nullptr );
202
- setLibcallName (RTLIB::UDIV_I64, nullptr );
203
- setLibcallName (RTLIB::UDIV_I128, nullptr );
204
202
205
- // Modulus rtlib functions (not supported)
203
+ // Modulus rtlib functions (not supported), use divmod functions instead
206
204
setLibcallName (RTLIB::SREM_I8, nullptr );
207
205
setLibcallName (RTLIB::SREM_I16, nullptr );
208
206
setLibcallName (RTLIB::SREM_I32, nullptr );
209
- setLibcallName (RTLIB::SREM_I64, nullptr );
210
- setLibcallName (RTLIB::SREM_I128, nullptr );
211
207
setLibcallName (RTLIB::UREM_I8, nullptr );
212
208
setLibcallName (RTLIB::UREM_I16, nullptr );
213
209
setLibcallName (RTLIB::UREM_I32, nullptr );
214
- setLibcallName (RTLIB::UREM_I64, nullptr );
215
- setLibcallName (RTLIB::UREM_I128, nullptr );
216
210
217
211
// Division and modulus rtlib functions
218
212
setLibcallName (RTLIB::SDIVREM_I8, " __divmodqi4" );
219
213
setLibcallName (RTLIB::SDIVREM_I16, " __divmodhi4" );
220
214
setLibcallName (RTLIB::SDIVREM_I32, " __divmodsi4" );
221
- setLibcallName (RTLIB::SDIVREM_I64, " __divmoddi4" );
222
- setLibcallName (RTLIB::SDIVREM_I128, " __divmodti4" );
223
215
setLibcallName (RTLIB::UDIVREM_I8, " __udivmodqi4" );
224
216
setLibcallName (RTLIB::UDIVREM_I16, " __udivmodhi4" );
225
217
setLibcallName (RTLIB::UDIVREM_I32, " __udivmodsi4" );
226
- setLibcallName (RTLIB::UDIVREM_I64, " __udivmoddi4" );
227
- setLibcallName (RTLIB::UDIVREM_I128, " __udivmodti4" );
228
218
229
219
// Several of the runtime library functions use a special calling conv
230
220
setLibcallCallingConv (RTLIB::SDIVREM_I8, CallingConv::AVR_BUILTIN);
@@ -357,12 +347,6 @@ SDValue AVRTargetLowering::LowerDivRem(SDValue Op, SelectionDAG &DAG) const {
357
347
case MVT::i32 :
358
348
LC = IsSigned ? RTLIB::SDIVREM_I32 : RTLIB::UDIVREM_I32;
359
349
break ;
360
- case MVT::i64 :
361
- LC = IsSigned ? RTLIB::SDIVREM_I64 : RTLIB::UDIVREM_I64;
362
- break ;
363
- case MVT::i128 :
364
- LC = IsSigned ? RTLIB::SDIVREM_I128 : RTLIB::UDIVREM_I128;
365
- break ;
366
350
}
367
351
368
352
SDValue InChain = DAG.getEntryNode ();
0 commit comments